How google/perfetto works
Perfetto is a system-tracing and trace-analysis suite. Its principal workflow is to configure tracing, collect userspace and OS events through SDKs, probes, and tracing daemons, then inspect the resulting trace in the browser UI or analyze it with SQL. The graph also includes trace-processor storage and execution layers. The README documents the product capabilities; sampled source excerpts expose some implementation details, but not enough to verify every runtime connection.
Main entry points: pipeline_module.cc SQL execution · trace_storage.h Trace storage · trace_processor_storage_impl.cc Trace processor · main.cc Tracing daemon
Components 27
Tracing capture
- Tracing SDK
include/perfetto/tracing.h - OS probes
src/traced/probes - Tracing daemon
src/traced/service/main.cc - Tracing service
src/tracing/service/tracing_service_session.cc - Unified trace
Trace processing
- Trace importers
src/trace_processor/importers - Trace processor
src/trace_processor/trace_processor_storage_impl.cc - Trace storage
src/trace_processor/storage/trace_storage.h - String pool
src/trace_processor/containers/string_pool.h - Trace statistics
src/trace_processor/storage/stats.h - Storage API
include/perfetto/trace_processor/trace_processor_storage.h - Storage tables
src/trace_processor/plugins/storage_tables/storage_tables.cc
Analysis and UI
- SQL execution
src/trace_processor/perfetto_sql/engine/pipeline_module.cc - Execution pipeline
src/trace_processor/core/exec/pipeline.cc - Browser trace UI
ui/src/trace_processor/engine.ts - Data Explorer
ui/src/plugins/dev.perfetto.DataExplorer/query_builder/query_execution_service.ts - Bigtrace client
ui/src/bigtrace/query/bigtrace_query_client.ts - UI query results
ui/src/trace_processor/engine.ts
Runtime foundations
- Base utilities
include/perfetto/base/status.h - Build config
include/perfetto/base/build_config.h - Logging
include/perfetto/base/logging.h - File utilities
include/perfetto/ext/base/file_utils.h - Hash map
include/perfetto/ext/base/flat_hash_map.h - String views
include/perfetto/ext/base/string_view.h - Trace data types
include/perfetto/trace_processor/basic_types.h
Other components
- Developer
- Analysis user
Connections 20
- Developer → Tracing SDK: instruments apps
README.md - Developer → Tracing daemon: configures tracing
README.md - Tracing SDK → Tracing service: submits events
- OS probes → Tracing daemon: captures system events
README.md - Tracing daemon → Tracing service: collects tracing
README.md - Tracing service → Unified trace: records trace
README.md - Unified trace → Trace importers: loads trace
- Trace processor → Trace importers: uses importers
src/trace_processor/trace_processor_storage_impl.cc - Trace processor → Trace storage: updates storage
src/trace_processor/trace_processor_storage_impl.cc - Trace storage → String pool: interns strings
src/trace_processor/storage/trace_storage.h - Storage tables → Trace storage: registers tables
src/trace_processor/plugins/storage_tables/storage_tables.cc - Trace processor → Storage API: implements storage
- Unified trace → SQL execution: queries trace
README.md - Analysis user → SQL execution: runs SQL
README.md - SQL execution → Execution pipeline: executes pipeline
src/trace_processor/perfetto_sql/engine/pipeline_module.cc - Analysis user → Browser trace UI: explores trace
README.md - Browser trace UI → Unified trace: visualizes trace
README.md - Data Explorer → Browser trace UI: executes queries
ui/src/plugins/dev.perfetto.DataExplorer/query_builder/query_execution_service.ts - Bigtrace client → Unified trace: queries remotely
- SQL execution → Trace storage: queries tables