TRACED_PROBES(8)

NAME

traced_probes - System & OS Probes

DESCRIPTION

traced_probes is a specialized daemon that acts as a privileged Producer in the Perfetto architecture. While any application can act as a producer to contribute its own trace data, traced_probes is specifically responsible for collecting system-level and kernel-level data that typically requires elevated privileges.

Relationship with traced

traced_probes is a client of the traced service. It connects to traced's producer socket and registers a set of data sources. traced then sends requests to traced_probes to start or stop these data sources as part of a tracing session.

This separation of concerns is a key part of Perfetto's design. traced is the central manager, while traced_probes is a specialized data provider. This decoupled architecture allows for multiple, independent producers and consumers to interact with the tracing system simultaneously without interfering with each other.

traced_probes and traced

Security and Privileges

traced_probes often needs to run with elevated privileges (e.g., root or system user on Android) to access kernel interfaces like debugfs or /proc. Separating these high-privilege probes into their own daemon is a key part of Perfetto's security model. It ensures that only a minimal amount of code runs with high privileges, adhering to the principle of least privilege.

Configuration

The data sources provided by traced_probes are configured within the main trace configuration protobuf that is sent to traced. For example, to enable ftrace, you would include an FtraceConfig within the DataSourceConfig for the linux.ftrace data source.

Data Sources

traced_probes provides a wide range of data sources, collecting system-level and kernel-level data. The configuration for these data sources is specified in the data_sources section of the overall trace configuration. Each data source has its own configuration message within a data_source_config block.

Here is an example of the general structure:

data_sources: { config { name: "linux.ftrace" ftrace_config { # ... ftrace-specific settings } } } data_sources: { config { name: "linux.process_stats" process_stats_config { # ... process_stats-specific settings } } }

Below is a detailed list of the main data sources provided by traced_probes, separated by platform.

Linux Data Sources

These data sources are available on Linux-based systems, including Android.

Here is an example of a trace config enabling several Linux data sources:

# Example of a trace config enabling several Linux data sources. data_sources: { config { name: "linux.ftrace" ftrace_config { ftrace_events: "sched/sched_switch" ftrace_events: "power/cpu_idle" } } } data_sources: { config { name: "linux.process_stats" process_stats_config { scan_all_processes_on_start: true proc_stats_poll_ms: 1000 } } } data_sources: { config { name: "linux.sys_stats" sys_stats_config { meminfo_period_ms: 1000 vmstat_period_ms: 1000 } } }

linux.ftrace (Kernel Tracing)

linux.process_stats (Process and Thread Statistics)

linux.sys_stats (System-Wide Statistics)

linux.sysfs_power (Power and Battery Information)

linux.inode_file_map (Inode to File Path Mapping)

metatrace (Perfetto Self-Tracing)

linux.system_info (System Information)

Android Data Sources

These data sources are available only on Android.

Here is an example of a trace config enabling several Android data sources:

# Example of a trace config enabling several Android data sources. data_sources: { config { name: "android.power" android_power_config { battery_poll_ms: 1000 battery_counters: BATTERY_COUNTER_CHARGE collect_power_rails: true } } } data_sources: { config { name: "android.log" android_log_config { log_ids: LID_DEFAULT log_ids: LID_SYSTEM } } } data_sources: { config { name: "android.packages_list" } }

android.power (Power and Battery Information)

android.log (Android Logcat)

android.system_property (Android System Properties)

android.packages_list (Android Package Information)

android.game_interventions (Android Game Intervention List)

android.cpu.uid (Per-UID CPU Time)

android.kernel_wakelocks (Kernel Wakelocks)

android.polled_state (Android Initial Display State)

android.statsd (Android StatsD Atoms)