Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934991AbbLRJNi (ORCPT ); Fri, 18 Dec 2015 04:13:38 -0500 Received: from terminus.zytor.com ([198.137.202.10]:52501 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964941AbbLRJLJ (ORCPT ); Fri, 18 Dec 2015 04:11:09 -0500 Date: Fri, 18 Dec 2015 01:10:50 -0800 From: tip-bot for Jiri Olsa Message-ID: Cc: kan.liang@intel.com, dsahern@gmail.com, a.p.zijlstra@chello.nl, namhyung@kernel.org, hpa@zytor.com, tglx@linutronix.de, mingo@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com Reply-To: kan.liang@intel.com, dsahern@gmail.com, a.p.zijlstra@chello.nl, namhyung@kernel.org, tglx@linutronix.de, hpa@zytor.com, mingo@kernel.org, jolsa@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org In-Reply-To: <1446734469-11352-9-git-send-email-jolsa@kernel.org> References: <1446734469-11352-9-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf stat record: Write stat round events on record Git-Commit-ID: 7aad0c32bb6aaa39aab596264ddc49d44c8088f3 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2839 Lines: 82 Commit-ID: 7aad0c32bb6aaa39aab596264ddc49d44c8088f3 Gitweb: http://git.kernel.org/tip/7aad0c32bb6aaa39aab596264ddc49d44c8088f3 Author: Jiri Olsa AuthorDate: Thu, 5 Nov 2015 15:40:52 +0100 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 17 Dec 2015 16:00:31 -0300 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 Signed-off-by: Jiri Olsa Tested-by: Arnaldo Carvalho de Melo Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1446734469-11352-9-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 32aa2ea..fcece42 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, return 0; } +static int write_stat_round_event(u64 time, u64 type) +{ + return perf_event__synthesize_stat_round(NULL, time, type, + process_synthesized_event, + NULL); +} + +#define WRITE_STAT_ROUND_EVENT(time, interval) \ + write_stat_round_event(time, PERF_STAT_ROUND_TYPE__ ## interval) + #define SID(e, x, y) xyarray__entry(e->sample_id, x, y) static int @@ -306,6 +316,11 @@ static void process_interval(void) clock_gettime(CLOCK_MONOTONIC, &ts); diff_timespec(&rs, &ts, &ref_time); + if (STAT_RECORD) { + if (WRITE_STAT_ROUND_EVENT(rs.tv_sec * NSECS_PER_SEC + rs.tv_nsec, INTERVAL)) + pr_err("failed to write stat round event\n"); + } + print_counters(&rs, 0, NULL); } @@ -1670,6 +1685,11 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused) "older tools may produce warnings about this file\n."); } + if (!interval) { + if (WRITE_STAT_ROUND_EVENT(walltime_nsecs_stats.max, FINAL)) + pr_err("failed to write stat round event\n"); + } + if (!perf_stat.file.is_pipe) { perf_stat.session->header.data_size += perf_stat.bytes_written; perf_session__write_header(perf_stat.session, evsel_list, fd, true); -- 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/