service

package
v0.0.0-...-7a622f3 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package service is the definition of the RPC GPU debugger service exposed by the server.

It is not the actual implementation of the service functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FindHandler

type FindHandler func(*FindResponse) error

FindHandler is the handler of found items using Service.Find.

type ReportBuilder

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

ReportBuilder helps construct reports.

func NewReportBuilder

func NewReportBuilder() *ReportBuilder

NewReportBuilder creates and initializes new report builder.

func (*ReportBuilder) Add

func (b *ReportBuilder) Add(ctx context.Context, element *ReportItemRaw)

Add processes tags, adds references to item and adds item to report.

func (*ReportBuilder) Build

func (b *ReportBuilder) Build() *Report

Build performs final processing and returns report.

type ReportItemRaw

type ReportItemRaw struct {
	Item    *ReportItem
	Message *stringtable.Msg
	Tags    []*stringtable.Msg
}

ReportItemRaw represents ReportItem, raw message and array of raw tags.

func WrapReportItem

func WrapReportItem(item *ReportItem, m *stringtable.Msg) *ReportItemRaw

WrapReportItem wraps ReportItem into raw representation of ReportItemTagged which contains raw messages instead of references.

type Service

type Service interface {
	// Ping is a no-op function that returns immediately.
	// It can be used to measure connection latency or to keep the
	// process alive if started with the "idle-timeout" command line flag.
	Ping(ctx context.Context) error

	// GetServerInfo returns information about the running server.
	GetServerInfo(ctx context.Context) (*ServerInfo, error)

	// CheckForUpdates checks for a new build of AGI and ANGLE on the hosting servers.
	// Care should be taken to call this infrequently to avoid reaching the
	// server's maximum unauthenticated request limits.
	CheckForUpdates(ctx context.Context, includeDevReleases bool) (*Releases, error)

	// GetAvailableStringTables returns list of available string table descriptions.
	GetAvailableStringTables(ctx context.Context) ([]*stringtable.Info, error)

	// GetStringTable returns the requested string table.
	GetStringTable(ctx context.Context, info *stringtable.Info) (*stringtable.StringTable, error)

	// ImportCapture imports capture data emitted by the graphics spy, returning
	// the new capture identifier.
	ImportCapture(ctx context.Context, name string, data []uint8) (*path.Capture, error)

	// ExportCapture returns a capture's data that can be consumed by
	// ImportCapture or LoadCapture.
	ExportCapture(ctx context.Context, c *path.Capture) ([]byte, error)

	// LoadCapture imports capture data from a local file, returning the new
	// capture identifier.
	LoadCapture(ctx context.Context, path string) (*path.Capture, error)

	// SaveCapture saves the capture to a local file.
	SaveCapture(ctx context.Context, c *path.Capture, path string) error

	// ExportReplay saves replay commands and assets to file.
	ExportReplay(ctx context.Context, c *path.Capture, d *path.Device, path string, opts *ExportReplayOptions) error

	// DCECapture returns a new capture containing only the requested commands and their dependencies.
	DCECapture(ctx context.Context, capture *path.Capture, commands []*path.Command) (*path.Capture, error)

	GetGraphVisualization(ctx context.Context, capture *path.Capture, format GraphFormat) ([]byte, error)

	// GetDevices returns the full list of replay devices available to the server.
	// These include local replay devices and any connected Android devices.
	// This list may change over time, as devices are connected and disconnected.
	// If both connected Android and Local replay devices are found,
	// the local Android devices will be returned first.
	GetDevices(ctx context.Context) ([]*path.Device, error)

	// GetDevicesForReplay returns the list of replay devices available to the
	// server, and two matching lists to indicate the device compatibility to
	// replay the capture, and a message to clarify device incompatibilites.
	// The devices are sorted: the ones capable of replaying the given capture
	// always come first, followed by the ones that are not compatible.
	// These include local replay devices and any connected Android devices.
	// This list may change over time, as devices are connected and disconnected.
	// Among the compatible and incompatible devices sub-lists, if both connected
	// Android and Local replay devices are found, the local Android devices will
	// be returned first.
	GetDevicesForReplay(ctx context.Context, p *path.Capture) ([]*path.Device, []bool, []*stringtable.Msg, error)

	// Get resolves and returns the object, value or memory at the path p.
	Get(ctx context.Context, p *path.Any, c *path.ResolveConfig) (interface{}, error)

	// Set creates a copy of the capture referenced by p, but with the object, value
	// or memory at p replaced with v. The path returned is identical to p, but with
	// the base changed to refer to the new capture.
	Set(ctx context.Context, p *path.Any, v interface{}, c *path.ResolveConfig) (*path.Any, error)

	// Delete creates a copy of the capture referenced by p, but without the object, value
	// or memory at p. The path returned is identical to p, but with
	// the base changed to refer to the new capture.
	Delete(ctx context.Context, p *path.Any, c *path.ResolveConfig) (*path.Any, error)

	// Follow returns the path to the object that the value at p links to.
	// If the value at p does not link to anything then nil is returned.
	Follow(ctx context.Context, p *path.Any, c *path.ResolveConfig) (*path.Any, error)

	// Profile starts self-profiling of the server.
	// If pprof is not nil then CPU pprof data will be written to this writer
	// until stop is called.
	// If trace is not nil then chrome trace data will be written to this writer
	// until stop is called.
	// This is a debug API, and may be removed in the future.
	Profile(ctx context.Context, pprof, trace io.Writer, memorySnapshotInterval uint32) (stop func() error, err error)

	// Status starts resolving status events. It calls f for every update and m for every memory update.
	Status(ctx context.Context,
		snapshotInterval time.Duration,
		statusUpdateFrequency time.Duration,
		f func(*TaskUpdate),
		m func(*MemoryStatus),
		r func(*ReplayUpdate)) error

	// GetPerformanceCounters returns the values of all global counters as
	// a string.
	GetPerformanceCounters(ctx context.Context) (string, error)

	// GetProfile returns the pprof profile with the given name.
	GetProfile(ctx context.Context, name string, debug int32) ([]byte, error)

	// GetLogStream calls the handler with each log record raised until the
	// context is cancelled.
	GetLogStream(context.Context, log.Handler) error

	// Find performs a search using req, streaming the results to h.
	Find(ctx context.Context, req *FindRequest, h FindHandler) error

	// ClientEvent records a client event action, used for analytics.
	// If the user has not opted-in for analytics then this call does nothing.
	ClientEvent(ctx context.Context, req *ClientEventRequest) error

	// FindTraceTargets returns trace targets matching the given search parameters.
	FindTraceTargets(ctx context.Context, req *FindTraceTargetsRequest) ([]*TraceTargetTreeNode, error)

	// TraceTargetTreeNode returns a node in the trace target tree for the given device
	TraceTargetTreeNode(ctx context.Context, req *TraceTargetTreeNodeRequest) (*TraceTargetTreeNode, error)

	// Trace controls setting up, starting and ending a trace
	Trace(ctx context.Context) (TraceHandler, error)

	// Update the environment settings.
	UpdateSettings(ctx context.Context, req *UpdateSettingsRequest) error

	// Get timestamps from GPU for commands.
	GetTimestamps(ctx context.Context, req *GetTimestampsRequest, h TimeStampsHandler) error

	// Get timestamps from GPU for commands.
	GpuProfile(ctx context.Context, req *GpuProfileRequest) (*ProfilingData, error)

	// Run a perfetto query
	PerfettoQuery(ctx context.Context, c *path.Capture, query string) (*perfetto.QueryResult, error)

	// Split out a new capture containing a subset of another capture's commands.
	SplitCapture(ctx context.Context, rng *path.Commands) (*path.Capture, error)

	// TrimCaptureInitialState returns a new capture with an initial state
	// trimmed from resources not needed by the capture commands.
	TrimCaptureInitialState(ctx context.Context, p *path.Capture) (*path.Capture, error)

	// ValidateDevice validates the GPU profiling capabilities of the given device and returns
	// an error if validation failed or the GPU profiling data is invalid.
	ValidateDevice(ctx context.Context, d *path.Device) (*DeviceValidationResult, error)

	// InstallApp installs an application on the given device.
	InstallApp(ctx context.Context, d *path.Device, app string) error
}

type Severity

type Severity = severity.Severity
const (
	Severity_VerboseLevel Severity = 0
	Severity_DebugLevel   Severity = 1
	Severity_InfoLevel    Severity = 2
	Severity_WarningLevel Severity = 3
	Severity_ErrorLevel   Severity = 4
	Severity_FatalLevel   Severity = 5
)

type TimeStampsHandler

type TimeStampsHandler func(*GetTimestampsResponse) error

TimeStampsHandler is the handler of queried timestamps suing Service.GetTimestamps.

type TraceHandler

type TraceHandler interface {
	Initialize(context.Context, *TraceOptions) (*StatusResponse, error)
	Event(context.Context, TraceEvent) (*StatusResponse, error)
	Dispose(context.Context)
}

Directories

Path Synopsis
Package path contains types that represent data references.
Package path contains types that represent data references.

Jump to

Keyboard shortcuts

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