Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1203584

[PATCH 2/2] perf evlist: Be more specific on -F/--freq

From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 2/2] perf evlist: Be more specific on -F/--freq
Date 2015-08-09 08:50 +0200
Message-ID <pVsAF-6A9-5@gated-at.bofh.it> (permalink)
References <pVsAF-6A9-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <namhyung@kernel.org>
---
 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 f664a22b5fea..04fddddc6b6f 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);
-- 
2.5.0

--
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/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 2/2] perf evlist: Be more specific on -F/--freq Namhyung Kim <namhyung@kernel.org> - 2015-08-09 08:50 +0200
  Re: [PATCH 2/2] perf evlist: Be more specific on -F/--freq Jiri Olsa <jolsa@redhat.com> - 2015-08-09 11:40 +0200
  [tip:perf/core] perf evlist: Be more specific on -F/--freq tip-bot for Namhyung Kim <tipbot@zytor.com> - 2015-08-12 14:40 +0200

csiph-web