Commit 83e19860 authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

perf script: Allow time to be displayed in nanoseconds

Add option --ns to display time to 9 decimal places.  That is useful in
some cases, for example when using Intel PT cycle accurate mode.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1443186956-18718-6-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 116f349c
...@@ -249,6 +249,9 @@ include::itrace.txt[] ...@@ -249,6 +249,9 @@ include::itrace.txt[]
--full-source-path:: --full-source-path::
Show the full path for source files for srcline output. Show the full path for source files for srcline output.
--ns::
Use 9 decimal places when displaying time (i.e. show the nanoseconds)
SEE ALSO SEE ALSO
-------- --------
linkperf:perf-record[1], linkperf:perf-script-perl[1], linkperf:perf-record[1], linkperf:perf-script-perl[1],
......
...@@ -29,6 +29,7 @@ static bool no_callchain; ...@@ -29,6 +29,7 @@ static bool no_callchain;
static bool latency_format; static bool latency_format;
static bool system_wide; static bool system_wide;
static bool print_flags; static bool print_flags;
static bool nanosecs;
static const char *cpu_list; static const char *cpu_list;
static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
...@@ -415,6 +416,9 @@ static void print_sample_start(struct perf_sample *sample, ...@@ -415,6 +416,9 @@ static void print_sample_start(struct perf_sample *sample,
secs = nsecs / NSECS_PER_SEC; secs = nsecs / NSECS_PER_SEC;
nsecs -= secs * NSECS_PER_SEC; nsecs -= secs * NSECS_PER_SEC;
usecs = nsecs / NSECS_PER_USEC; usecs = nsecs / NSECS_PER_USEC;
if (nanosecs)
printf("%5lu.%09llu: ", secs, nsecs);
else
printf("%5lu.%06lu: ", secs, usecs); printf("%5lu.%06lu: ", secs, usecs);
} }
} }
...@@ -1695,6 +1699,8 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -1695,6 +1699,8 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_BOOLEAN('\0', "show-switch-events", &script.show_switch_events, OPT_BOOLEAN('\0', "show-switch-events", &script.show_switch_events,
"Show context switch events (if recorded)"), "Show context switch events (if recorded)"),
OPT_BOOLEAN('f', "force", &file.force, "don't complain, do it"), OPT_BOOLEAN('f', "force", &file.force, "don't complain, do it"),
OPT_BOOLEAN(0, "ns", &nanosecs,
"Use 9 decimal places when displaying time"),
OPT_CALLBACK_OPTARG(0, "itrace", &itrace_synth_opts, NULL, "opts", OPT_CALLBACK_OPTARG(0, "itrace", &itrace_synth_opts, NULL, "opts",
"Instruction Tracing options", "Instruction Tracing options",
itrace_parse_synth_opts), itrace_parse_synth_opts),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment