linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	David Ahern <dsahern@gmail.com>,
	Hendrick Brueckner <brueckner@linux.vnet.ibm.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Thomas Richter <tmricht@linux.vnet.ibm.com>,
	Wang Nan <wangnan0@huawei.com>
Subject: [PATCH 06/32] perf evsel: Check if callchain is enabled before setting it up
Date: Wed, 17 Jan 2018 13:11:56 -0300	[thread overview]
Message-ID: <20180117161222.15611-7-acme@kernel.org> (raw)
In-Reply-To: <20180117161222.15611-1-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

The construct:

	if (callchain_param)
		perf_evsel__config_callchain(evsel, opts, &callchain_param);

happens in several places, so make perf_evsel__config_callchain() work
just like free(NULL), do nothing if param->enabled is not set.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hendrick Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-ykk0qzxnxwx3o611ctjnmxav@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evsel.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 4eea3b404507..efa2e629a669 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -651,9 +651,9 @@ int perf_evsel__group_desc(struct perf_evsel *evsel, char *buf, size_t size)
 	return ret;
 }
 
-void perf_evsel__config_callchain(struct perf_evsel *evsel,
-				  struct record_opts *opts,
-				  struct callchain_param *param)
+static void __perf_evsel__config_callchain(struct perf_evsel *evsel,
+					   struct record_opts *opts,
+					   struct callchain_param *param)
 {
 	bool function = perf_evsel__is_function_event(evsel);
 	struct perf_event_attr *attr = &evsel->attr;
@@ -699,6 +699,14 @@ void perf_evsel__config_callchain(struct perf_evsel *evsel,
 	}
 }
 
+void perf_evsel__config_callchain(struct perf_evsel *evsel,
+				  struct record_opts *opts,
+				  struct callchain_param *param)
+{
+	if (param->enabled)
+		return __perf_evsel__config_callchain(evsel, opts, param);
+}
+
 static void
 perf_evsel__reset_callgraph(struct perf_evsel *evsel,
 			    struct callchain_param *param)
-- 
2.14.3

  parent reply	other threads:[~2018-01-17 16:11 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17 16:11 [GIT PULL 00/32] perf/core improvements and fixes Arnaldo Carvalho de Melo
2018-01-17 16:11 ` [PATCH 01/32] perf evsel: Fix incorrect handling of type _TERM_DRV_CFG Arnaldo Carvalho de Melo
2018-01-17 16:11 ` [PATCH 02/32] perf evlist: Remove trailing semicolon Arnaldo Carvalho de Melo
2018-01-17 16:11 ` [PATCH 03/32] perf script python: Add script to profile and resolve physical mem type Arnaldo Carvalho de Melo
2018-01-17 16:11 ` [PATCH 04/32] perf trace: No need to set PERF_SAMPLE_IDENTIFIER explicitely Arnaldo Carvalho de Melo
2018-01-17 16:11 ` [PATCH 05/32] perf tools: Fix copyfile_offset update of output offset Arnaldo Carvalho de Melo
2018-01-17 16:11 ` Arnaldo Carvalho de Melo [this message]
2018-01-17 16:11 ` [PATCH 07/32] perf trace: Fix setting of --call-graph/--max-stack for non-syscall events Arnaldo Carvalho de Melo
2018-01-17 16:11 ` [PATCH 08/32] tools lib traceevent: Fix bad force_token escape sequence Arnaldo Carvalho de Melo
2018-01-17 16:11 ` [PATCH 09/32] tools lib traceevent: Show value of flags that have not been parsed Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 10/32] tools lib traceevent: Print value of unknown symbolic fields Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 11/32] tools lib traceevent: Simplify pointer print logic and fix %pF Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 12/32] tools lib traceevent: Handle new pointer processing of bprint strings Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 13/32] tools lib traceevent: Show contents (in hex) of data of unrecognized type records Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 14/32] tools lib traceevent: Use asprintf when possible Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 15/32] tools lib traceevent: Add UL suffix to MISSING_EVENTS Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 16/32] tools lib traceevent: Fix missing break in FALSE case of pevent_filter_clear_trivial() Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 17/32] tools lib traceevent: Fix get_field_str() for dynamic strings Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 18/32] perf tools: Add ARM Statistical Profiling Extensions (SPE) support Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 19/32] perf callchain: Fix attr.sample_max_stack setting Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 20/32] perf unwind: Do not look just at the global callchain_param.record_mode Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 21/32] perf trace: Setup DWARF callchains for non-syscall events when --max-stack is used Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 22/32] perf trace: Allow overriding global --max-stack per event Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 23/32] perf callchains: Ask for PERF_RECORD_MMAP for data mmaps for DWARF unwinding Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 24/32] perf report: Improve error msg when no first/last sample time found Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 25/32] perf script: " Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 26/32] perf util: Improve error checking for time percent input Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 27/32] perf util: Support no index time percent slice Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 28/32] perf report: Add an indication of what time slices are used Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 29/32] perf util: Allocate time slices buffer according to number of comma Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 30/32] perf report: Remove the time slices number limitation Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 31/32] perf script: " Arnaldo Carvalho de Melo
2018-01-17 16:12 ` [PATCH 32/32] perf record: Fix failed memory allocation for get_cpuid_str Arnaldo Carvalho de Melo
2018-01-17 16:22 ` [GIT PULL 00/32] perf/core improvements and fixes Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180117161222.15611-7-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=brueckner@linux.vnet.ibm.com \
    --cc=dsahern@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tmricht@linux.vnet.ibm.com \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).