linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] perf evsel: Reduce a variables scope
@ 2024-09-18 22:31 Ian Rogers
  2024-10-01 21:00 ` Namhyung Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Rogers @ 2024-09-18 22:31 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Kan Liang, Ze Gao, Yang Jihong,
	Dominique Martinet, Weilin Wang, linux-perf-users, linux-kernel

In __evsel__config_callchain avoid computing arch until code path that
uses it.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/util/evsel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index dbf9c8cee3c5..f7e829e96599 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -862,7 +862,6 @@ static void __evsel__config_callchain(struct evsel *evsel, struct record_opts *o
 {
 	bool function = evsel__is_function_event(evsel);
 	struct perf_event_attr *attr = &evsel->core.attr;
-	const char *arch = perf_env__arch(evsel__env(evsel));
 
 	evsel__set_sample_bit(evsel, CALLCHAIN);
 
@@ -893,6 +892,8 @@ static void __evsel__config_callchain(struct evsel *evsel, struct record_opts *o
 
 	if (param->record_mode == CALLCHAIN_DWARF) {
 		if (!function) {
+			const char *arch = perf_env__arch(evsel__env(evsel));
+
 			evsel__set_sample_bit(evsel, REGS_USER);
 			evsel__set_sample_bit(evsel, STACK_USER);
 			if (opts->sample_user_regs &&
-- 
2.46.0.662.g92d0881bb0-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] perf evsel: Reduce a variables scope
  2024-09-18 22:31 [PATCH v1] perf evsel: Reduce a variables scope Ian Rogers
@ 2024-10-01 21:00 ` Namhyung Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2024-10-01 21:00 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
	Kan Liang, Ze Gao, Yang Jihong, Dominique Martinet, Weilin Wang,
	linux-perf-users, linux-kernel, Ian Rogers

On Thu, 19 Sep 2024 00:31:16 +0200, Ian Rogers wrote:

> In __evsel__config_callchain avoid computing arch until code path that
> uses it.
> 
> 

Applied to perf-tools-next, thanks!

Best regards,
Namhyung

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-01 21:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-18 22:31 [PATCH v1] perf evsel: Reduce a variables scope Ian Rogers
2024-10-01 21:00 ` Namhyung Kim

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).