fuchsia.power.metrics

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).
Added: 17

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_id String format Id of the client. Client may choose any Id with a maximum byte size of 8 (e.g., "ffxTest").
  • request metrics Type of the metrics to be polled and logged.
  • request duration_ms Duration of logging in milliseconds. After this duration, polling and logging will cease.
  • request output_samples_to_syslog Toggle for outputting raw data to syslog.
  • request output_stats_to_syslog Toggle for outputting any available statistics to syslog.
  • error a [fuchsia.metrics.test/MeticsLoggerError] value indicating why the request failed.

Request

NameType
client_id ClientId
metrics vector<Metric>
duration_ms uint32
output_samples_to_syslog bool
output_stats_to_syslog bool

Response

NameType
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_id String format Id of the client. Client may choose any Id with a maximum byte size of 8 (e.g., "ffxTest").
  • request metrics Type of the metrics to be polled and logged.
  • request output_samples_to_syslog Toggle for outputting raw data to syslog.
  • request output_stats_to_syslog Toggle for outputting any available statistics to syslog.
  • error a [fuchsia.metrics.test/RecorderError] value indicating why the request failed.

Request

NameType
client_id ClientId
metrics vector<Metric>
output_samples_to_syslog bool
output_stats_to_syslog bool

Response

NameType
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_id String format Id of the client.
  • response status A bool value indicating if existing logging was stopped (true) or there'sno existing logging for the client.

Request

NameType
client_id ClientId

Response

NameType
stopped bool

STRUCTS

CpuLoad

Defined in fuchsia.power.metrics/recorder.fidl

CPU Load metric details.

FieldTypeDescriptionDefault
interval_ms uint32

Length of the polling interval in milliseconds. Must be smaller than duration_ms of the logging request. Must not be smaller than 500ms if output_samples_to_syslog is enabled in the logging request.

No default

GpuUsage

Defined in fuchsia.power.metrics/recorder.fidl

GPU Usage metric details.

FieldTypeDescriptionDefault
interval_ms uint32

Length of the polling interval in milliseconds. Must be smaller than duration_ms of the logging request. Must not be smaller than 500ms if output_samples_to_syslog is enabled in the logging request.

No default

NetworkActivity

Defined in fuchsia.power.metrics/recorder.fidl

Network Activity metric details.

FieldTypeDescriptionDefault
interval_ms uint32

Length of the polling interval in milliseconds. Must be smaller than duration_ms of the logging request. Must not be smaller than 500ms if output_samples_to_syslog is enabled in the logging request.

No default

Power

Defined in fuchsia.power.metrics/recorder.fidl

Power metric details.

FieldTypeDescriptionDefault
sampling_interval_ms uint32

Length of the sampling interval in milliseconds. Must not be smaller than 500ms if output_samples_to_syslog is enabled in the logging request. Must be smaller than duration_ms of the logging request.

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

FieldTypeDescriptionDefault
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 sampling_interval_ms in the metrics. Must be smaller than duration_ms of the logging request. Must not be smaller than 500ms if output_stats_to_syslog is enabled in the logging request.

No default

Temperature

Defined in fuchsia.power.metrics/recorder.fidl

Temperature metric details.

FieldTypeDescriptionDefault
sampling_interval_ms uint32

Length of the sampling interval in milliseconds. Must not be smaller than 500ms if output_samples_to_syslog is enabled in the logging request. Must be smaller than duration_ms of the logging request.

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.

NameValueDescription
1

Indicates that no driver is found for requested metric logging.

2

Indicates that an invalid sampling interval was provided.

3

Requests to start logging will fail if logging is already active for a given client.

4

Indicates that the logging request contains duplicated metric type.

5

Indicates that the total number of active clients has reached the allowed maxium (defined by MAX_CONCURRENT_CLIENTS = 20 in the Recorder to keep memory use bounded).

6

Indicates that statistics is enabled and an invalid statistics interval is provided.

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.

OrdinalVariantTypeDescription
temperature Temperature
cpu_load CpuLoad
power Power
gpu_usage GpuUsage
network_activity NetworkActivity

Recorder_StartLoggingForever_Result strict

Defined in fuchsia.power.metrics/recorder.fidl

OrdinalVariantTypeDescription
response Recorder_StartLoggingForever_Response
err RecorderError

Recorder_StartLogging_Result strict

Defined in fuchsia.power.metrics/recorder.fidl

OrdinalVariantTypeDescription
response Recorder_StartLogging_Response
err RecorderError

ALIASES

NameValueDescription
ClientId string[16]