From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754963AbbHLMb5 (ORCPT ); Wed, 12 Aug 2015 08:31:57 -0400 Received: from terminus.zytor.com ([198.137.202.10]:42489 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754917AbbHLMby (ORCPT ); Wed, 12 Aug 2015 08:31:54 -0400 Date: Wed, 12 Aug 2015 05:31:28 -0700 From: tip-bot for Namhyung Kim Message-ID: Cc: hpa@zytor.com, acme@redhat.com, jolsa@kernel.org, tglx@linutronix.de, dsahern@gmail.com, mingo@kernel.org, linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl, namhyung@kernel.org Reply-To: jolsa@kernel.org, tglx@linutronix.de, hpa@zytor.com, acme@redhat.com, namhyung@kernel.org, a.p.zijlstra@chello.nl, linux-kernel@vger.kernel.org, dsahern@gmail.com, mingo@kernel.org In-Reply-To: <1439102724-14079-2-git-send-email-namhyung@kernel.org> References: <1439102724-14079-2-git-send-email-namhyung@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf evlist: Be more specific on -F/--freq Git-Commit-ID: 4605bb55b91449a1a953a51f0334d3bc02351adb 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: 4605bb55b91449a1a953a51f0334d3bc02351adb Gitweb: http://git.kernel.org/tip/4605bb55b91449a1a953a51f0334d3bc02351adb Author: Namhyung Kim AuthorDate: Sun, 9 Aug 2015 15:45:24 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 10 Aug 2015 17:20:26 -0300 perf evlist: Be more specific on -F/--freq Currently perf evlist -F shows the number as if it's always sampling frequency. But we now support per-event freq/period settings. So it'd better to show more detailed info whether it's freq or period. $ perf record -e 'cpu/config=1/,cpu/config=2,period=300000/' sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.017 MB perf.data ] $ perf evlist -F cpu/config=1/: sample_freq=4000 cpu/config=2,period=300000/: sample_period=300000 Signed-off-by: Namhyung Kim Acked-by: Jiri Olsa Tested-by: Arnaldo Carvalho de Melo Cc: David Ahern Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1439102724-14079-2-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/evsel.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index f664a22..04fdddd 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -2158,8 +2158,13 @@ int perf_evsel__fprintf(struct perf_evsel *evsel, printed += perf_event_attr__fprintf(fp, &evsel->attr, __print_attr__fprintf, &first); } else if (details->freq) { - printed += comma_fprintf(fp, &first, " sample_freq=%" PRIu64, - (u64)evsel->attr.sample_freq); + const char *term = "sample_freq"; + + if (!evsel->attr.freq) + term = "sample_period"; + + printed += comma_fprintf(fp, &first, " %s=%" PRIu64, + term, (u64)evsel->attr.sample_freq); } out: fputc('\n', fp);