# Recording thermal counters in a trace

## Overview

Fuchsia tracing can capture temperature sensor readings when supported by the
hardware. These readings appear as counters in the trace data and are valuable
for two primary reasons:

- Ensuring physical comfort - Devices that come into contact with people or sensitive environments should not overheat.
- Indicating power consumption - Heat generation is a general byproduct of power consumption and can serve as an indirect measure of power usage.

## Enabling thermal counters

Temperature sampling is not enabled by default. To enable temperature sampling,
run the following command prior to capturing the trace:

    ffx profile temperature logger start -s 500ms

> [!NOTE]
> **Note:** The [`ffx profile`](https://fuchsia.dev/reference/tools/sdk/ffx#ffx_profile) command is used to enable sampling of several different measurements in addition to temperature.

## Capture the trace

For general information on Fuchsia tracing and how to capture trace events
with [`ffx trace`](https://fuchsia.dev/reference/tools/sdk/ffx#ffx_trace), see [Fuchsia tracing](https://fuchsia.dev/docs/development/tracing/README).

To include thermal counter data in your trace, specify the
`metrics_logger` category:

    ffx trace start --categories "#default,metrics_logger"

[](https://issues.fuchsia.dev/issues/new?component=1439230&template=1881640&description=Issue+on:+https://fuchsia.dev/docs/development/tracing/advanced/recording-thermals.md "Report a bug or suggest improvements on this page") [](https://cs.opensource.google/fuchsia/fuchsia/+/main:docs/development/tracing/advanced/recording-thermals.md "View the source code of this page") [](https://ci.android.com/edit?repo=fuchsia/fuchsia/main&file=docs/development/tracing/advanced/recording-thermals.md&cloneRepo=fuchsia/fuchsia:refs/heads/main&fullPath=fuchsia/docs/development/tracing/advanced/recording-thermals.md "Edit the source code of this page")