client

package
v0.0.0-...-6c7272e Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 27 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 (
	// DisablePrecompiledShaders fakes no support for PCS, forcing the app to
	// share shader source.
	DisablePrecompiledShaders Flags = 0x00000001
	// RecordErrorState queries the driver error state after each all and stores
	// errors as extras.
	RecordErrorState Flags = 0x10000000
	// 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

	// GlesAPI is hard-coded bit mask for GLES API, it needs to be kept in sync
	// with the api_index in the gles.api file.
	GlesAPI = uint32(1 << 1)
	// 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)
	// GvrAPI is hard-coded bit mask for GVR API, it needs to be kept in sync
	// with the api_index in the gvr.api file.
	GvrAPI = uint32(1 << 3)
)

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 a framebuffer-observation will be made after every n draw calls.
	ObserveDrawFrequency 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
	// 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
	// The name of the pipe to connect/listen to.
	PipeName string
}

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