From f76d16efe7c4ab6a864205c83079fcb358f35f3f Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Tue, 1 Oct 2019 10:54:25 +0800 Subject: [PATCH] nvme/perf: enable the trace for nvme perf The puprose is to print some trace info. We support it in nvme identitfy. Also -L is occupied by other usage, so we use -T instead. Signed-off-by: Ziye Yang Change-Id: I29f018c2a5951e5e3aad04dbeaa7ee74a2d7e3f4 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469919 Reviewed-by: Shuhei Matsumoto Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris Tested-by: SPDK CI Jenkins --- examples/nvme/perf/perf.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/examples/nvme/perf/perf.c b/examples/nvme/perf/perf.c index 4fc785fcd..44aec4cc3 100644 --- a/examples/nvme/perf/perf.c +++ b/examples/nvme/perf/perf.c @@ -1126,6 +1126,8 @@ static void usage(char *program_name) printf("\t[-m max completions per poll]\n"); printf("\t\t(default: 0 - unlimited)\n"); printf("\t[-i shared memory group ID]\n"); + printf("\t"); + spdk_log_usage(stdout, "-T"); printf("\t[-V enable VMD enumeration]\n"); #ifdef DEBUG printf("\t[-G enable debug logging]\n"); @@ -1534,6 +1536,7 @@ parse_args(int argc, char **argv) int op; bool mix_specified = false; long int val; + int rc; /* default value */ g_queue_depth = 0; @@ -1544,7 +1547,7 @@ parse_args(int argc, char **argv) g_core_mask = NULL; g_max_completions = 0; - while ((op = getopt(argc, argv, "c:e:i:lm:n:o:q:r:k:s:t:w:DGHILM:NU:V")) != -1) { + while ((op = getopt(argc, argv, "c:e:i:lm:n:o:q:r:k:s:t:w:DGHILM:NT:U:V")) != -1) { switch (op) { case 'i': case 'm': @@ -1642,6 +1645,21 @@ parse_args(int argc, char **argv) case 'N': g_no_shn_notification = true; break; + case 'T': + rc = spdk_log_set_flag(optarg); + if (rc < 0) { + fprintf(stderr, "unknown flag\n"); + usage(argv[0]); + exit(EXIT_FAILURE); + } + spdk_log_set_print_level(SPDK_LOG_DEBUG); +#ifndef DEBUG + fprintf(stderr, "%s must be rebuilt with CONFIG_DEBUG=y for -T flag.\n", + argv[0]); + usage(argv[0]); + return 0; +#endif + break; case 'V': g_vmd = true; break;