Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752706AbbHEP72 (ORCPT ); Wed, 5 Aug 2015 11:59:28 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:35319 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751657AbbHEP7Z (ORCPT ); Wed, 5 Aug 2015 11:59:25 -0400 Date: Wed, 5 Aug 2015 17:59:15 +0200 From: Stephane Eranian To: linux-kernel@vger.kernel.org Cc: acme@redhat.com, jolsa@redhat.com, peterz@infradead.org, mingo@elte.hu, namhyung@kernel.org, andi@firstfloor.org Subject: [PATCH] perf/evlist: show branch_sample_type bits Message-ID: <20150805155915.GA5912@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2244 Lines: 57 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 -- 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); -- 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/