Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf script: Use callchain_param_setup() instead of open coded equivalent

Refactoring script__setup_sample_type() by using callchain_param_setup()
to replace the duplicate code for callchain parameter setting up.

Reviewed-by: James Clark <james.clark@arm.com>
Signed-off-by: Alexandre Truong <alexandre.truong@arm.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20211217154521.80603-4-german.gomez@arm.com
Signed-off-by: German Gomez <german.gomez@arm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Alexandre Truong and committed by
Arnaldo Carvalho de Melo
ab236921 32bfa5bf

+1 -10
+1 -10
tools/perf/builtin-script.c
··· 3468 3468 struct perf_session *session = script->session; 3469 3469 u64 sample_type = evlist__combined_sample_type(session->evlist); 3470 3470 3471 - if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain) { 3472 - if ((sample_type & PERF_SAMPLE_REGS_USER) && 3473 - (sample_type & PERF_SAMPLE_STACK_USER)) { 3474 - callchain_param.record_mode = CALLCHAIN_DWARF; 3475 - dwarf_callchain_users = true; 3476 - } else if (sample_type & PERF_SAMPLE_BRANCH_STACK) 3477 - callchain_param.record_mode = CALLCHAIN_LBR; 3478 - else 3479 - callchain_param.record_mode = CALLCHAIN_FP; 3480 - } 3471 + callchain_param_setup(sample_type); 3481 3472 3482 3473 if (script->stitch_lbr && (callchain_param.record_mode != CALLCHAIN_LBR)) { 3483 3474 pr_warning("Can't find LBR callchain. Switch off --stitch-lbr.\n"