From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Adrian Hunter <adrian.hunter@intel.com>,
David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@kernel.org>,
Milian Wolff <milian.wolff@kdab.com>,
Namhyung Kim <namhyung@kernel.org>,
Wang Nan <wangnan0@huawei.com>
Subject: [PATCH 08/10] perf trace: Introduce function to set the base timestamp
Date: Fri, 1 Apr 2016 18:57:04 -0300 [thread overview]
Message-ID: <1459547826-20100-9-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1459547826-20100-1-git-send-email-acme@kernel.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
That is used in both live runs, i.e.:
# trace ls
As when processing events recorded in a perf.data file:
# trace -i perf.data
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-901l6yebnzeqg7z8mbaf49xb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index c45c1cfeb866..99daeed55a9b 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2400,6 +2400,14 @@ static bool skip_sample(struct trace *trace, struct perf_sample *sample)
return false;
}
+static void trace__set_base_time(struct trace *trace,
+ struct perf_evsel *evsel __maybe_unused,
+ struct perf_sample *sample)
+{
+ if (trace->base_time == 0 && !trace->full_time)
+ trace->base_time = sample->time;
+}
+
static int trace__process_sample(struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
@@ -2414,8 +2422,7 @@ static int trace__process_sample(struct perf_tool *tool,
if (skip_sample(trace, sample))
return 0;
- if (!trace->full_time && trace->base_time == 0)
- trace->base_time = sample->time;
+ trace__set_base_time(trace, evsel, sample);
if (handler) {
++trace->nr_events;
@@ -2553,9 +2560,6 @@ static void trace__handle_event(struct trace *trace, union perf_event *event, st
const u32 type = event->header.type;
struct perf_evsel *evsel;
- if (!trace->full_time && trace->base_time == 0)
- trace->base_time = sample->time;
-
if (type != PERF_RECORD_SAMPLE) {
trace__process_event(trace, trace->host, event, sample);
return;
@@ -2567,6 +2571,8 @@ static void trace__handle_event(struct trace *trace, union perf_event *event, st
return;
}
+ trace__set_base_time(trace, evsel, sample);
+
if (evsel->attr.type == PERF_TYPE_TRACEPOINT &&
sample->raw_data == NULL) {
fprintf(trace->output, "%s sample with no payload for tid: %d, cpu %d, raw_size=%d, skipping...\n",
--
2.5.5
next prev parent reply other threads:[~2016-04-01 21:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-01 21:56 [GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-04-01 21:56 ` [PATCH 01/10] perf trace: Do not process PERF_RECORD_LOST twice Arnaldo Carvalho de Melo
2016-04-01 21:56 ` [PATCH 02/10] perf trace: Pretty print seccomp() args Arnaldo Carvalho de Melo
2016-04-01 21:56 ` [PATCH 03/10] perf trace: Pretty print getrandom() args Arnaldo Carvalho de Melo
2016-04-01 21:57 ` [PATCH 04/10] perf tools: Add time conversion event Arnaldo Carvalho de Melo
2016-04-01 21:57 ` [PATCH 05/10] perf jit: Add support for using TSC as a timestamp Arnaldo Carvalho de Melo
2016-04-01 21:57 ` [PATCH 06/10] perf intel-pt/bts: Define JITDUMP_USE_ARCH_TIMESTAMP Arnaldo Carvalho de Melo
2016-04-01 21:57 ` [PATCH 07/10] perf tools: Fix PMU term format max value calculation Arnaldo Carvalho de Melo
2016-04-01 21:57 ` Arnaldo Carvalho de Melo [this message]
2016-04-01 21:57 ` [PATCH 09/10] perf trace: Don't set the base timestamp using events without PERF_SAMPLE_TIME Arnaldo Carvalho de Melo
2016-04-01 21:57 ` [PATCH 10/10] perf bpf: Add sample types for 'bpf-output' event Arnaldo Carvalho de Melo
2016-04-06 6:47 ` [GIT PULL 00/10] perf/core improvements and fixes Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1459547826-20100-9-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=dsahern@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=milian.wolff@kdab.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=wangnan0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).