Phosphor
|
#include <export.h>
Public Member Functions | |
JSONExport (const TraceContext &_context) | |
size_t | read (char *out, size_t length) |
StringPtr | read (size_t length) |
StringPtr | read () |
bool | done () |
Protected Types | |
enum | State { opening, first_event, other_events, first_thread, other_threads, footer, dead } |
Protected Attributes | |
const TraceContext & | context |
TraceBuffer::event_iterator | it |
std::unordered_map< uint64_t, std::string >::const_iterator | tit |
State | state = State::opening |
std::string | cache |
The JSONExport class is a tool provided to allow exporting a TraceBuffer in the Chromium Tracing JSON format in a chunked manner (e.g. for over the network).
Usage:
auto buffer = phosphor::TraceLog::instance().getBuffer(); JSONExport exporter(*buffer); do { p = exporter.read(80); std::cerr << p; } while(p.size());
The above will write the JSON to stderr.
phosphor::tools::JSONExport::JSONExport | ( | const TraceContext & | _context | ) |
Creates the export object
bool phosphor::tools::JSONExport::done | ( | ) |
size_t phosphor::tools::JSONExport::read | ( | char * | out, |
size_t | length | ||
) |
Read 'length' worth of JSON
out | roughly 'length' bytes of the JSON starting from the point that was previously left off. This will return less than 'length' at the end of the buffer. |
length | Max size in bytes of the JSON to put into out |
StringPtr phosphor::tools::JSONExport::read | ( | size_t | length | ) |
Read 'length' worth of JSON
StringPtr phosphor::tools::JSONExport::read | ( | ) |
Read entire buffer's worth of JSON