From 3caf2e710f9be44e77e61d8c1ced53d5bbb2baed Mon Sep 17 00:00:00 2001 From: Alexey Marchuk Date: Thu, 3 Dec 2020 18:40:04 +0300 Subject: [PATCH] nvmf/rdma: Add new statistic to count idle polls This statistic is incremented when we don't reap anything from the CQ. Together with the total number of polls it can be useful to estimate idle percentage. Change-Id: I61b51d049b0bc506fb8a896e225187e46e75a564 Signed-off-by: Alexey Marchuk Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6295 Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- include/spdk/nvmf.h | 1 + lib/nvmf/nvmf_rpc.c | 1 + lib/nvmf/rdma.c | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/include/spdk/nvmf.h b/include/spdk/nvmf.h index c7bab8119..367b8c8cb 100644 --- a/include/spdk/nvmf.h +++ b/include/spdk/nvmf.h @@ -127,6 +127,7 @@ struct spdk_nvmf_poll_group_stat { struct spdk_nvmf_rdma_device_stat { const char *name; uint64_t polls; + uint64_t idle_polls; uint64_t completions; uint64_t requests; uint64_t request_latency; diff --git a/lib/nvmf/nvmf_rpc.c b/lib/nvmf/nvmf_rpc.c index c6b85be76..6afd9abd0 100644 --- a/lib/nvmf/nvmf_rpc.c +++ b/lib/nvmf/nvmf_rpc.c @@ -2052,6 +2052,7 @@ write_nvmf_transport_stats(struct spdk_json_write_ctx *w, spdk_json_write_object_begin(w); spdk_json_write_named_string(w, "name", stat->rdma.devices[i].name); spdk_json_write_named_uint64(w, "polls", stat->rdma.devices[i].polls); + spdk_json_write_named_uint64(w, "idle_polls", stat->rdma.devices[i].idle_polls); spdk_json_write_named_uint64(w, "completions", stat->rdma.devices[i].completions); spdk_json_write_named_uint64(w, "requests", stat->rdma.devices[i].requests); diff --git a/lib/nvmf/rdma.c b/lib/nvmf/rdma.c index c93e339fd..d7a0d8510 100644 --- a/lib/nvmf/rdma.c +++ b/lib/nvmf/rdma.c @@ -395,6 +395,7 @@ struct spdk_nvmf_rdma_qpair { struct spdk_nvmf_rdma_poller_stat { uint64_t completions; uint64_t polls; + uint64_t idle_polls; uint64_t requests; uint64_t request_latency; uint64_t pending_free_request; @@ -3789,6 +3790,8 @@ nvmf_rdma_poller_poll(struct spdk_nvmf_rdma_transport *rtransport, SPDK_ERRLOG("Error polling CQ! (%d): %s\n", errno, spdk_strerror(errno)); return -1; + } else if (reaped == 0) { + rpoller->stat.idle_polls++; } rpoller->stat.polls++; @@ -4194,6 +4197,7 @@ nvmf_rdma_poll_group_get_stat(struct spdk_nvmf_tgt *tgt, device_stat = &(*stat)->rdma.devices[num_devices++]; device_stat->name = ibv_get_device_name(rpoller->device->context->device); device_stat->polls = rpoller->stat.polls; + device_stat->idle_polls = rpoller->stat.idle_polls; device_stat->completions = rpoller->stat.completions; device_stat->requests = rpoller->stat.requests; device_stat->request_latency = rpoller->stat.request_latency;