Commit 4bb09192 authored by David Ahern's avatar David Ahern Committed by Arnaldo Carvalho de Melo

perf trace: Add option to show full timestamp

Current timestamp shown for output is time relative to firt sample. This
patch adds an option to show the absolute perf_clock timestamp which is
useful when comparing output across commands (e.g., perf-trace to
perf-script).
Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1378319865-55695-1-git-send-email-dsahern@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c045bf02
...@@ -78,6 +78,10 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs. ...@@ -78,6 +78,10 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs.
--input --input
Process events from a given perf data file. Process events from a given perf data file.
-T
--time
Print full timestamp rather time relative to first sample.
SEE ALSO SEE ALSO
-------- --------
linkperf:perf-record[1], linkperf:perf-script[1] linkperf:perf-record[1], linkperf:perf-script[1]
...@@ -624,6 +624,7 @@ struct trace { ...@@ -624,6 +624,7 @@ struct trace {
struct perf_record_opts opts; struct perf_record_opts opts;
struct machine host; struct machine host;
u64 base_time; u64 base_time;
bool full_time;
FILE *output; FILE *output;
unsigned long nr_events; unsigned long nr_events;
struct strlist *ev_qualifier; struct strlist *ev_qualifier;
...@@ -1066,7 +1067,7 @@ static int trace__process_sample(struct perf_tool *tool, ...@@ -1066,7 +1067,7 @@ static int trace__process_sample(struct perf_tool *tool,
if (skip_sample(trace, sample)) if (skip_sample(trace, sample))
return 0; return 0;
if (trace->base_time == 0) if (!trace->full_time && trace->base_time == 0)
trace->base_time = sample->time; trace->base_time = sample->time;
if (handler) if (handler)
...@@ -1195,7 +1196,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv) ...@@ -1195,7 +1196,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
continue; continue;
} }
if (trace->base_time == 0) if (!trace->full_time && trace->base_time == 0)
trace->base_time = sample.time; trace->base_time = sample.time;
if (type != PERF_RECORD_SAMPLE) { if (type != PERF_RECORD_SAMPLE) {
...@@ -1433,6 +1434,8 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -1433,6 +1434,8 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
trace__set_duration), trace__set_duration),
OPT_BOOLEAN(0, "sched", &trace.sched, "show blocking scheduler events"), OPT_BOOLEAN(0, "sched", &trace.sched, "show blocking scheduler events"),
OPT_INCR('v', "verbose", &verbose, "be more verbose"), OPT_INCR('v', "verbose", &verbose, "be more verbose"),
OPT_BOOLEAN('T', "time", &trace.full_time,
"Show full timestamp, not time relative to first start"),
OPT_END() OPT_END()
}; };
int err; int err;
......
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