app/trace: suppress TSC output by default

Number of microseconds is sufficient in almost all cases,
so don't print out the TSC offset unless user specifies
-t option.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I3bbf55204bf58d94f43161ff41c565ca92e218f7

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452737
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Jim Harris 2019-04-30 13:45:10 -07:00 committed by Darek Stojaczyk
parent b6206d657c
commit c199f56d99

View File

@ -41,6 +41,7 @@ extern "C" {
}
static struct spdk_trace_histories *g_histories;
static bool g_print_tsc = false;
static void usage(void);
@ -179,7 +180,10 @@ print_event(struct spdk_trace_entry *e, uint64_t tsc_rate,
us = get_us_from_tsc(e->tsc - tsc_offset, tsc_rate);
printf("%2d: %10.3f (%9ju) ", lcore, us, e->tsc - tsc_offset);
printf("%2d: %10.3f ", lcore, us);
if (g_print_tsc) {
printf("(%9ju) ", e->tsc - tsc_offset);
}
if (g_histories->flags.owner[d->owner_type].id_prefix) {
printf("%c%02d ", g_histories->flags.owner[d->owner_type].id_prefix, e->poller_id);
} else {
@ -278,6 +282,7 @@ static void usage(void)
fprintf(stderr, " %s <option> <lcore#>\n", g_exe_name);
fprintf(stderr, " option = '-q' to disable verbose mode\n");
fprintf(stderr, " '-c' to display single lcore history\n");
fprintf(stderr, " '-t' to display TSC offset for each event\n");
fprintf(stderr, " '-s' to specify spdk_trace shm name for a\n");
fprintf(stderr, " currently running process\n");
fprintf(stderr, " '-i' to specify the shared memory ID\n");
@ -304,7 +309,7 @@ int main(int argc, char **argv)
struct stat _stat;
g_exe_name = argv[0];
while ((op = getopt(argc, argv, "c:f:i:p:qs:")) != -1) {
while ((op = getopt(argc, argv, "c:f:i:p:qs:t")) != -1) {
switch (op) {
case 'c':
lcore = atoi(optarg);
@ -330,6 +335,9 @@ int main(int argc, char **argv)
case 'f':
file_name = optarg;
break;
case 't':
g_print_tsc = true;
break;
default:
usage();
exit(1);