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


Groups > linux.kernel > #1263291

[PATCH 15/25] perf stat report: Process stat and stat round events

From Jiri Olsa <jolsa@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 15/25] perf stat report: Process stat and stat round events
Date 2015-11-05 15:50 +0100
Message-ID <qru1v-7Yg-93@gated-at.bofh.it> (permalink)
References <qru1r-7Yg-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Adding processing of stat and stat round events.

The stat data com in stat events, using generic
function process_stat_round_event to store data
under perf_evsel object.

The stat-round events comes each interval or as
last event in non interval mode. The function
process_stat_round_event process stored data
for each perf_evsel object and print it out.

Tested-by: Kan Liang <kan.liang@intel.com>
Link: http://lkml.kernel.org/n/tip-qc3ihpf6j8hlfdts64uj4nmc@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/builtin-stat.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index cf9ea08c66df..511787d97d6c 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1599,6 +1599,32 @@ static int __cmd_record(int argc, const char **argv)
 	return argc;
 }
 
+static int process_stat_round_event(struct perf_tool *tool __maybe_unused,
+				    union perf_event *event,
+				    struct perf_session *session)
+{
+	struct stat_round_event *round = &event->stat_round;
+	struct perf_evsel *counter;
+	struct timespec tsh, *ts = NULL;
+	const char **argv = session->header.env.cmdline_argv;
+	int argc = session->header.env.nr_cmdline;
+
+	evlist__for_each(evsel_list, counter)
+		perf_stat_process_counter(&stat_config, counter);
+
+	if (round->type == PERF_STAT_ROUND_TYPE__FINAL)
+		update_stats(&walltime_nsecs_stats, round->time);
+
+	if (stat_config.interval && round->time) {
+		tsh.tv_sec  = round->time / NSECS_PER_SEC;
+		tsh.tv_nsec = round->time % NSECS_PER_SEC;
+		ts = &tsh;
+	}
+
+	print_counters(ts, argc, argv);
+	return 0;
+}
+
 static
 int process_stat_config_event(struct perf_tool *tool __maybe_unused,
 			      union perf_event *event,
@@ -1684,6 +1710,8 @@ static struct perf_stat perf_stat = {
 		.thread_map	= process_thread_map_event,
 		.cpu_map	= process_cpu_map_event,
 		.stat_config	= process_stat_config_event,
+		.stat		= perf_event__process_stat_event,
+		.stat_round	= process_stat_round_event,
 	},
 };
 
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

[PATCHv6 00/25] perf stat: Add scripting support Jiri Olsa <jolsa@kernel.org> - 2015-11-05 15:50 +0100
  [PATCH 15/25] perf stat report: Process stat and stat round events Jiri Olsa <jolsa@kernel.org> - 2015-11-05 15:50 +0100
  [PATCH 14/25] perf stat report: Add support to initialize aggr_map from file Jiri Olsa <jolsa@kernel.org> - 2015-11-05 15:50 +0100
  [PATCH 24/25] perf script: Add python support for stat events Jiri Olsa <jolsa@kernel.org> - 2015-11-05 15:50 +0100
  [PATCH 11/25] perf stat report: Add report command Jiri Olsa <jolsa@kernel.org> - 2015-11-05 16:00 +0100
  [PATCH 16/25] perf stat report: Process event update events Jiri Olsa <jolsa@kernel.org> - 2015-11-05 16:00 +0100
  [PATCH 08/25] perf stat record: Write stat round events on record Jiri Olsa <jolsa@kernel.org> - 2015-11-05 16:00 +0100
  [PATCH 12/25] perf stat report: Process cpu/threads maps Jiri Olsa <jolsa@kernel.org> - 2015-11-05 16:00 +0100
  [PATCH 20/25] perf script: Process stat config event Jiri Olsa <jolsa@kernel.org> - 2015-11-05 16:00 +0100
  [PATCH 01/25] perf stat: Make stat options global Jiri Olsa <jolsa@kernel.org> - 2015-11-05 16:00 +0100
    [tip:perf/urgent] perf stat: Make stat options global tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-11-08 08:40 +0100
  [PATCH 03/25] perf stat record: Initialize record features Jiri Olsa <jolsa@kernel.org> - 2015-11-05 16:00 +0100
  [PATCH 18/25] perf stat report: Allow to override aggr_mode Jiri Olsa <jolsa@kernel.org> - 2015-11-05 16:00 +0100

csiph-web