Skip to content

Commit

Permalink
perf: Add NSID in perf output information
Browse files Browse the repository at this point in the history
Currently an option is implemented to monitor a correlation between the
core and namespace.

Previously:
==================================================================
Device Information
RDMA (addr:1.1.75.2 subnqn:nqn.2016-06.io.spdk:cnode1 from core  0:
RDMA (addr:1.1.75.2 subnqn:nqn.2016-06.io.spdk:cnode1 from core  0:
==================================================================

Now:
========================================================================
Device Information
RDMA (addr:1.1.75.2 subnqn:nqn.2016-06.io.spdk:cnode1 NSID 1 from core 0:
RDMA (addr:1.1.75.2 subnqn:nqn.2016-06.io.spdk:cnode1 NSID 2 from core 0:
========================================================================

Signed-off-by: Alla Kiseleva <[email protected]>
  • Loading branch information
Alla-Ki committed Feb 12, 2020
1 parent f17e02a commit 27a6677
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
28 changes: 22 additions & 6 deletions examples/nvme/perf/perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,27 +632,42 @@ static const struct ns_fn_table nvme_fn_table = {
.cleanup_ns_worker_ctx = nvme_cleanup_ns_worker_ctx,
};

static void
static int
build_nvme_name(char *name, size_t length, struct spdk_nvme_ctrlr *ctrlr)
{
const struct spdk_nvme_transport_id *trid;
int res = 0;

trid = spdk_nvme_ctrlr_get_transport_id(ctrlr);

switch (trid->trtype) {
case SPDK_NVME_TRANSPORT_PCIE:
snprintf(name, length, "PCIE (%s)", trid->traddr);
res = snprintf(name, length, "PCIE (%s)", trid->traddr);
break;
case SPDK_NVME_TRANSPORT_RDMA:
snprintf(name, length, "RDMA (addr:%s subnqn:%s)", trid->traddr, trid->subnqn);
res = snprintf(name, length, "RDMA (addr:%s subnqn:%s)", trid->traddr, trid->subnqn);
break;
case SPDK_NVME_TRANSPORT_TCP:
snprintf(name, length, "TCP (addr:%s subnqn:%s)", trid->traddr, trid->subnqn);
res = snprintf(name, length, "TCP (addr:%s subnqn:%s)", trid->traddr, trid->subnqn);
break;

default:
fprintf(stderr, "Unknown transport type %d\n", trid->trtype);
break;
}
return res;
}

static void
build_nvme_ns_name(char *name, size_t length, struct spdk_nvme_ctrlr *ctrlr, uint32_t nsid)
{
int res = 0;

res = build_nvme_name(name, length, ctrlr);
if (res > 0) {
snprintf(name + res - 1, length - res + 1, " NSID %d", nsid);
}

}

static void
Expand Down Expand Up @@ -747,6 +762,7 @@ register_ns(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
}

build_nvme_name(entry->name, sizeof(entry->name), ctrlr);
build_nvme_ns_name(entry->name, sizeof(entry->name), ctrlr, spdk_nvme_ns_get_id(ns));

g_num_namespaces++;
entry->next = g_namespaces;
Expand Down Expand Up @@ -1243,7 +1259,7 @@ print_performance(void)
worker = worker->next;
}

printf("========================================================\n");
printf("==========================================================================\n");
printf("%*s\n", max_strlen + 60, "Latency(us)");
printf("%-*s: %10s %10s %10s %10s %10s\n",
max_strlen + 13, "Device Information", "IOPS", "MiB/s", "Average", "min", "max");
Expand Down Expand Up @@ -1283,7 +1299,7 @@ print_performance(void)

if (ns_count != 0 && total_io_completed) {
sum_ave_latency = ((double)total_io_tsc / total_io_completed) * 1000 * 1000 / g_tsc_rate;
printf("========================================================\n");
printf("==========================================================================\n");
printf("%-*s: %10.2f %10.2f %10.2f %10.2f %10.2f\n",
max_strlen + 13, "Total", total_io_per_second, total_mb_per_second,
sum_ave_latency, min_latency_so_far, max_latency_so_far);
Expand Down
1 change: 0 additions & 1 deletion isa-l
Submodule isa-l deleted from f3993f

0 comments on commit 27a6677

Please sign in to comment.