fuchsia.perfmon.cpu

PROTOCOLS

Controller

Defined in fuchsia.perfmon.cpu/perfmon.fidl

GetProperties

Fetch the performance monitor properties of the system.

Request

NameType

Response

NameType
properties Properties

Initialize

Create a trace, allocating the needed trace buffers and other resources. "other resources" is basically a catch-all for other things that will be needed. This does not include reserving the events, that is done later by StageConfig().

Request

NameType
allocation Allocation

Response

NameType
result Controller_Initialize_Result

Terminate

Free all trace buffers and any other resources allocated for the trace. This is also done when the connection is closed. Tracing is first stopped if not already stopped. May be called multiple times.

Request

NameType

Response

NameType

GetAllocation

Return the trace allocation configuration, if there is one.

Request

NameType

Response

NameType
allocation Allocation?

StageConfig

Stage performance monitor specification for a cpu. Must be called with data collection off and after Initialize(). Note: This doesn't actually configure the h/w, this just stages the values for subsequent use by Start().

Request

NameType
config Config

Response

NameType
result Controller_StageConfig_Result

GetConfig

Fetch performance monitor specification for a cpu, if it exists. Must be called with data collection off and after StageConfig().

Request

NameType

Response

NameType
config Config?

GetBufferHandle

Return a handle of a trace buffer, if it exists, and if descriptor is valid. descriptor is (0, 1, 2, ..., num_buffers-1)

Request

NameType
descriptor uint32

Response

NameType
vmo handle<vmo>?

Start

Turn on data collection. Must be called after Initialize() + StageConfig() and with data collection off.

Request

NameType

Response

NameType
result Controller_Start_Result

Stop

Turn off data collection. May be called any time after Initialize() has been called and before May be called multiple times.

Request

NameType

Response

NameType

STRUCTS

Controller_Initialize_Response

generated

NameTypeDescriptionDefault

Controller_StageConfig_Response

generated

NameTypeDescriptionDefault

Controller_Start_Response

generated

NameTypeDescriptionDefault

Properties

Defined in fuchsia.perfmon.cpu/perfmon.fidl

The properties of this system.

NameTypeDescriptionDefault
api_version uint16 S/W API version = `API_VERSION`. No default
pm_version uint16 The H/W Performance Monitor version. This is the version defined by the architecture. No default
max_num_events uint16 The maximum number of events that can be simultaneously supported. The combination of events that can be simultaneously supported is architecture/model specific. No default
max_num_fixed_events uint16 The maximum number of fixed events that can be simultaneously supported, and their maximum width. These values are for informational/display purposes. No default
max_fixed_counter_width uint16 No default
max_num_programmable_events uint16 The maximum number of programmable events that can be simultaneously supported, and their maximum width. These values are for informational/display purposes. No default
max_programmable_counter_width uint16 No default
max_num_misc_events uint16 The maximum number of misc events that can be simultaneously supported, and their maximum width. These values are for informational/display purposes. No default
max_misc_counter_width uint16 No default
flags PropertyFlags Various flags. No default

EventConfig

Defined in fuchsia.perfmon.cpu/perfmon.fidl

NameTypeDescriptionDefault
event uint16 Event to collect data for. The values are architecture specific ids. Each event may appear at most once. No default
rate uint32 Sampling rate. - If rate is non-zero then when the event gets this many hits data is collected (e.g., pc, time). The rate can be non-zero for counting based events only. - If rate is zero then: If there is a timebase event then data for this event is collected when data for the timebase event is collected. Otherwise data for the event is collected once, when tracing stops. No default
flags EventConfigFlags Flags for the event. No default

Config

Defined in fuchsia.perfmon.cpu/perfmon.fidl

Passed to StageConfig() to select the data to be collected.

NameTypeDescriptionDefault
events [32] Events to collect data for. No default

Allocation

Defined in fuchsia.perfmon.cpu/perfmon.fidl

The allocation configuration for a data collection run. This is generally the first call to allocate resources for a trace, "trace" is used generically here: == "data collection run".

NameTypeDescriptionDefault
num_buffers uint32 The number of buffers to allocate for trace data. This must be #cpus for now. No default
buffer_size_in_pages uint32 The size of each buffer in 4K pages. Each cpu gets same buffer size. No default

UNIONS

Controller_Initialize_Result

generated

NameTypeDescription
response Controller_Initialize_Response
err int32

Controller_StageConfig_Result

generated

NameTypeDescription
response Controller_StageConfig_Response
err int32

Controller_Start_Result

generated

NameTypeDescription
response Controller_Start_Response
err int32

BITS

PropertyFlags

Type: uint64

NameValueDescription
HAS_LAST_BRANCH 1 The architecture supports LBR records (Last Branch Records).
### EventConfigFlags {:#EventConfigFlags} Type: uint32
NameValueDescription
COLLECT_OS 1 Collect data when running in kernel mode.
COLLECT_USER 2 Collect data when running in userspace mode.
COLLECT_PC 4 Collect aspace+pc values.
IS_TIMEBASE 8 If set for an event then the event is used as the "timebase": data for events with a zero rate is collected when data for the timebase event is collected. It is an error to have this set and have the event's rate be zero. At most one event may be the timebase event.
COLLECT_LAST_BRANCH 16 Collect the available set of last branches. Branch data is emitted as LastBranch records. This is only available when the underlying system supports it.

CONSTANTS

NameValueTypeDescription
API_VERSION 0 uint16
MAX_NUM_EVENTS 32 uint16 The maximum number of events we support simultaneously. Typically the h/w supports less than this, e.g., 7 or so.