Documentation ¶
Overview ¶
Package perfetto contains libraries for displaying trace information in the Perfetto UI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a trace database that stores traces on the local file system.
Trace data is stored in a JSON format [1] that is compatible with the Perfetto UI[2].
For each trace span, the following Perfetto events are generated:
- A complete event, encapsulating the span duration.
- A number of metadata events, encapsulating the span events.
[1] https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview# [2] https://ui.perfetto.dev/
func Open ¶
Open opens the default trace database on the local machine, which is persisted in the provided file.
func (*DB) Serve ¶
Serve runs an HTTP server that serves traces stored in the database. In order to view the traces, open the following URL in a Chrome browser:
https://ui.perfetto.dev/#!/?url=http://<hostname>:9001?app=<app>&version=<version>
, where <hostname> is the hostname of the machine running this server (e.g., "127.0.0.1"), <app> is the application name, and <version> is the application version. If <version> is empty, all of the application's traces will be displayed. If <app> is also empty, all of the database traces will be displayed.
Perfetto UI requires that the server runs on the local port 9001. For that reason, this method will block until port 9001 becomes available.