public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf/evlist: show branch_sample_type bits
@ 2015-08-05 15:59 Stephane Eranian
  0 siblings, 0 replies; only message in thread
From: Stephane Eranian @ 2015-08-05 15:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: acme, jolsa, peterz, mingo, namhyung, andi


This patchs improves perf evlist by adding the
dump of the branch_sample_bits. This is part
of perf_event_attr and is important to know
when sampling branches.

Patch is relative to tip.git

Signed-off-by: Stephane Eranian <eranian@google.com>
--

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 7d3acba..a6879c7 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1095,6 +1095,20 @@ static void __p_sample_type(char *buf, size_t size, u64 value)
 	__p_bits(buf, size, value, bits);
 }
 
+static void __p_branch_sample_type(char *buf, size_t size, u64 value)
+{
+#define bit_name(n) { PERF_SAMPLE_BRANCH_##n, #n }
+	struct bit_names bits[] = {
+		bit_name(USER), bit_name(KERNEL), bit_name(HV), bit_name(ANY),
+		bit_name(ANY_CALL), bit_name(ANY_RETURN), bit_name(IND_CALL), bit_name(ABORT_TX),
+		bit_name(IN_TX), bit_name(NO_TX), bit_name(COND),
+		bit_name(CALL_STACK), bit_name(IND_JUMP),
+		{ .name = NULL, }
+	};
+#undef bit_name
+	__p_bits(buf, size, value, bits);
+}
+
 static void __p_read_format(char *buf, size_t size, u64 value)
 {
 #define bit_name(n) { PERF_FORMAT_##n, #n }
@@ -1113,6 +1127,7 @@ static void __p_read_format(char *buf, size_t size, u64 value)
 #define p_unsigned(val)		snprintf(buf, BUF_SIZE, "%"PRIu64, (uint64_t)(val))
 #define p_signed(val)		snprintf(buf, BUF_SIZE, "%"PRId64, (int64_t)(val))
 #define p_sample_type(val)	__p_sample_type(buf, BUF_SIZE, val)
+#define p_branch_sample_type(val)	__p_branch_sample_type(buf, BUF_SIZE, val)
 #define p_read_format(val)	__p_read_format(buf, BUF_SIZE, val)
 
 #define PRINT_ATTRn(_n, _f, _p)				\
@@ -1137,6 +1152,7 @@ int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr,
 	PRINT_ATTRn("{ sample_period, sample_freq }", sample_period, p_unsigned);
 	PRINT_ATTRf(sample_type, p_sample_type);
 	PRINT_ATTRf(read_format, p_read_format);
+	PRINT_ATTRf(branch_sample_type, p_branch_sample_type);
 
 	PRINT_ATTRf(disabled, p_unsigned);
 	PRINT_ATTRf(inherit, p_unsigned);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-08-05 15:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-05 15:59 [PATCH] perf/evlist: show branch_sample_type bits Stephane Eranian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox