TRACED(8)

NAME

traced - The Perfetto Tracing Service

DESCRIPTION

traced is the central daemon in Perfetto's service-based architecture. It acts as the grand central station for all tracing activity on the system, mediating interactions between entities that want to record data (Producers) and entities that want to control and read traces (Consumers).

In a typical system-wide tracing setup (like on Android or Linux), traced runs as a long-lived background daemon, often started at system boot.

Architecture

Perfetto's architecture is designed for security and robustness, with traced at its core. The model consists of three main components:

This decoupled architecture allows for multiple, independent producers and consumers to interact with the tracing system simultaneously without interfering with each other.

Core Responsibilities

traced itself does not generate trace data. Its primary role is to manage the logistics of one or more tracing sessions:

Interaction Model

Entities interact with traced primarily through two channels:

  1. IPC Channel: Used for relatively low-frequency control signals.
    • Producers use it to register themselves, advertise data sources, and receive start/stop commands.
    • Consumers use it to send trace configs, start/stop sessions, and read back the final trace data.
    • On POSIX systems, this is typically a UNIX stream socket.
  2. Shared Memory: Used for high-frequency, low-overhead data transport.
    • Each Producer has a dedicated shared memory region shared only with traced.
    • Producers write trace packets into this memory without blocking.
    • traced periodically scans these memory regions and copies valid, completed packets into its central trace buffers.

Command-line options

traced supports the following command-line options:

Built-in Producer

On Android, traced also includes a built-in producer with several key responsibilities:

Security

The service-based architecture is designed with security in mind. Producers are untrusted and isolated from each other and from the central service. The use of UNIX socket permissions allows administrators to control who can connect to the tracing service as a producer or a consumer.