client

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: 22 Imported by: 0

Documentation

Overview

Package client provides functions for launching and communicating with the gapii tracer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flags

type Flags uint32

Flags is a bit-field of flags to use when creating a capture.

const (

	// DeferStart does not start tracing right away but waits for a signal
	// from gapit
	DeferStart Flags = 0x00000010
	// NoBuffer causes the trace to not buffer any data. This will allow
	// more data to be preserved if an application may crash.
	NoBuffer Flags = 0x00000020
	// HideUnknownExtensions will prevent any unknown extensions from being
	// seen by the application
	HideUnknownExtensions Flags = 0x00000040
	// StoreTimestamps requests that the capture contain timestamps
	StoreTimestamps Flags = 0x00000080
	// DisableCoherentMemoryTracker disables the coherent memory tracker from running.
	DisableCoherentMemoryTracker Flags = 0x000000100
	// WaitForDebugger makes gapii wait for a debugger to connect
	WaitForDebugger Flags = 0x000000200
	// FLAG_IGNORE_ANDROID_FRAME_BOUNDARY
	IgnoreFrameBoundaryDelimiters Flags = 0x00001000

	// VulkanAPI is hard-coded bit mask for Vulkan API, it needs to be kept in sync
	// with the api_index in the vulkan.api file.
	VulkanAPI = uint32(1 << 2)
)

type Options

type Options struct {
	// If non-zero, then a framebuffer-observation will be made after every n end-of-frames.
	ObserveFrameFrequency uint32
	// If non-zero, then the capture will only start at frame n.
	StartFrame uint32
	// If non-zero, then only n frames will be captured.
	FramesToCapture uint32
	// If positive, then only capture for this amount of time.
	Duration time.Duration
	// A bitmask of the APIs to capture in a trace.
	APIs uint32
	// Combination of FlagXX bits.
	Flags Flags
	// Additional flags to pass to am start
	AdditionalFlags string
	// Enable ANGLE for application prior to start
	EnableAngle bool
	// The name of the pipe to connect/listen to.
	PipeName string
	// Name of the process to capture (non-empty to indicate a specific process)
	ProcessName string
	// Whether to load the Vulkan validation layer under our Spy layer
	LoadValidationLayer bool
}

Options to use when creating a capture.

type Process

type Process struct {
	// The local host port used to connect to GAPII.
	Port int

	// Information about the target device.
	Device bind.Device

	// The options used for the capture.
	Options Options
	// contains filtered or unexported fields
}

Process represents a running process to capture.

func Connect

func Connect(ctx context.Context, d adb.Device, abi *device.ABI, pipe string, o Options) (*Process, error)

Connect connects to an app that is already setup to trace. This is similar to Start(...), except that it skips some steps as it is assumed that the loading of libgapii is done manually and the app is waiting for a connection from the host.

func Start

Start launches an activity on an android device with the GAPII interceptor enabled using the gapid.apk built for the ABI matching the specified action and device. GAPII will attempt to connect back on the returned host port to write the trace.

func (*Process) Capture

func (p *Process) Capture(ctx context.Context, start task.Signal, stop task.Signal, ready task.Task, w io.Writer, written *int64) (size int64, err error)

Capture opens up the specified port and then waits for a capture to be delivered using the specified capture options o. It copies the capture into the supplied writer. If the process was started with the DeferStart flag, then tracing will wait until start is fired. Capturing will stop when the stop signal is fired (clean stop) or the context is cancelled (abort).

Jump to

Keyboard shortcuts

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