| 2083 | |
| 2084 | template <typename T> |
| 2085 | void RuntimeProfileBase::AveragedCounter::PrettyPrintImpl( |
| 2086 | const string& prefix, const string& name, Verbosity verbosity, ostream* s) const { |
| 2087 | Stats<T> stats = GetStats<T>(); |
| 2088 | (*s) << prefix << " - " << name << ": "; |
| 2089 | if (verbosity <= Verbosity::LEGACY || stats.num_vals == 1) { |
| 2090 | (*s) << PrettyPrinter::Print(stats.mean, unit_, true) << endl; |
| 2091 | return; |
| 2092 | } |
| 2093 | |
| 2094 | // For counters with <> 1 values, show summary stats and the values. |
| 2095 | (*s) << "mean=" << PrettyPrinter::Print(BitcastToInt64(stats.mean), unit_, true) |
| 2096 | << " min=" << PrettyPrinter::Print(BitcastToInt64(stats.min), unit_, true); |
| 2097 | if (verbosity >= Verbosity::EXTENDED) { |
| 2098 | (*s) << " p50=" << PrettyPrinter::Print(BitcastToInt64(stats.p50), unit_, true) |
| 2099 | << " p75=" << PrettyPrinter::Print(BitcastToInt64(stats.p75), unit_, true) |
| 2100 | << " p90=" << PrettyPrinter::Print(BitcastToInt64(stats.p90), unit_, true) |
| 2101 | << " p95=" << PrettyPrinter::Print(BitcastToInt64(stats.p95), unit_, true); |
| 2102 | } |
| 2103 | (*s) << " max=" << PrettyPrinter::Print(BitcastToInt64(stats.max), unit_, true) << endl; |
| 2104 | // Dump out individual values if we have FULL verbosity of with EXTENDED verbosity when |
| 2105 | // they are not all identical. |
| 2106 | if (verbosity >= Verbosity::FULL |
| 2107 | || (verbosity >= Verbosity::EXTENDED && stats.min != stats.max)) { |
| 2108 | (*s) << prefix << " ["; |
| 2109 | for (int i = 0; i < num_values_; ++i) { |
| 2110 | if (i != 0) { |
| 2111 | if (i % 8 == 0) { |
| 2112 | (*s) << ",\n" << prefix << " "; |
| 2113 | } else { |
| 2114 | (*s) << ", "; |
| 2115 | } |
| 2116 | } |
| 2117 | if (has_value_[i].Load()) { |
| 2118 | (*s) << PrettyPrinter::Print(values_[i].Load(), unit_, false); |
| 2119 | } else { |
| 2120 | (*s) << "_"; |
| 2121 | } |
| 2122 | } |
| 2123 | (*s) << "]\n"; |
| 2124 | } |
| 2125 | } |
| 2126 | |
| 2127 | void RuntimeProfileBase::AveragedCounter::ToJson( |
| 2128 | Verbosity verbosity, Document& document, Value* val) const { |
nothing calls this directly
no test coverage detected