Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1719399

[PATCH 05/10] perf report: Add dump_read function

From Jiri Olsa <jolsa@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 05/10] perf report: Add dump_read function
Date 2017-08-24 18:30 +0200
Message-ID <ui3b5-tc-43@gated-at.bofh.it> (permalink)
References <ui3b3-tc-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 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 bace3429c030..9e4004b08f55 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 dc453f84a14c..4a09604a66a0 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->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->time_enabled);
+
+	if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING)
+		printf("... time running : %" PRIu64 "\n", read->time_running);
+
+	if (read_format & PERF_FORMAT_ID)
+		printf("... id           : %" PRIu64 "\n", read->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);
-- 
2.9.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/10] perf: inherit_stat related fixes Jiri Olsa <jolsa@kernel.org> - 2017-08-24 18:30 +0200
  [PATCH 07/10] perf values: Fix allocation check Jiri Olsa <jolsa@kernel.org> - 2017-08-24 18:30 +0200
  [PATCH 08/10] perf values: Zero value buffers Jiri Olsa <jolsa@kernel.org> - 2017-08-24 18:30 +0200
  [PATCH 10/10] perf stat: Support inherit/no-inherit terms Jiri Olsa <jolsa@kernel.org> - 2017-08-24 18:30 +0200
    Re: [PATCH 10/10] perf stat: Support inherit/no-inherit terms Andi Kleen <andi@firstfloor.org> - 2017-08-24 18:40 +0200
      Re: [PATCH 10/10] perf stat: Support inherit/no-inherit terms Jiri Olsa <jolsa@redhat.com> - 2017-08-24 18:50 +0200
  [PATCH 02/10] perf: Fix leader for removed sibling event in perf_group_detach Jiri Olsa <jolsa@kernel.org> - 2017-08-24 18:30 +0200
  [PATCH 09/10] perf report: Group stat values on global event id Jiri Olsa <jolsa@kernel.org> - 2017-08-24 18:30 +0200
  [PATCH 05/10] perf report: Add dump_read function Jiri Olsa <jolsa@kernel.org> - 2017-08-24 18:30 +0200
  [PATCH 06/10] perf values: Fix thread index bug Jiri Olsa <jolsa@kernel.org> - 2017-08-24 18:30 +0200
  [PATCH 01/10] perf/x86: Add warning on proper cpu during event's update Jiri Olsa <jolsa@kernel.org> - 2017-08-24 18:40 +0200
  [PATCH 03/10] perf: Make sure we read only scheduled events Jiri Olsa <jolsa@kernel.org> - 2017-08-24 18:40 +0200

csiph-web