cap_epoch_barrier = e;
}
+int Client::get_perf_counters(bufferlist *outbl) {
+ RWRef_t iref_reader(initialize_state, CLIENT_INITIALIZED);
+ if (!iref_reader.is_state_satisfied()) {
+ return -ENOTCONN;
+ }
+
+ ceph::bufferlist inbl;
+ std::ostringstream err;
+ std::vector<std::string> cmd{
+ "{\"prefix\": \"perf dump\"}",
+ "{\"format\": \"json\"}"
+ };
+
+ ldout(cct, 10) << __func__ << ": perf cmd=" << cmd << dendl;
+ return cct->get_admin_socket()->execute_command(cmd, inbl, err, outbl);
+}
+
std::vector<std::string> Client::get_tracked_keys() const noexcept
{
static constexpr auto as_sv = std::to_array<std::string_view>({
std::vector<std::pair<uint64_t,uint64_t>> *blocks);
int file_blockdiff_finish(struct scan_state_t *state);
+ int get_perf_counters(bufferlist *outbl);
+
/*
* Get the next snapshot delta entry.
*
* @param snap_info snapshot info struct (fetched via call to ceph_get_snap_info()).
*/
void ceph_free_snap_info_buffer(struct snap_info *snap_info);
+
+/**
+ * perf counters via libcephfs API.
+ */
+
+/**
+ * Get a json string of performance counters
+ *
+ * @param cmount the ceph mount handle to use.
+ * @param perf_dump buffer holding the perf dump
+ *
+ * Returns 0 success with the performance counters populated in the
+ * passed in perf_dump buffer. Caller is responsible for freeing the
+ * @perf_dump buffer using free().
+ */
+int ceph_get_perf_counters(struct ceph_mount_info *cmount, char **perf_dump);
+
#ifdef __cplusplus
}
#endif
}
free(snap_info->snap_metadata);
}
+
+extern "C" int ceph_get_perf_counters(struct ceph_mount_info *cmount, char **perf_dump) {
+ bufferlist outbl;
+ int r = cmount->get_client()->get_perf_counters(&outbl);
+ if (r != 0) {
+ return r;
+ }
+
+ do_out_buffer(outbl, perf_dump, NULL);
+ return outbl.length();
+}