Little without learning, old without knowledge.

What does Perfetto detail?

Perfetto provides a superset of data sources, which is a relatively obscure concept and is as easy to understand as possible, so it mainly introduces the capabilities of Perfetto.

Perfetto explains more

(1) Overall overview

  • System analysis (system-wide analysis for Linux and Android)

Linux kernel trace: capture high frequency FTrace data: scheduling activity, task switching latency, CPU frequency, etc. User-space profiler and additional probes: native heap analysis, Java heap analysis, / proc state file poller built into Android: Part of the platform since Android 9 Pie, it also runs on Linux

  • Application tracking

Efficient trace point instrumentation: records C ++ application activity structured and configurable events with high throughput, low overhead trace points: Define custom Protobuf messages to represent strongly typed application specific information, track only the information you need with system-wide trace integration: Associate application state with system-wide analysis data on the same timeline

  • Trace viewer

Interactive Trace Exploration: Use Perfetto UI to record, view and process trace data to support files in popular trace formats: TraceEvent JSON, Android Systrace, fTrace text output to run completely in your browser: There is no server interaction involved and you can work even if you are offline

  • Trace analysis

Sql-based trace model: Trace processor extracts trace and exposes SQLite-based interface to access trace content through shell and UI Large trace analysis: Supports trace up to tens of Gigabytes interoperable: can import and export popular trace formats: Chromium JSON tracking format, Android Systrace, FTrace, CSV

(2) System analysis

Perfetto- System analysis, application tracing and trace analysis. Perfetto is a production-level open source stack for performance detection and trace analysis. It provides services and libraries for recording system-level and application-level tracing, native + Java heap analysis, libraries for tracing using SQL analysis, and a Web-based UI to visualize and explore multi-GB tracing.

(3) Traceconv tool

The Traceconv tool converts the Perfetto trace to another trace format.

(4) Trace analysis

Trace analysis-tracking processor. The trace handler is a C ++ library (/ SRC/trace_processor) that absorbs trace encoded in a variety of formats and exposes an SQL interface for querying trace events contained in a consistent set of tables. It also has additional capabilities, including calculating summary metrics, tracing with user-friendly description annotations, and deriving new events from what is being tracked.

(5) heapprofd

Heapprofd: Android heap analyzer.

(6) Perfect CI design

Perfetto’s perfect CI design. This CI is used at the top of the AOSP TreeHugger (not instead). It provides early testing signals and covers other operating systems and older Android devices that TreeHugger does not support.

There are four main parts:

  • Front end: AppEngine.
  • Controller: AppEngine BG service.
  • Worker: Compute Engine + Docker.
  • Database: Firebase real-time database.

They are coupled through the Firebase database. DB is the source of truth of the whole CI.

(7) Security model

A security model for system-wide tracing on Android/Linux.

A picture is worth a thousand words, let’s explore the rest…

Xiaobian extension links

  • SamplePop code download
  • Android Performance Optimization family Bucket

Refer to the link

  • New tools and new experiences for Perfetto

Demure is like a flower shining on water; action is like the wind supporting the willow

❤ ❤ than heart