This library defines a protocol for test clients to communicate with the metrics recorder, specifying:
- Metrics type: e.g., temperature, CPU, GPU, network, power.
- Test duration.
- Sampling rate.
- Record processed statistics: minimum, maximum, and average values.
- Statistic processing interval (if applicable).
PROTOCOLS
Recorder
Defined in fuchsia.power.metrics/recorder.fidl
A protocol for managing on-demand metrics logging.
StartLogging
Initiates logging of specified metrics for the provided duration.
Supports concurrent logging of different metrics. Logging may be
terminated early with a call to StopLogging.
This call will fail if logging of the specified metric is already
active. For this reason, a client may wish to precede a StartLogging
call with a StopLogging call, after which the only reason for The
logger to be active would be a conflict with another client.
- request client_idString format Id of the client. Client may choose any Id with a maximum byte size of 8 (e.g., "ffxTest").
- request metricsType of the metrics to be polled and logged.
- request duration_msDuration of logging in milliseconds. After this duration, polling and logging will cease.
- request output_samples_to_syslogToggle for outputting raw data to syslog.
- request output_stats_to_syslogToggle for outputting any available statistics to syslog.
- error a [fuchsia.metrics.test/MeticsLoggerError] value indicating why the request failed.
Request
| Name | Type | 
|---|---|
| client_id | ClientId | 
| metrics | vector<Metric> | 
| duration_ms | uint32 | 
| output_samples_to_syslog | bool | 
| output_stats_to_syslog | bool | 
Response
| Name | Type | 
|---|---|
| payload | Recorder_StartLogging_Result | 
StartLoggingForever
Initiates logging of specified metrics. Supports concurrent logging of
different metrics. Logging will only end upon a StopLogging call.
StartLogging should be preferred for usage in automated tests to
ensure that logging terminates even if the test crashes.
- request client_idString format Id of the client. Client may choose any Id with a maximum byte size of 8 (e.g., "ffxTest").
- request metricsType of the metrics to be polled and logged.
- request output_samples_to_syslogToggle for outputting raw data to syslog.
- request output_stats_to_syslogToggle for outputting any available statistics to syslog.
- error a [fuchsia.metrics.test/RecorderError] value indicating why the request failed.
Request
| Name | Type | 
|---|---|
| client_id | ClientId | 
| metrics | vector<Metric> | 
| output_samples_to_syslog | bool | 
| output_stats_to_syslog | bool | 
Response
| Name | Type | 
|---|---|
| payload | Recorder_StartLoggingForever_Result | 
StopLogging
Terminates all active logging tasks with the given client_id. It is valid to call this method when logging is inactive.
- request client_idString format Id of the client.
- response statusA bool value indicating if existing logging was stopped (true) or there'sno existing logging for the client.
Request
| Name | Type | 
|---|---|
| client_id | ClientId | 
Response
| Name | Type | 
|---|---|
| stopped | bool | 
STRUCTS
CpuLoad
Defined in fuchsia.power.metrics/recorder.fidl
CPU Load metric details.
| Field | Type | Description | Default | 
|---|---|---|---|
| interval_ms | uint32 | Length of the polling interval in milliseconds.
Must be smaller than  | No default | 
GpuUsage
Defined in fuchsia.power.metrics/recorder.fidl
GPU Usage metric details.
| Field | Type | Description | Default | 
|---|---|---|---|
| interval_ms | uint32 | Length of the polling interval in milliseconds.
Must be smaller than  | No default | 
NetworkActivity
Defined in fuchsia.power.metrics/recorder.fidl
Network Activity metric details.
| Field | Type | Description | Default | 
|---|---|---|---|
| interval_ms | uint32 | Length of the polling interval in milliseconds.
Must be smaller than  | No default | 
Power
Defined in fuchsia.power.metrics/recorder.fidl
Power metric details.
| Field | Type | Description | Default | 
|---|---|---|---|
| sampling_interval_ms | uint32 | Length of the sampling interval in milliseconds.
Must not be smaller than 500ms if  | No default | 
| statistics_args | StatisticsArgs? | Boxed(optional) statistics arguments. If none, statistics is disabled. | No default | 
Recorder_StartLoggingForever_Response
Defined in fuchsia.power.metrics/recorder.fidl
<EMPTY>
Recorder_StartLogging_Response
Defined in fuchsia.power.metrics/recorder.fidl
<EMPTY>
StatisticsArgs
Defined in fuchsia.power.metrics/recorder.fidl
| Field | Type | Description | Default | 
|---|---|---|---|
| statistics_interval_ms | uint32 | Length of the interval in milliseconds for summarizing statistics (e.g.,
min, max, avg).
Must be equal to or larger than  | No default | 
Temperature
Defined in fuchsia.power.metrics/recorder.fidl
Temperature metric details.
| Field | Type | Description | Default | 
|---|---|---|---|
| sampling_interval_ms | uint32 | Length of the sampling interval in milliseconds.
Must not be smaller than 500ms if  | No default | 
| statistics_args | StatisticsArgs? | Boxed(optional) statistics arguments. If none, statistics is disabled. | No default | 
ENUMS
RecorderError strict
Type: uint32
Defined in fuchsia.power.metrics/recorder.fidl
Errors associated with Recorder methods. If the request contains any of the following errors, it will fail without affecting the existing logging tasks.
| Name | Value | Description | 
|---|---|---|
| NO_DRIVERS | 1 | Indicates that no driver is found for requested metric logging. | 
| INVALID_SAMPLING_INTERVAL | 2 | Indicates that an invalid sampling interval was provided. | 
| ALREADY_LOGGING | 3 | Requests to start logging will fail if logging is already active for a given client. | 
| DUPLICATED_METRIC | 4 | Indicates that the logging request contains duplicated metric type. | 
| TOO_MANY_ACTIVE_CLIENTS | 5 | Indicates that the total number of active clients has reached the
allowed maxium (defined by  | 
| INVALID_STATISTICS_INTERVAL | 6 | Indicates that statistics is enabled and an invalid statistics interval is provided. | 
| INTERNAL | 7 | Indicates that the request failed due to an internal error. | 
UNIONS
Metric strict
Defined in fuchsia.power.metrics/recorder.fidl
Metric type requested in Recorder methods.
| Ordinal | Variant | Type | Description | 
|---|---|---|---|
| 1 | temperature | Temperature | |
| 2 | cpu_load | CpuLoad | |
| 3 | power | Power | |
| 4 | gpu_usage | GpuUsage | |
| 5 | network_activity | NetworkActivity | 
Recorder_StartLoggingForever_Result strict
Defined in fuchsia.power.metrics/recorder.fidl
| Ordinal | Variant | Type | Description | 
|---|---|---|---|
| 1 | response | Recorder_StartLoggingForever_Response | |
| 2 | err | RecorderError | 
Recorder_StartLogging_Result strict
Defined in fuchsia.power.metrics/recorder.fidl
| Ordinal | Variant | Type | Description | 
|---|---|---|---|
| 1 | response | Recorder_StartLogging_Response | |
| 2 | err | RecorderError | 
ALIASES
| Name | Value | Description | 
|---|---|---|
| ClientId | string[16] |