capture

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: Apache-2.0 Imports: 27 Imported by: 75

Documentation

Overview

Package capture contains all the core GAPIS functionality for dealing with loaded captures.

Index

Constants

View Source
const (
	// CurrentCaptureVersion is incremented on breaking changes to the capture format.
	// NB: Also update equally named field in spy_base.cpp
	CurrentCaptureVersion int32 = 3
)

Variables

This section is empty.

Functions

func Captures

func Captures() []*path.Capture

Captures returns all the captures stored by the database by identifier.

func Export

func Export(ctx context.Context, p *path.Capture, w io.Writer) error

Export encodes the given capture and associated resources and writes it to the supplied io.Writer in the pack file format, producing output suitable for use with Import or opening in the trace editor.

func Get

func Get(ctx context.Context) *path.Capture

Get retrieves the capture path from a context previously annotated by Put.

func Import

func Import(ctx context.Context, name string, src Source) (*path.Capture, error)

Import imports the capture by name and data, and stores it in the database.

func New

func New(ctx context.Context, c Capture) (*path.Capture, error)

New returns a path to a new capture stored in the database.

func NewState

func NewState(ctx context.Context) (*api.GlobalState, error)

NewState returns a new, default-initialized State object built for the capture held by the context.

func Put

Put attaches a capture path to a Context.

Types

type Capture

type Capture interface {
	// Name returns the name of the capture.
	Name() string
	// Service returns the service.Capture description for this capture.
	Service(ctx context.Context, p *path.Capture) *service.Capture
	// Export exports the capture in binary format to the given writer.
	Export(ctx context.Context, w io.Writer) error
}

Capture represents data from a trace.

func Resolve

func Resolve(ctx context.Context) (Capture, error)

Resolve resolves the capture from a context previously annotated by Put.

func ResolveFromID

func ResolveFromID(ctx context.Context, id id.ID) (Capture, error)

ResolveFromID resolves a single capture with the ID id.

func ResolveFromPath

func ResolveFromPath(ctx context.Context, p *path.Capture) (Capture, error)

ResolveFromPath resolves a single capture with the path p.

type ErrUnsupportedVersion added in v0.9.0

type ErrUnsupportedVersion struct{ Version int32 }

func (ErrUnsupportedVersion) Error added in v0.9.0

func (e ErrUnsupportedVersion) Error() string

type GraphicsCapture added in v1.4.0

type GraphicsCapture struct {
	Header       *Header
	Commands     []api.Cmd
	APIs         []api.API
	Observed     interval.U64RangeList
	InitialState *InitialState
	Arena        arena.Arena
	Messages     []*TraceMessage
	// contains filtered or unexported fields
}

func NewGraphicsCapture added in v1.4.0

func NewGraphicsCapture(ctx context.Context, a arena.Arena, name string, header *Header, initialState *InitialState, cmds []api.Cmd) (*GraphicsCapture, error)

NewGraphicsCapture returns a new to a new graphics capture with the given name, header and commands, using the arena a for allocations.

func ResolveGraphics added in v1.4.0

func ResolveGraphics(ctx context.Context) (*GraphicsCapture, error)

ResolveGraphics resolves the capture from a context previously annotated by Put, and ensures that it is a graphics capture.

func ResolveGraphicsFromID added in v1.4.0

func ResolveGraphicsFromID(ctx context.Context, id id.ID) (*GraphicsCapture, error)

ResolveGraphicsFromID resolves a single graphics capture with the ID id.

func ResolveGraphicsFromPath added in v1.4.0

func ResolveGraphicsFromPath(ctx context.Context, p *path.Capture) (*GraphicsCapture, error)

ResolveGraphicsFromPath resolves a single graphics capture with the path p.

func (*GraphicsCapture) CloneInitialState added in v1.4.0

func (c *GraphicsCapture) CloneInitialState(a arena.Arena) *InitialState

CloneInitialState clones this capture's initial state and returns it.

func (*GraphicsCapture) Export added in v1.4.0

func (c *GraphicsCapture) Export(ctx context.Context, w io.Writer) error

Export encodes the given capture and associated resources and writes it to the supplied io.Writer in the .gfxtrace format.

func (*GraphicsCapture) Name added in v1.4.0

func (g *GraphicsCapture) Name() string

Name returns the capture's name.

func (*GraphicsCapture) NewState added in v1.4.0

func (c *GraphicsCapture) NewState(ctx context.Context) *api.GlobalState

NewState returns a new, initialized GlobalState object built for the capture c. If the capture contains a mid-execution state, then this will be copied into the returned state.

func (*GraphicsCapture) NewUninitializedState added in v1.4.0

func (c *GraphicsCapture) NewUninitializedState(ctx context.Context) *api.GlobalState

NewUninitializedState returns a new, uninitialized GlobalState built for the capture c. The returned state does not contain the capture's mid-execution state.

func (*GraphicsCapture) Path added in v1.5.0

func (g *GraphicsCapture) Path(ctx context.Context) (*path.Capture, error)

Path returns the path of this capture in the database.

func (*GraphicsCapture) Service added in v1.4.0

func (c *GraphicsCapture) Service(ctx context.Context, p *path.Capture) *service.Capture

Service returns the service.Capture description for this capture.

type InitialState added in v0.9.6

type InitialState struct {
	Memory []api.CmdObservation
	APIs   map[api.API]api.State
}

type PerfettoCapture added in v1.6.0

type PerfettoCapture struct {
	Processor *perfetto.Processor
	// contains filtered or unexported fields
}

func ResolvePerfetto added in v1.6.0

func ResolvePerfetto(ctx context.Context) (*PerfettoCapture, error)

ResolvePerfetto resolves the capture from a context previously annotated by Put, and ensures that it is a perfetto capture.

func ResolvePerfettoFromID added in v1.6.0

func ResolvePerfettoFromID(ctx context.Context, id id.ID) (*PerfettoCapture, error)

ResolvePerfettoFromID resolves a single perfetto capture with the ID id.

func ResolvePerfettoFromPath added in v1.6.0

func ResolvePerfettoFromPath(ctx context.Context, p *path.Capture) (*PerfettoCapture, error)

ResolvePerfettoFromPath resolves a single perfetto capture with the path p.

func (*PerfettoCapture) Export added in v1.6.0

func (c *PerfettoCapture) Export(ctx context.Context, w io.Writer) error

func (*PerfettoCapture) Name added in v1.6.0

func (c *PerfettoCapture) Name() string

func (*PerfettoCapture) Service added in v1.6.0

func (c *PerfettoCapture) Service(ctx context.Context, p *path.Capture) *service.Capture

type Source added in v1.2.0

type Source interface {
	// ReadCloser returns an io.ReadCloser instance, from which capture data
	// can be read and closed after reading.
	ReadCloser() (io.ReadCloser, error)
	// Size returns the total size in bytes of this source.
	Size() (uint64, error)
}

Source represents the source of capture data.

Jump to

Keyboard shortcuts

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