From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Stanislav Fomichev <stfomichev@yandex-team.ru>,
Ingo Molnar <mingo@redhat.com>, Jiri Olsa <jolsa@redhat.com>,
Namhyung Kim <namhyung@kernel.org>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Ramkumar Ramachandra <artagnon@gmail.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 04/10] perf timechart: Get number of CPUs from perf header
Date: Tue, 17 Dec 2013 17:52:05 -0300 [thread overview]
Message-ID: <1387313531-14629-5-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1387313531-14629-1-git-send-email-acme@infradead.org>
From: Stanislav Fomichev <stfomichev@yandex-team.ru>
Print all CPUs, even if there were no events (use perf header to get
number of CPUs).
This is required to support topology in the next patch.
Signed-off-by: Stanislav Fomichev <stfomichev@yandex-team.ru>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ramkumar Ramachandra <artagnon@gmail.com>
Link: http://lkml.kernel.org/r/1385995056-20158-4-git-send-email-stfomichev@yandex-team.ru
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-timechart.c | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 99fe363f1de8..db9c4c172587 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -531,12 +531,10 @@ static int process_sample_event(struct perf_tool *tool,
tchart->last_time = sample->time;
}
- if (sample->cpu > tchart->numcpus)
- tchart->numcpus = sample->cpu;
-
if (evsel->handler != NULL) {
tracepoint_handler f = evsel->handler;
- return f(tchart, evsel, sample, cat_backtrace(event, sample, machine));
+ return f(tchart, evsel, sample,
+ cat_backtrace(event, sample, machine));
}
return 0;
@@ -1038,8 +1036,6 @@ static void write_svg_file(struct timechart *tchart, const char *filename)
int count;
int thresh = TIME_THRESH;
- tchart->numcpus++;
-
if (tchart->power_only)
tchart->proc_num = 0;
@@ -1069,6 +1065,25 @@ static void write_svg_file(struct timechart *tchart, const char *filename)
svg_close();
}
+static int process_header(struct perf_file_section *section __maybe_unused,
+ struct perf_header *ph,
+ int feat,
+ int fd __maybe_unused,
+ void *data)
+{
+ struct timechart *tchart = data;
+
+ switch (feat) {
+ case HEADER_NRCPUS:
+ tchart->numcpus = ph->env.nr_cpus_avail;
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
static int __cmd_timechart(struct timechart *tchart, const char *output_name)
{
const struct perf_evsel_str_handler power_tracepoints[] = {
@@ -1094,6 +1109,11 @@ static int __cmd_timechart(struct timechart *tchart, const char *output_name)
if (session == NULL)
return -ENOMEM;
+ (void)perf_header__process_sections(&session->header,
+ perf_data_file__fd(session->file),
+ tchart,
+ process_header);
+
if (!perf_session__has_traces(session, "timechart record"))
goto out_delete;
--
1.8.1.4
next prev parent reply other threads:[~2013-12-17 20:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-17 20:52 [GIT PULL 00/10] perf/core improvements and refactorings Arnaldo Carvalho de Melo
2013-12-17 20:52 ` [PATCH 01/10] tools/: Convert to new topic libraries Arnaldo Carvalho de Melo
2013-12-17 20:52 ` [PATCH 02/10] perf timechart: Add backtrace support to CPU info Arnaldo Carvalho de Melo
2013-12-17 20:52 ` [PATCH 03/10] perf timechart: Print pid along the name Arnaldo Carvalho de Melo
2013-12-17 20:52 ` Arnaldo Carvalho de Melo [this message]
2013-12-17 20:52 ` [PATCH 05/10] perf timechart: Add support for topology Arnaldo Carvalho de Melo
2013-12-17 20:52 ` [PATCH 06/10] perf symbols: Remove needless static binary_type array Arnaldo Carvalho de Melo
2013-12-17 20:52 ` [PATCH 07/10] perf symbols: Clarify method to get DSO binary_type filename Arnaldo Carvalho de Melo
2013-12-17 20:52 ` [PATCH 08/10] perf timechart: Add --highlight option Arnaldo Carvalho de Melo
2013-12-17 20:52 ` [PATCH 09/10] perf symbols: Use consistent name for the DSO binary type member Arnaldo Carvalho de Melo
2013-12-17 20:52 ` [PATCH 10/10] tools lib traceevent: Get rid of die() in some string conversion functions Arnaldo Carvalho de Melo
2013-12-18 10:13 ` [GIT PULL 00/10] perf/core improvements and refactorings Ingo Molnar
2013-12-18 12:11 ` Jiri Olsa
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=1387313531-14629-5-git-send-email-acme@infradead.org \
--to=acme@infradead.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=artagnon@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=stfomichev@yandex-team.ru \
/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
all inboxes | Powered by JetHome®