MCPcopy Create free account
hub / github.com/apache/impala / PrettyPrintTimeSeries

Function PrettyPrintTimeSeries

be/src/util/runtime-profile.cc:1501–1520  ·  view source on GitHub ↗

Helper to pretty-print the data for a time series counter. 'num' is the number of values in 'samples'. The format is as follow: - ( ): , ,

Source from the content-addressed store, hash-verified

1499// The format is as follow:
1500// - <Label> (<period>): <val1>, <val2>, <etc>
1501static void PrettyPrintTimeSeries(const string& label, const int64_t* samples, int num,
1502 int period_ms, const string& prefix, TUnit::type unit, ostream* s) {
1503 ostream& stream = *s;
1504 if (num == 0) return;
1505 // Clamp number of printed values at 64, the maximum number of values in the
1506 // SamplingTimeSeriesCounter.
1507 int step = 1 + (num - 1) / 64;
1508 period_ms *= step;
1509 stream << prefix << " - " << label << " ("
1510 << PrettyPrinter::Print(period_ms * 1000000L, TUnit::TIME_NS) << "): ";
1511 for (int i = 0; i < num; i += step) {
1512 stream << PrettyPrinter::Print(samples[i], unit);
1513 if (i + step < num) stream << ", ";
1514 }
1515 if (step > 1) {
1516 stream << " (Showing " << ((num + 1) / step) << " of " << num << " values from "
1517 "Thrift Profile)";
1518 }
1519 stream << endl;
1520}
1521
1522void RuntimeProfileBase::PrettyPrintTimeline(ostream* s, const string& prefix,
1523 const string& name, int64_t duration,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected