Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966440AbbLRJR6 (ORCPT ); Fri, 18 Dec 2015 04:17:58 -0500 Received: from terminus.zytor.com ([198.137.202.10]:52619 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934893AbbLRJOU (ORCPT ); Fri, 18 Dec 2015 04:14:20 -0500 Date: Fri, 18 Dec 2015 01:14:04 -0800 From: tip-bot for Jiri Olsa Message-ID: Cc: mingo@kernel.org, kan.liang@intel.com, dsahern@gmail.com, linux-kernel@vger.kernel.org, namhyung@kernel.org, tglx@linutronix.de, a.p.zijlstra@chello.nl, acme@redhat.com, jolsa@kernel.org, hpa@zytor.com Reply-To: dsahern@gmail.com, kan.liang@intel.com, mingo@kernel.org, tglx@linutronix.de, namhyung@kernel.org, linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl, acme@redhat.com, hpa@zytor.com, jolsa@kernel.org In-Reply-To: <1446734469-11352-19-git-send-email-jolsa@kernel.org> References: <1446734469-11352-19-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf stat report: Allow to override aggr_mode Git-Commit-ID: 89af4e05c21d68f22e07fe66940ea675615a49ed 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: 3751 Lines: 107 Commit-ID: 89af4e05c21d68f22e07fe66940ea675615a49ed Gitweb: http://git.kernel.org/tip/89af4e05c21d68f22e07fe66940ea675615a49ed Author: Jiri Olsa AuthorDate: Thu, 5 Nov 2015 15:41:02 +0100 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 17 Dec 2015 16:30:30 -0300 perf stat report: Allow to override aggr_mode Allowing to override record aggr_mode. It's possible to use perf stat like: $ perf stat report -A $ perf stat report --per-core $ perf stat report --per-socket To customize the recorded aggregate mode regardless what was used during the stat record command. Reported-by: Kan Liang Signed-off-by: Jiri Olsa Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1446734469-11352-19-git-send-email-jolsa@kernel.org [ Renamed 'stat' parameter to 'st' to fix 'already defined' build error with older distros (e.g. RHEL6.7) ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/Documentation/perf-stat.txt | 10 ++++++++++ tools/perf/builtin-stat.c | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt index 95f4928..52ef7a9 100644 --- a/tools/perf/Documentation/perf-stat.txt +++ b/tools/perf/Documentation/perf-stat.txt @@ -182,6 +182,16 @@ Reads and reports stat data from perf data file. --input file:: Input file name. +--per-socket:: +Aggregate counts per processor socket for system-wide mode measurements. + +--per-core:: +Aggregate counts per physical processor for system-wide mode measurements. + +-A:: +--no-aggr:: +Do not aggregate counts across all monitored CPUs. + EXAMPLES -------- diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 3ccf5a9..9805e03 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -138,6 +138,7 @@ struct perf_stat { bool maps_allocated; struct cpu_map *cpus; struct thread_map *threads; + enum aggr_mode aggr_mode; }; static struct perf_stat perf_stat; @@ -1663,6 +1664,15 @@ int process_stat_config_event(struct perf_tool *tool __maybe_unused, perf_event__read_stat_config(&stat_config, &event->stat_config); + if (cpu_map__empty(st->cpus)) { + if (st->aggr_mode != AGGR_UNSET) + pr_warning("warning: processing task data, aggregation mode not set\n"); + return 0; + } + + if (st->aggr_mode != AGGR_UNSET) + stat_config.aggr_mode = st->aggr_mode; + if (perf_stat.file.is_pipe) perf_stat_init_aggr_mode(); else @@ -1743,6 +1753,7 @@ static struct perf_stat perf_stat = { .stat = perf_event__process_stat_event, .stat_round = process_stat_round_event, }, + .aggr_mode = AGGR_UNSET, }; static int __cmd_report(int argc, const char **argv) @@ -1750,6 +1761,12 @@ static int __cmd_report(int argc, const char **argv) struct perf_session *session; const struct option options[] = { OPT_STRING('i', "input", &input_name, "file", "input file name"), + OPT_SET_UINT(0, "per-socket", &perf_stat.aggr_mode, + "aggregate counts per processor socket", AGGR_SOCKET), + OPT_SET_UINT(0, "per-core", &perf_stat.aggr_mode, + "aggregate counts per physical processor core", AGGR_CORE), + OPT_SET_UINT('A', "no-aggr", &perf_stat.aggr_mode, + "disable CPU count aggregation", AGGR_NONE), OPT_END() }; struct stat st; -- 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/