From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932501AbbGUMee (ORCPT ); Tue, 21 Jul 2015 08:34:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50492 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932327AbbGUMdd (ORCPT ); Tue, 21 Jul 2015 08:33:33 -0400 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , David Ahern , Ingo Molnar , Namhyung Kim , Peter Zijlstra Subject: [PATCH 45/47] perf script: Display stat events by default Date: Tue, 21 Jul 2015 14:32:05 +0200 Message-Id: <1437481927-29538-46-git-send-email-jolsa@kernel.org> In-Reply-To: <1437481927-29538-1-git-send-email-jolsa@kernel.org> References: <1437481927-29538-1-git-send-email-jolsa@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If no script is specified for stat data, display stat events in raw form. Link: http://lkml.kernel.org/n/tip-ph7bpnetmskvmietfwllf6i6@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/builtin-script.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 9171c53f504f..e3f781a400b9 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -537,9 +537,40 @@ static void process_event(union perf_event *event, struct perf_sample *sample, } static void process_stat(struct perf_stat_config *config __maybe_unused, - struct perf_evsel *evsel __maybe_unused, - u64 time __maybe_unused) + struct perf_evsel *counter, u64 time) { + int nthreads = thread_map__nr(counter->threads); + int ncpus = perf_evsel__nr_cpus(counter); + int cpu, thread; + static int header_printed; + + if (counter->system_wide) + nthreads = 1; + + if (!header_printed) { + printf("%3s %8s %15s %15s %15s %15s %s\n", + "CPU", "THREAD", "VAL", "ENA", "RUN", "TIME", "EVENT"); + header_printed = 1; + } + + for (thread = 0; thread < nthreads; thread++) { + for (cpu = 0; cpu < ncpus; cpu++) { + struct perf_counts_values *counts; + + counts = perf_counts(counter->counts, cpu, thread); + + printf("%3d %8d %15" PRIu64 " %15" PRIu64 " %15" PRIu64 " %15" PRIu64 " %s\n", + counter->cpus->map[cpu], + thread_map__pid(counter->threads, thread), + counts->val, + counts->ena, + counts->run, + time, + perf_evsel__name(counter)); + } + } + + return; } static void process_stat_interval(u64 time __maybe_unused) { } -- 2.4.3