Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966892AbbLRJUl (ORCPT ); Fri, 18 Dec 2015 04:20:41 -0500 Received: from terminus.zytor.com ([198.137.202.10]:52525 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934540AbbLRJLp (ORCPT ); Fri, 18 Dec 2015 04:11:45 -0500 Date: Fri, 18 Dec 2015 01:11:30 -0800 From: tip-bot for Jiri Olsa Message-ID: Cc: dsahern@gmail.com, mingo@kernel.org, acme@redhat.com, jolsa@kernel.org, kan.liang@intel.com, hpa@zytor.com, a.p.zijlstra@chello.nl, tglx@linutronix.de, namhyung@kernel.org, linux-kernel@vger.kernel.org Reply-To: acme@redhat.com, mingo@kernel.org, hpa@zytor.com, jolsa@kernel.org, kan.liang@intel.com, dsahern@gmail.com, linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl, namhyung@kernel.org, tglx@linutronix.de In-Reply-To: <1446734469-11352-11-git-send-email-jolsa@kernel.org> References: <1446734469-11352-11-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf stat record: Synthesize event update events Git-Commit-ID: 7b60a7e3a687481553d2b6ec7e6390a6e82f1849 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: 3217 Lines: 107 Commit-ID: 7b60a7e3a687481553d2b6ec7e6390a6e82f1849 Gitweb: http://git.kernel.org/tip/7b60a7e3a687481553d2b6ec7e6390a6e82f1849 Author: Jiri Olsa AuthorDate: Thu, 5 Nov 2015 15:40:54 +0100 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 17 Dec 2015 16:00:33 -0300 perf stat record: Synthesize event update events Synthesize other events stuff not carried within attr event - unit, scale, name. 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-11-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 10f86a6..575e253 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -351,8 +351,19 @@ static void workload_exec_failed_signal(int signo __maybe_unused, siginfo_t *inf workload_exec_errno = info->si_value.sival_int; } +static bool has_unit(struct perf_evsel *counter) +{ + return counter->unit && *counter->unit; +} + +static bool has_scale(struct perf_evsel *counter) +{ + return counter->scale != 1; +} + static int perf_stat_synthesize_config(bool is_pipe) { + struct perf_evsel *counter; int err; if (is_pipe) { @@ -364,6 +375,54 @@ static int perf_stat_synthesize_config(bool is_pipe) } } + /* + * Synthesize other events stuff not carried within + * attr event - unit, scale, name + */ + evlist__for_each(evsel_list, counter) { + if (!counter->supported) + continue; + + /* + * Synthesize unit and scale only if it's defined. + */ + if (has_unit(counter)) { + err = perf_event__synthesize_event_update_unit(NULL, counter, process_synthesized_event); + if (err < 0) { + pr_err("Couldn't synthesize evsel unit.\n"); + return err; + } + } + + if (has_scale(counter)) { + err = perf_event__synthesize_event_update_scale(NULL, counter, process_synthesized_event); + if (err < 0) { + pr_err("Couldn't synthesize evsel scale.\n"); + return err; + } + } + + if (counter->own_cpus) { + err = perf_event__synthesize_event_update_cpus(NULL, counter, process_synthesized_event); + if (err < 0) { + pr_err("Couldn't synthesize evsel scale.\n"); + return err; + } + } + + /* + * Name is needed only for pipe output, + * perf.data carries event names. + */ + if (is_pipe) { + err = perf_event__synthesize_event_update_name(NULL, counter, process_synthesized_event); + if (err < 0) { + pr_err("Couldn't synthesize evsel name.\n"); + return err; + } + } + } + err = perf_event__synthesize_thread_map2(NULL, evsel_list->threads, process_synthesized_event, NULL); -- 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/