Motivation
DumpToStream produces a human-readable ANSI table, but users often need to feed data into Python (pandas, matplotlib), R, or a Grafana dashboard. Without an export path they have to screen-scrape the report, which is fragile.
Proposed API
Two free functions / overloads in the Latte:: namespace:
// CSV: one row per sample, columns: thread_id, id_label, cycles, ns
void DumpCSV(std::ostream& out, Parameter unit = Parameter::Time);
// JSON: structured object per ID with raw array + summary stats
void DumpJSON(std::ostream& out, Parameter unit = Parameter::Time);
CSV format
id,thread,sample_ns
"order_send",0,482
"order_send",0,491
"order_send",1,478
JSON format
{
"order_send": {
"count": 3000,
"threads": [0, 2, 3, ...]
"samples_ns": [482, 491, 478, ...]
}
}
Acceptance Criteria
Motivation
DumpToStreamproduces a human-readable ANSI table, but users often need to feed data into Python (pandas, matplotlib), R, or a Grafana dashboard. Without an export path they have to screen-scrape the report, which is fragile.Proposed API
Two free functions / overloads in the
Latte::namespace:CSV format
JSON format
{ "order_send": { "count": 3000, "threads": [0, 2, 3, ...] "samples_ns": [482, 491, 478, ...] } }Acceptance Criteria
DumpCSV(ostream, unit)implemented using only<sstream>/<string>(no external deps)DumpJSON(ostream, unit)likewiseExtractRaw)Parameter::CalibratedflagLATTE_DISABLEstubs them out to no-opsLatte::DumpCSV(std::ofstream("out.csv"))