Documentation ¶
Overview ¶
Package tracing contains shared functionalities for Perfetto system tracing tests.
Index ¶
- Constants
- func CheckTracingServices(ctx context.Context) (tracedPID, tracedProbesPID int, err error)
- func TraceProcessor() string
- type Session
- func (sess *Session) RemoveTraceResultFile()
- func (sess *Session) RunMetrics(ctx context.Context, traceProcessorPath string, metrics []string) (*perfetto_proto.TraceMetrics, error)
- func (sess *Session) RunQuery(ctx context.Context, traceProcessorPath, queryPath string) ([][]string, error)
- func (sess *Session) Stop() error
- func (sess *Session) Wait() error
Constants ¶
const ( // TraceConfigFile is the data path of the trace config file in text proto format. TraceConfigFile = "perfetto/system_trace_cfg.pbtxt" // TBMTracedProbesConfigFile is the data path of the TBM traced probes config file in text proto format. TBMTracedProbesConfigFile = "perfetto/perfetto_tbm_traced_probes.pbtxt" // TracedJobName is the upstart job names of the Perfetto system tracing service daemon (traced). TracedJobName = "traced" // TracedProbesJobName is the upstart job name of the Perfetto system tracing probes (traced_probes). TracedProbesJobName = "traced_probes" // TraceProcessorAmd64 is the name of tps for architecture: amd64. TraceProcessorAmd64 = "trace_processor_shell-amd64" // TraceProcessorArm is the name of tps for architecture: arm. TraceProcessorArm = "trace_processor_shell-arm" // TraceProcessorArm64 is the name of tps for architecture: arm64. TraceProcessorArm64 = "trace_processor_shell-arm64" )
Variables ¶
This section is empty.
Functions ¶
func CheckTracingServices ¶
CheckTracingServices checks the status of job traced and traced_probes. Returns the traced and traced_probes process IDs on success or an error if either job is not in the running state, or either jobs has crashed (and remains in the zombie process status.
func TraceProcessor ¶
func TraceProcessor() string
TraceProcessor returns the TraceProcessor name could be used on the DUT's architecture. Developers should also add the TraceProcessor name in their tests' Data.
Types ¶
type Session ¶
Session stores the cmd and the result file of the trace. Remember to call Session.RemoveTraceResultFile to clean up the temporary file.
func StartSession ¶
StartSession starts a system-wide trace using the perfetto command line tool in the background, and return the PID in string, which the caller should use to call StopTraceDataWithPID. On success, returns the temporary file of the trace data. It's the caller's responsibility for removing it if it's no longer needed.
func StartSessionAndWaitUntilDone ¶
StartSessionAndWaitUntilDone collects a system-wide trace using the perfetto command line tool. On success, returns the temporary file of the trace data. It's the caller's responsibility for removing it if it's no longer needed.
func (*Session) RemoveTraceResultFile ¶
func (sess *Session) RemoveTraceResultFile()
RemoveTraceResultFile removes the temp file of trace result.
func (*Session) RunMetrics ¶
func (sess *Session) RunMetrics(ctx context.Context, traceProcessorPath string, metrics []string) (*perfetto_proto.TraceMetrics, error)
RunMetrics collects the result with trace_processor_shell.
func (*Session) RunQuery ¶
func (sess *Session) RunQuery(ctx context.Context, traceProcessorPath, queryPath string) ([][]string, error)
RunQuery processes the trace data with a SQL query and returns the query csv result as [][]string.