linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: namhyung@kernel.org, a.p.zijlstra@chello.nl,
	alexander.shishkin@linux.intel.com, andi@firstfloor.org,
	mingo@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com,
	acme@redhat.com, mark.rutland@arm.com, dsahern@gmail.com,
	jolsa@kernel.org, tglx@linutronix.de
Subject: [tip:perf/core] perf report: Add dump_read function
Date: Tue, 29 Aug 2017 14:20:43 -0700	[thread overview]
Message-ID: <tip-dac7f6b7ed1c8601358357f60e9764a4c6a68d71@git.kernel.org> (raw)
In-Reply-To: <20170824162737.7813-6-jolsa@kernel.org>

Commit-ID:  dac7f6b7ed1c8601358357f60e9764a4c6a68d71
Gitweb:     http://git.kernel.org/tip/dac7f6b7ed1c8601358357f60e9764a4c6a68d71
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Thu, 24 Aug 2017 18:27:32 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 28 Aug 2017 16:43:50 -0300

perf report: Add dump_read function

Adding dump_read function to gather all the dump output of read
function. Adding output of enabled and running times and id if enabled
(3 new lines with '...' prefix below).

  $ perf record -s ...
  $ perf report -D

  958358311769 0x91f8 [0x40]: PERF_RECORD_READ: 3339 3339 cycles:u 0
  ... time enabled : 958358313731
  ... time running : 958358313731
  ... id           : 80

Committer note:

Do not use 'read' as a variable name as it breaks the build on older
systems, such as RHEL6:

    CC       /tmp/build/perf/util/session.o
  cc1: warnings being treated as errors
  util/session.c: In function 'dump_read':
  util/session.c:1132: error: declaration of 'read' shadows a global declaration
  /usr/include/bits/unistd.h:35: error: shadowed declaration is here
  mv: cannot stat `/tmp/build/perf/util/.session.o.tmp': No such file or directory

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20170824162737.7813-6-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c |  4 ----
 tools/perf/util/session.c   | 25 +++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index bace342..9e4004b0 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -249,10 +249,6 @@ static int process_read_event(struct perf_tool *tool,
 			return err;
 	}
 
-	dump_printf(": %d %d %s %" PRIu64 "\n", event->read.pid, event->read.tid,
-		    evsel ? perf_evsel__name(evsel) : "FAIL",
-		    event->read.value);
-
 	return 0;
 }
 
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index dc453f8..ac86369 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1127,6 +1127,30 @@ static void dump_sample(struct perf_evsel *evsel, union perf_event *event,
 		sample_read__printf(sample, evsel->attr.read_format);
 }
 
+static void dump_read(struct perf_evsel *evsel, union perf_event *event)
+{
+	struct read_event *read_event = &event->read;
+	u64 read_format;
+
+	if (!dump_trace)
+		return;
+
+	printf(": %d %d %s %" PRIu64 "\n", event->read.pid, event->read.tid,
+	       evsel ? perf_evsel__name(evsel) : "FAIL",
+	       event->read.value);
+
+	read_format = evsel->attr.read_format;
+
+	if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)
+		printf("... time enabled : %" PRIu64 "\n", read_event->time_enabled);
+
+	if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING)
+		printf("... time running : %" PRIu64 "\n", read_event->time_running);
+
+	if (read_format & PERF_FORMAT_ID)
+		printf("... id           : %" PRIu64 "\n", read_event->id);
+}
+
 static struct machine *machines__find_for_cpumode(struct machines *machines,
 					       union perf_event *event,
 					       struct perf_sample *sample)
@@ -1271,6 +1295,7 @@ static int machines__deliver_event(struct machines *machines,
 			evlist->stats.total_lost_samples += event->lost_samples.lost;
 		return tool->lost_samples(tool, event, sample, machine);
 	case PERF_RECORD_READ:
+		dump_read(evsel, event);
 		return tool->read(tool, event, sample, evsel, machine);
 	case PERF_RECORD_THROTTLE:
 		return tool->throttle(tool, event, sample, machine);

  reply	other threads:[~2017-08-29 21:23 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24 16:27 [PATCH 00/10] perf: inherit_stat related fixes Jiri Olsa
2017-08-24 16:27 ` [PATCH 01/10] perf/x86: Add warning on proper cpu during event's update Jiri Olsa
2017-08-28 19:24   ` Peter Zijlstra
2017-08-24 16:27 ` [PATCH 02/10] perf: Fix leader for removed sibling event in perf_group_detach Jiri Olsa
2017-08-28 19:23   ` Peter Zijlstra
2017-08-24 16:27 ` [PATCH 03/10] perf: Make sure we read only scheduled events Jiri Olsa
2017-08-28 19:23   ` Peter Zijlstra
2017-09-01  7:21     ` Jiri Olsa
2017-08-24 16:27 ` [PATCH 04/10] perf record: Set read_format for inherit_stat Jiri Olsa
2017-08-29 21:20   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-08-24 16:27 ` [PATCH 05/10] perf report: Add dump_read function Jiri Olsa
2017-08-29 21:20   ` tip-bot for Jiri Olsa [this message]
2017-08-24 16:27 ` [PATCH 06/10] perf values: Fix thread index bug Jiri Olsa
2017-08-29 21:21   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-08-24 16:27 ` [PATCH 07/10] perf values: Fix allocation check Jiri Olsa
2017-08-29 21:21   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-08-24 16:27 ` [PATCH 08/10] perf values: Zero value buffers Jiri Olsa
2017-08-29 21:21   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-08-24 16:27 ` [PATCH 09/10] perf report: Group stat values on global event id Jiri Olsa
2017-08-29 21:22   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-08-24 16:27 ` [PATCH 10/10] perf stat: Support inherit/no-inherit terms Jiri Olsa
2017-08-24 16:30   ` Andi Kleen
2017-08-24 16:45     ` Jiri Olsa
2017-08-25 18:57       ` Arnaldo Carvalho de Melo

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=tip-dac7f6b7ed1c8601358357f60e9764a4c6a68d71@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    /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).