tools/perf/util/pmu.h

Source file repositories/reference/linux-study-clean/tools/perf/util/pmu.h

File Facts

System
Linux kernel
Corpus path
tools/perf/util/pmu.h
Extension
.h
Size
12080 bytes
Lines
376
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

struct perf_pmu_caps {
	char *name;
	char *value;
	struct list_head list;
};

enum pmu_kind {
	/* A perf event syscall PMU. */
	PERF_PMU_KIND_PE,
	/* A perf tool provided DRM PMU. */
	PERF_PMU_KIND_DRM,
	/* A perf tool provided HWMON PMU. */
	PERF_PMU_KIND_HWMON,
	/* Perf tool provided PMU for tool events like time. */
	PERF_PMU_KIND_TOOL,
	/* A testing PMU kind. */
	PERF_PMU_KIND_FAKE
};

enum {
	PERF_PMU_TYPE_PE_START    = 0,
	PERF_PMU_TYPE_PE_END      = 0xFFFDFFFF,
	PERF_PMU_TYPE_DRM_START   = 0xFFFE0000,
	PERF_PMU_TYPE_DRM_END     = 0xFFFEFFFF,
	PERF_PMU_TYPE_HWMON_START = 0xFFFF0000,
	PERF_PMU_TYPE_HWMON_END   = 0xFFFFFFFD,
	PERF_PMU_TYPE_TOOL = 0xFFFFFFFE,
	PERF_PMU_TYPE_FAKE = 0xFFFFFFFF,
};

/**
 * struct perf_pmu
 */
struct perf_pmu {
	/** @name: The name of the PMU such as "cpu". */
	const char *name;
	/**
	 * @alias_name: Optional alternate name for the PMU determined in
	 * architecture specific code.
	 */
	char *alias_name;
	/**
	 * @id: Optional PMU identifier read from
	 * <sysfs>/bus/event_source/devices/<name>/identifier.
	 */
	const char *id;
	/**
	 * @type: Perf event attributed type value, read from
	 * <sysfs>/bus/event_source/devices/<name>/type.
	 */
	__u32 type;
	/**
	 * @selectable: Can the PMU name be selected as if it were an event?
	 */
	bool selectable;
	/**
	 * @is_core: Is the PMU the core CPU PMU? Determined by the name being
	 * "cpu" or by the presence of
	 * <sysfs>/bus/event_source/devices/<name>/cpus. There may be >1 core
	 * PMU on systems like Intel hybrid.
	 */
	bool is_core;
	/**
	 * @is_uncore: Is the PMU not within the CPU core? Determined by the
	 * presence of <sysfs>/bus/event_source/devices/<name>/cpumask.
	 */
	bool is_uncore;
	/**
	 * @auxtrace: Are events auxiliary events? Determined in architecture
	 * specific code.
	 */
	bool auxtrace;
	/**
	 * @formats_checked: Only check PMU's formats are valid for
	 * perf_event_attr once.
	 */
	bool formats_checked;
	/** @config_masks_present: Are there config format values? */
	bool config_masks_present;
	/** @config_masks_computed: Set when masks are lazily computed. */
	bool config_masks_computed;
	/**
	 * @max_precise: Number of levels of :ppp precision supported by the
	 * PMU, read from
	 * <sysfs>/bus/event_source/devices/<name>/caps/max_precise.
	 */
	int max_precise;
	/**
	 * @perf_event_attr_init_default: Optional function to default
	 * initialize PMU specific parts of the perf_event_attr.

Annotation

Implementation Notes