gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::PerfKvmCounterConfig Class Reference

PerfEvent counter configuration. More...

#include <perfevent.hh>

Public Member Functions

 PerfKvmCounterConfig (uint32_t type, uint64_t config)
 Initialize PerfEvent counter configuration structure.
 
 ~PerfKvmCounterConfig ()
 
PerfKvmCounterConfigsamplePeriod (uint64_t period)
 Set the initial sample period (overflow count) of an event.
 
PerfKvmCounterConfigwakeupEvents (uint32_t events)
 Set the number of samples that need to be triggered before reporting data as being available on the perf event FD.
 
PerfKvmCounterConfigdisabled (bool val)
 Don't start the performance counter automatically when attaching it.
 
PerfKvmCounterConfigpinned (bool val)
 Force the group to be on the active all the time (i.e., disallow multiplexing).
 
PerfKvmCounterConfigexclude_host (bool val)
 Exclude the events from the host (i.e., only include events from the guest system).
 
PerfKvmCounterConfigexclude_hv (bool val)
 Exclude the hyper visor (i.e., only include events from the guest system).
 

Public Attributes

struct perf_event_attr attr
 Underlying perf_event_attr structure describing the counter.
 

Detailed Description

PerfEvent counter configuration.

Definition at line 54 of file perfevent.hh.

Constructor & Destructor Documentation

◆ PerfKvmCounterConfig()

gem5::PerfKvmCounterConfig::PerfKvmCounterConfig ( uint32_t type,
uint64_t config )

Initialize PerfEvent counter configuration structure.

PerfEvent has the concept of counter types, which is a way to abstract hardware performance counters or access software events. The type field in the configuration specifies what type of counter this is. For hardware performance counters, it's typically PERF_TYPE_HARDWARE, PERF_TYPE_HW_CACHE, or PERF_TYPE_RAW.

The 'config' field has different meanings depending on the type of counter. Possible values are listed in perf_event.h in the kernel headers. When using raw counters, the value is the raw value written to the performance counter configuration register (some bits dealing with sampling and similar features are usually masked).

Parameters
typeCounter type.
configCounter configuration

Definition at line 57 of file perfevent.cc.

References attr, and gem5::X86ISA::type.

◆ ~PerfKvmCounterConfig()

gem5::PerfKvmCounterConfig::~PerfKvmCounterConfig ( )

Definition at line 66 of file perfevent.cc.

Member Function Documentation

◆ disabled()

PerfKvmCounterConfig & gem5::PerfKvmCounterConfig::disabled ( bool val)
inline

Don't start the performance counter automatically when attaching it.

Parameters
valtrue to disable, false to enable the counter

Definition at line 113 of file perfevent.hh.

References attr, disabled(), and gem5::X86ISA::val.

Referenced by disabled(), and gem5::BaseKvmCPU::setupCounters().

◆ exclude_host()

PerfKvmCounterConfig & gem5::PerfKvmCounterConfig::exclude_host ( bool val)
inline

Exclude the events from the host (i.e., only include events from the guest system).

Intel CPUs seem to support this attribute from Linux 3.2 and onwards. Non-x86 architectures currently ignore this attribute (Linux 3.12-rc5).

@warn This attribute is ignored if it isn't present in the kernel headers or if the kernel doesn't support it.

Parameters
valtrue to exclude host events

Definition at line 144 of file perfevent.hh.

References attr, exclude_host(), and gem5::X86ISA::val.

Referenced by exclude_host(), gem5::BaseKvmCPU::setupCounters(), and gem5::BaseKvmCPU::setupInstCounter().

◆ exclude_hv()

PerfKvmCounterConfig & gem5::PerfKvmCounterConfig::exclude_hv ( bool val)
inline

Exclude the hyper visor (i.e., only include events from the guest system).

@warn This is attribute only seems to be ignored on Intel.

Parameters
valtrue to exclude host events

Definition at line 159 of file perfevent.hh.

References attr, exclude_hv(), and gem5::X86ISA::val.

Referenced by exclude_hv(), gem5::BaseKvmCPU::setupCounters(), and gem5::BaseKvmCPU::setupInstCounter().

◆ pinned()

PerfKvmCounterConfig & gem5::PerfKvmCounterConfig::pinned ( bool val)
inline

Force the group to be on the active all the time (i.e., disallow multiplexing).

Only applies to group leaders.

Parameters
valtrue to pin the counter

Definition at line 126 of file perfevent.hh.

References attr, pinned(), and gem5::X86ISA::val.

Referenced by pinned(), and gem5::BaseKvmCPU::setupCounters().

◆ samplePeriod()

PerfKvmCounterConfig & gem5::PerfKvmCounterConfig::samplePeriod ( uint64_t period)
inline

Set the initial sample period (overflow count) of an event.

If this is set to 0, the event acts as a normal counting event and does not trigger overflows.

Parameters
periodNumber of counter events before the counter overflows

Definition at line 88 of file perfevent.hh.

References attr.

Referenced by gem5::BaseKvmCPU::setupCounters(), and gem5::BaseKvmCPU::setupInstCounter().

◆ wakeupEvents()

PerfKvmCounterConfig & gem5::PerfKvmCounterConfig::wakeupEvents ( uint32_t events)
inline

Set the number of samples that need to be triggered before reporting data as being available on the perf event FD.

Defaults to 0, which disables overflow reporting.

Parameters
eventsNumber of overflows before signaling a wake up

Definition at line 101 of file perfevent.hh.

References attr.

Referenced by gem5::BaseKvmCPU::setupCounters(), and gem5::BaseKvmCPU::setupInstCounter().

Member Data Documentation

◆ attr

struct perf_event_attr gem5::PerfKvmCounterConfig::attr

Underlying perf_event_attr structure describing the counter.

Definition at line 165 of file perfevent.hh.

Referenced by gem5::PerfKvmCounter::attach(), disabled(), exclude_host(), exclude_hv(), PerfKvmCounterConfig(), pinned(), samplePeriod(), and wakeupEvents().


The documentation for this class was generated from the following files:

Generated on Tue Jun 18 2024 16:24:13 for gem5 by doxygen 1.11.0