bdev: Move helper function to dump I/O statistics into bdev.c
Move a JSON dump functionbdev_get_iostat_dump() for I/O statistics into lib/bdev/bdev.c. The next patch will rename the function and change the parameter order. This is another preparation to extend I/O statistics to include error counters and module specific counters to output these via the bdev_get_iostat RPC. Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Change-Id: I6a90d15fcbaa2e2a250167754135623bc9e7f362 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14837 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
parent
24eab32532
commit
5d269efe96
@ -3705,6 +3705,23 @@ bdev_io_stat_free(struct spdk_bdev_io_stat *stat)
|
||||
free(stat);
|
||||
}
|
||||
|
||||
void
|
||||
bdev_get_iostat_dump(struct spdk_json_write_ctx *w, struct spdk_bdev_io_stat *stat)
|
||||
{
|
||||
spdk_json_write_named_uint64(w, "bytes_read", stat->bytes_read);
|
||||
spdk_json_write_named_uint64(w, "num_read_ops", stat->num_read_ops);
|
||||
spdk_json_write_named_uint64(w, "bytes_written", stat->bytes_written);
|
||||
spdk_json_write_named_uint64(w, "num_write_ops", stat->num_write_ops);
|
||||
spdk_json_write_named_uint64(w, "bytes_unmapped", stat->bytes_unmapped);
|
||||
spdk_json_write_named_uint64(w, "num_unmap_ops", stat->num_unmap_ops);
|
||||
spdk_json_write_named_uint64(w, "bytes_copied", stat->bytes_copied);
|
||||
spdk_json_write_named_uint64(w, "num_copy_ops", stat->num_copy_ops);
|
||||
spdk_json_write_named_uint64(w, "read_latency_ticks", stat->read_latency_ticks);
|
||||
spdk_json_write_named_uint64(w, "write_latency_ticks", stat->write_latency_ticks);
|
||||
spdk_json_write_named_uint64(w, "unmap_latency_ticks", stat->unmap_latency_ticks);
|
||||
spdk_json_write_named_uint64(w, "copy_latency_ticks", stat->copy_latency_ticks);
|
||||
}
|
||||
|
||||
static void
|
||||
bdev_channel_abort_queued_ios(struct spdk_bdev_channel *ch)
|
||||
{
|
||||
|
@ -23,5 +23,6 @@ void bdev_io_submit(struct spdk_bdev_io *bdev_io);
|
||||
|
||||
struct spdk_bdev_io_stat *bdev_io_stat_alloc(void);
|
||||
void bdev_io_stat_free(struct spdk_bdev_io_stat *stat);
|
||||
void bdev_get_iostat_dump(struct spdk_json_write_ctx *w, struct spdk_bdev_io_stat *stat);
|
||||
|
||||
#endif /* SPDK_BDEV_INTERNAL_H */
|
||||
|
@ -242,23 +242,6 @@ bdev_iostat_ctx_free(struct bdev_get_iostat_ctx *ctx)
|
||||
free(ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
bdev_get_iostat_dump(struct spdk_json_write_ctx *w, struct spdk_bdev_io_stat *stat)
|
||||
{
|
||||
spdk_json_write_named_uint64(w, "bytes_read", stat->bytes_read);
|
||||
spdk_json_write_named_uint64(w, "num_read_ops", stat->num_read_ops);
|
||||
spdk_json_write_named_uint64(w, "bytes_written", stat->bytes_written);
|
||||
spdk_json_write_named_uint64(w, "num_write_ops", stat->num_write_ops);
|
||||
spdk_json_write_named_uint64(w, "bytes_unmapped", stat->bytes_unmapped);
|
||||
spdk_json_write_named_uint64(w, "num_unmap_ops", stat->num_unmap_ops);
|
||||
spdk_json_write_named_uint64(w, "bytes_copied", stat->bytes_copied);
|
||||
spdk_json_write_named_uint64(w, "num_copy_ops", stat->num_copy_ops);
|
||||
spdk_json_write_named_uint64(w, "read_latency_ticks", stat->read_latency_ticks);
|
||||
spdk_json_write_named_uint64(w, "write_latency_ticks", stat->write_latency_ticks);
|
||||
spdk_json_write_named_uint64(w, "unmap_latency_ticks", stat->unmap_latency_ticks);
|
||||
spdk_json_write_named_uint64(w, "copy_latency_ticks", stat->copy_latency_ticks);
|
||||
}
|
||||
|
||||
static void
|
||||
bdev_get_iostat_done(struct spdk_bdev *bdev, struct spdk_bdev_io_stat *stat,
|
||||
void *cb_arg, int rc)
|
||||
|
Loading…
Reference in New Issue
Block a user