aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2015-11-05 09:40:52 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-12-17 14:00:31 -0500
commit7aad0c32bb6aaa39aab596264ddc49d44c8088f3 (patch)
tree8b918a0994332a90f93e2010e7d61eb33326c539 /tools
parent5a6ea81b8f9ce2736759d256ac4d63be65751199 (diff)
perf stat record: Write stat round events on record
Writing stat round events on 'perf stat record' for each interval round. In non interval mode we store round event after the last stat event. Committer note: After the patch: $ perf report -D | grep PERF_RECORD | grep ROUND 0x852 [0x18]: PERF_RECORD_STAT_ROUND $ Reported-by: Kan Liang <kan.liang@intel.com> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1446734469-11352-9-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-stat.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 32aa2ea1c553..fcece42c2611 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -231,6 +231,16 @@ static int process_synthesized_event(struct perf_tool *tool __maybe_unused,
231 return 0; 231 return 0;
232} 232}
233 233
234static int write_stat_round_event(u64 time, u64 type)
235{
236 return perf_event__synthesize_stat_round(NULL, time, type,
237 process_synthesized_event,
238 NULL);
239}
240
241#define WRITE_STAT_ROUND_EVENT(time, interval) \
242 write_stat_round_event(time, PERF_STAT_ROUND_TYPE__ ## interval)
243
234#define SID(e, x, y) xyarray__entry(e->sample_id, x, y) 244#define SID(e, x, y) xyarray__entry(e->sample_id, x, y)
235 245
236static int 246static int
@@ -306,6 +316,11 @@ static void process_interval(void)
306 clock_gettime(CLOCK_MONOTONIC, &ts); 316 clock_gettime(CLOCK_MONOTONIC, &ts);
307 diff_timespec(&rs, &ts, &ref_time); 317 diff_timespec(&rs, &ts, &ref_time);
308 318
319 if (STAT_RECORD) {
320 if (WRITE_STAT_ROUND_EVENT(rs.tv_sec * NSECS_PER_SEC + rs.tv_nsec, INTERVAL))
321 pr_err("failed to write stat round event\n");
322 }
323
309 print_counters(&rs, 0, NULL); 324 print_counters(&rs, 0, NULL);
310} 325}
311 326
@@ -1670,6 +1685,11 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
1670 "older tools may produce warnings about this file\n."); 1685 "older tools may produce warnings about this file\n.");
1671 } 1686 }
1672 1687
1688 if (!interval) {
1689 if (WRITE_STAT_ROUND_EVENT(walltime_nsecs_stats.max, FINAL))
1690 pr_err("failed to write stat round event\n");
1691 }
1692
1673 if (!perf_stat.file.is_pipe) { 1693 if (!perf_stat.file.is_pipe) {
1674 perf_stat.session->header.data_size += perf_stat.bytes_written; 1694 perf_stat.session->header.data_size += perf_stat.bytes_written;
1675 perf_session__write_header(perf_stat.session, evsel_list, fd, true); 1695 perf_session__write_header(perf_stat.session, evsel_list, fd, true);