class TraceSession

Defined at line 40 of file ../../src/performance/trace_manager/trace_session.h

TraceSession keeps track of all TraceProvider instances that

are active for a tracing session.

Public Methods

void TraceSession (async::Executor & executor, std::shared_ptr<BufferForwarder> destination, std::vector<std::string> categories, size_t buffer_size_megabytes, fuchsia_tracing::BufferingMode buffering_mode, TraceProviderSpecMap && provider_specs, zx::duration start_timeout, zx::duration stop_timeout, fuchsia_tracing_controller::FxtVersion fxt_version, fit::closure abort_handler, AlertCallback alert_callback)

Initializes a new session that streams results to |destination|.

Every provider active in this session is handed |categories| and a vmo of size

|buffer_size_megabytes| when started.

|abort_handler| is invoked whenever the session encounters

unrecoverable errors that render the session dead.

Defined at line 20 of file ../../src/performance/trace_manager/trace_session.cc

void ~TraceSession ()

Frees all allocated resources and closes the outgoing

connection.

Defined at line 41 of file ../../src/performance/trace_manager/trace_session.cc

State state ()

For testing.

Defined at line 88 of file ../../src/performance/trace_manager/trace_session.h

void set_write_results_on_terminate (bool flag)

Defined at line 90 of file ../../src/performance/trace_manager/trace_session.h

void WriteTraceInfo ()

Writes all applicable trace info records.

These records are like a pre-amble to the trace, in particular they

provide a record at the start of the trace that when written to a file

can be used to identify the file as a Fuchsia Trace File.

Defined at line 471 of file ../../src/performance/trace_manager/trace_session.cc

void AddProvider (TraceProviderBundle * provider)

Initializes |provider| and adds it to this session.

Defined at line 47 of file ../../src/performance/trace_manager/trace_session.cc

void MarkInitialized ()

Called after all registered providers have been added.

Defined at line 121 of file ../../src/performance/trace_manager/trace_session.cc

void Terminate (fit::closure callback)

Terminates the trace.

Stops tracing first if necessary (see |Stop()|).

If terminating providers takes longer than |stop_timeout_|, we forcefully

terminate tracing and invoke |callback|.

Defined at line 123 of file ../../src/performance/trace_manager/trace_session.cc

void Start (fuchsia_tracing::BufferDisposition buffer_disposition, const std::vector<std::string> & additional_categories, StartTracingCallback callback)

Starts the trace.

Invokes |callback| when all providers in this session have

acknowledged the start request, or after |start_timeout_| has elapsed.

Defined at line 139 of file ../../src/performance/trace_manager/trace_session.cc

void Stop (bool write_results, StopTracingCallback callback)

Stops all providers that are part of this session, streams out

all remaining trace records and finally invokes |callback|.

If |write_results| is true then trace results are written after

providers stop (and a flag is set to clear buffer contents if tracing

starts again).

If stopping providers takes longer than |stop_timeout_|, we forcefully

stop tracing and invoke |callback|.

Defined at line 171 of file ../../src/performance/trace_manager/trace_session.cc

void RemoveDeadProvider (TraceProviderBundle * bundle)

Remove |provider|, it's dead Jim.

Defined at line 427 of file ../../src/performance/trace_manager/trace_session.cc

Enumerations

enum State
Name Value
kReady 0
kInitialized 1
kStarting 2
kStarted 3
kStopping 4
kStopped 5
kTerminating 6

Defined at line 42 of file ../../src/performance/trace_manager/trace_session.h

Friends

std::ostream & TraceSession (std::ostream & outTraceSession::State state)