class TraceReader
Defined at line 37 of file ../../zircon/system/ulib/trace-reader/include/trace-reader/reader.h
Reads trace records.
The input is a collection of |Chunk| objects (see class Chunk below).
One use-case is reading records across an entire trace, which means across
multiple providers, and makes no assumptions about the ordering of records
it receives other than requiring objects referenced by ID (threads, strings)
are defined before they are used. Note that as a consequence of this, one
|TraceReader| class will maintain state of reading the entire trace: it
generally doesn't work to create multiple |TraceReader| classes for one
trace.
Public Methods
void TraceReader (RecordConsumer record_consumer, ErrorHandler error_handler)
Defined at line 58 of file ../../zircon/system/ulib/trace-reader/reader.cc
void ~TraceReader ()
Since this class holds a std::unique_ptr
<ProviderInfo
> -- which is forward-declared
here -- the destructor must be defined in the implementation file, where it has
access to the actual ProviderInfo definition.
Defined at line 65 of file ../../zircon/system/ulib/trace-reader/reader.cc
bool ReadRecords (Chunk & chunk)
Reads as many records as possible from the chunk, invoking the
record consumer for each one. Returns true if the stream could possibly
contain more records if the chunk were extended with new data.
Returns false if the trace stream is irrecoverably corrupt and no
further decoding is possible. May be called repeatedly with new
chunks as they become available to resume decoding.
Defined at line 67 of file ../../zircon/system/ulib/trace-reader/reader.cc
const ErrorHandler & error_handler ()
Defined at line 87 of file ../../zircon/system/ulib/trace-reader/include/trace-reader/reader.h
ProviderId current_provider_id ()
Gets the current trace provider id.
Returns 0 if no providers have been registered yet.
The stream of trace data typically looks like this:
<provider
_id record>
data associated with the provider
...
<provider
_id record>
data associated with the provider
...
When tracing is run in oneshot mode, a trace reader will see one block like the above per
provider.
In streaming mode, however, trace readers get one
<id
record, data...> per provider transfer.
NB: The provider records can straddle chunk boundaries, since chunk size is reader-defined.
Defined at line 1081 of file ../../zircon/system/ulib/trace-reader/reader.cc
const std::string & current_provider_name ()
Gets the name of the current trace provider.
Returns an empty string if the current provider id is 0.
Defined at line 1083 of file ../../zircon/system/ulib/trace-reader/reader.cc
std::string GetProviderName (ProviderId id)
Gets the name of the specified provider, or an empty string if there is
no such provider.
Defined at line 974 of file ../../zircon/system/ulib/trace-reader/reader.cc
Protected Methods
void ReportError (std::string_view error)
Defined at line 1076 of file ../../zircon/system/ulib/trace-reader/reader.cc