mirror of
https://github.com/torvalds/linux.git
synced 2026-11-27 17:02:17 +00:00
The default config is computed during creation of the PMU and may do things like scanning sysfs, when the PMU may just be used as part of scanning. Change default_config to perf_event_attr_init_default, a callback that is used when a default config needs initializing. This avoids holding onto the memory for a perf_event_attr and copying. On a tigerlake laptop running the pmu-scan benchmark: Before: Running 'internals/pmu-scan' benchmark: Computing performance of sysfs PMU event scan for 100 times Average core PMU scanning took: 28.780 usec (+- 0.503 usec) Average PMU scanning took: 283.480 usec (+- 18.471 usec) Number of openat syscalls: 30,227 After: Running 'internals/pmu-scan' benchmark: Computing performance of sysfs PMU event scan for 100 times Average core PMU scanning took: 27.880 usec (+- 0.169 usec) Average PMU scanning took: 245.260 usec (+- 15.758 usec) Number of openat syscalls: 28,914 Over 3 runs it is a nearly 12% reduction in execution time and a 4.3% of openat calls. Signed-off-by: Ian Rogers <[email protected]> Reviewed-by: Adrian Hunter <[email protected]> Cc: Ravi Bangoria <[email protected]> Cc: James Clark <[email protected]> Cc: Suzuki K Poulose <[email protected]> Cc: Yang Jihong <[email protected]> Cc: Will Deacon <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mike Leach <[email protected]> Cc: Jing Zhang <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Kan Liang <[email protected]> Cc: John Garry <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
49 lines
1.1 KiB
C
49 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* intel_pt.h: Intel Processor Trace support
|
|
* Copyright (c) 2013-2015, Intel Corporation.
|
|
*/
|
|
|
|
#ifndef INCLUDE__PERF_INTEL_PT_H__
|
|
#define INCLUDE__PERF_INTEL_PT_H__
|
|
|
|
#define INTEL_PT_PMU_NAME "intel_pt"
|
|
|
|
enum {
|
|
INTEL_PT_PMU_TYPE,
|
|
INTEL_PT_TIME_SHIFT,
|
|
INTEL_PT_TIME_MULT,
|
|
INTEL_PT_TIME_ZERO,
|
|
INTEL_PT_CAP_USER_TIME_ZERO,
|
|
INTEL_PT_TSC_BIT,
|
|
INTEL_PT_NORETCOMP_BIT,
|
|
INTEL_PT_HAVE_SCHED_SWITCH,
|
|
INTEL_PT_SNAPSHOT_MODE,
|
|
INTEL_PT_PER_CPU_MMAPS,
|
|
INTEL_PT_MTC_BIT,
|
|
INTEL_PT_MTC_FREQ_BITS,
|
|
INTEL_PT_TSC_CTC_N,
|
|
INTEL_PT_TSC_CTC_D,
|
|
INTEL_PT_CYC_BIT,
|
|
INTEL_PT_MAX_NONTURBO_RATIO,
|
|
INTEL_PT_FILTER_STR_LEN,
|
|
INTEL_PT_AUXTRACE_PRIV_MAX,
|
|
};
|
|
|
|
struct auxtrace_record;
|
|
struct perf_tool;
|
|
union perf_event;
|
|
struct perf_session;
|
|
struct perf_event_attr;
|
|
struct perf_pmu;
|
|
|
|
struct auxtrace_record *intel_pt_recording_init(int *err);
|
|
|
|
int intel_pt_process_auxtrace_info(union perf_event *event,
|
|
struct perf_session *session);
|
|
|
|
void intel_pt_pmu_default_config(const struct perf_pmu *intel_pt_pmu,
|
|
struct perf_event_attr *attr);
|
|
|
|
#endif
|