Skip to content

dispatch_output.h

Source: samples/common/dispatch/dispatch_output.h

Trace CSV writer, DOT graph output, and JSON serialization helpers.

Generic output utilities for dispatch graph runners. These do not depend on any sample-specific config struct; sample-specific output (e.g., config sections in summary JSON) should be handled locally by each sample.


Structs

TraceWriter

Thread-safe CSV writer for per-dispatch execution traces.

Writes one row per dispatch invocation with planned vs. actual timing columns. The header is written lazily on the first WriteRow() call.

Members

Name Type Description
mu std::mutex
f FILE *
wrote_header bool

Methods

Open(const char *path)

Open the trace file for writing.

Parameters:

Name Type Description
path const char * Output file path (must be non-null and non-empty).

Returns: True if the file was opened successfully.

Close()

Flush and close the trace file.

Write the CSV header row (idempotent).

WriteRow(int graph_iter, const DispatchNode &node, uint64_t planned_start_us, uint64_t ready_us, uint64_t start_us, uint64_t end_us)

Write a single dispatch trace row.

Parameters:

Name Type Description
graph_iter int Current graph iteration index.
node constDispatchNode& The dispatch node that was executed.
planned_start_us uint64_t Planned start time in microseconds.
ready_us uint64_t Time the node became ready (us).
start_us uint64_t Actual execution start time (us).
end_us uint64_t Actual execution end time (us).