Commit 4d1b305d authored by Ian Rogers's avatar Ian Rogers Committed by Namhyung Kim
Browse files

perf evsel: Reduce a variables scope



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

Signed-off-by: default avatarIan Rogers <irogers@google.com>
Cc: Dominique Martinet <asmadeus@codewreck.org>
Cc: Ze Gao <zegao2021@gmail.com>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: Weilin Wang <weilin.wang@intel.com>
Link: https://lore.kernel.org/r/20240918223116.127386-1-irogers@google.com


Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
parent f0cb9fa7
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -859,7 +859,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);

@@ -890,6 +889,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 &&