perfetto

package
v3.3.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package perfetto provides functionality to take and examine Perfetto traces. See https://perfetto.dev.

Index

Constants

View Source
const (
	// ErrDone is returned for calls on a trace session that is already stopped.
	ErrDone = fault.Const("Trace already stopped")
	// ErrTracingToFile is returned for read calls on a trace session that is writting to a file on the device.
	ErrTracingToFile = fault.Const("Cannot read buffers, when tracing to a file")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a client ("consumer") of a Perfetto service.

func NewClient

func NewClient(ctx context.Context, conn net.Conn, cleanup app.Cleanup) (*Client, error)

NewClient returns a new client using the provided socket connection. The client takes ownership of the connection and invokes the provided cleanup on shutdown.

func (*Client) Close

func (c *Client) Close(ctx context.Context)

Close closes the underlying connection to the Perfetto service of this client.

func (*Client) Query

func (c *Client) Query(ctx context.Context, cb func(*common.TracingServiceState) error) error

Query queries the Perfetto service for producer and data source info and invokes the given callback on each received result. This is a streaming, synchronous RPC and the callback may be invoked multiple times.

func (*Client) Trace

func (c *Client) Trace(ctx context.Context, cfg *config.TraceConfig, out io.Writer) (*TraceSession, error)

Trace initiates a new Perfetto trace session using the given config. The trace buffers will be serialized to the given writer. This is an asynchronous RPC that can be controlled/waited on using the returned trace session.

type Processor

type Processor struct {
	// contains filtered or unexported fields
}

func NewProcessor

func NewProcessor(ctx context.Context, data []byte) (*Processor, error)

func (*Processor) Close

func (p *Processor) Close()

func (*Processor) Query

func (p *Processor) Query(q string) (*service.QueryResult, error)

type TraceSession

type TraceSession struct {
	// contains filtered or unexported fields
}

TraceSession is the interface to a currently running Perfetto trace.

func (*TraceSession) Read

func (s *TraceSession) Read(ctx context.Context) error

Read requests the service to transfer the buffered data and writes it into the output writer. This is a synchronous call that blocks until the service is done sending data and it has been written.

func (*TraceSession) Start

func (s *TraceSession) Start(ctx context.Context)

Start starts the currently deferred trace of this session. Does nothing, if the Perfetto service doesn't support deferred tracing or the trace was not started in deferred mode.

func (*TraceSession) Stop

func (s *TraceSession) Stop(ctx context.Context)

Stop stops the currently running trace of this session.

func (*TraceSession) Wait

func (s *TraceSession) Wait(ctx context.Context) error

Wait waits for this trace session to finish and returns any error encountered during the trace.

Directories

Path Synopsis
Package android contains the android specific Perfetto tracing code.
Package android contains the android specific Perfetto tracing code.
Package client implements a client for the Perfetto consumer API.
Package client implements a client for the Perfetto consumer API.
Package desktop contains the desktop specific Perfetto tracing code.
Package desktop contains the desktop specific Perfetto tracing code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL