From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755913AbbHGHRx (ORCPT ); Fri, 7 Aug 2015 03:17:53 -0400 Received: from terminus.zytor.com ([198.137.202.10]:39519 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755014AbbHGHRv (ORCPT ); Fri, 7 Aug 2015 03:17:51 -0400 Date: Fri, 7 Aug 2015 00:17:35 -0700 From: tip-bot for Jiri Olsa Message-ID: Cc: linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl, namhyung@kernel.org, jolsa@kernel.org, acme@redhat.com, mingo@kernel.org, hpa@zytor.com, tglx@linutronix.de, dsahern@gmail.com Reply-To: dsahern@gmail.com, hpa@zytor.com, tglx@linutronix.de, jolsa@kernel.org, acme@redhat.com, mingo@kernel.org, namhyung@kernel.org, linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl In-Reply-To: <1437481927-29538-4-git-send-email-jolsa@kernel.org> References: <1437481927-29538-4-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf stat: Move 'scale' into struct perf_stat_config Git-Commit-ID: 711a572ea8ae7e9ab6575403c6d632d058d5cb3d 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 Commit-ID: 711a572ea8ae7e9ab6575403c6d632d058d5cb3d Gitweb: http://git.kernel.org/tip/711a572ea8ae7e9ab6575403c6d632d058d5cb3d Author: Jiri Olsa AuthorDate: Tue, 21 Jul 2015 14:31:23 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 6 Aug 2015 16:02:39 -0300 perf stat: Move 'scale' into struct perf_stat_config Moving 'scale' into struct perf_stat_config. The point is to centralize the base stat config so it could be used localy together with other stat routines in other parts of perf code. Signed-off-by: Jiri Olsa Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1437481927-29538-4-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 12 ++++++------ tools/perf/util/stat.h | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index bafb830..3fb2865 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -101,7 +101,6 @@ static struct target target = { static int run_count = 1; static bool no_inherit = false; -static bool scale = true; static volatile pid_t child_pid = -1; static bool null_run = false; static int detailed_run = 0; @@ -127,6 +126,7 @@ static volatile int done = 0; static struct perf_stat_config stat_config = { .aggr_mode = AGGR_GLOBAL, + .scale = true, }; static inline void diff_timespec(struct timespec *r, struct timespec *a, @@ -151,7 +151,7 @@ static int create_perf_stat_counter(struct perf_evsel *evsel) { struct perf_event_attr *attr = &evsel->attr; - if (scale) + if (stat_config.scale) attr->read_format = PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_TOTAL_TIME_RUNNING; @@ -240,13 +240,13 @@ process_counter_values(struct perf_evsel *evsel, int cpu, int thread, case AGGR_NONE: if (!evsel->snapshot) perf_evsel__compute_deltas(evsel, cpu, thread, count); - perf_counts_values__scale(count, scale, NULL); + perf_counts_values__scale(count, stat_config.scale, NULL); if (stat_config.aggr_mode == AGGR_NONE) perf_stat__update_shadow_stats(evsel, count->values, cpu); break; case AGGR_GLOBAL: aggr->val += count->val; - if (scale) { + if (stat_config.scale) { aggr->ena += count->ena; aggr->run += count->run; } @@ -299,7 +299,7 @@ static int process_counter(struct perf_evsel *counter) if (!counter->snapshot) perf_evsel__compute_deltas(counter, -1, -1, aggr); - perf_counts_values__scale(aggr, scale, &counter->counts->scaled); + perf_counts_values__scale(aggr, stat_config.scale, &counter->counts->scaled); for (i = 0; i < 3; i++) update_stats(&ps->res_stats[i], count[i]); @@ -1274,7 +1274,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused) "system-wide collection from all CPUs"), OPT_BOOLEAN('g', "group", &group, "put the counters into a counter group"), - OPT_BOOLEAN('c', "scale", &scale, "scale/normalize counters"), + OPT_BOOLEAN('c', "scale", &stat_config.scale, "scale/normalize counters"), OPT_INCR('v', "verbose", &verbose, "be more verbose (show counter open errors, etc)"), OPT_INTEGER('r', "repeat", &run_count, diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index 078bee4..0a1d83f 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h @@ -52,6 +52,7 @@ struct perf_counts { struct perf_stat_config { enum aggr_mode aggr_mode; + bool scale; }; static inline struct perf_counts_values*