| 105 | |
| 106 | template <typename T> |
| 107 | NJson::TJsonValue ToJson(const THistogram<T>& hist, const TVector<double>& percentiles) { |
| 108 | NJson::TJsonValue json; |
| 109 | |
| 110 | for (double percentile : percentiles) { |
| 111 | TStringBuilder name; |
| 112 | name << "Q" << Prec(percentile * 100, PREC_POINT_DIGITS_STRIP_ZEROES, 2); |
| 113 | json[name] = hist.ValueAtPercentile(percentile); |
| 114 | } |
| 115 | |
| 116 | json["RecordCount"] = hist.TotalCount(); |
| 117 | |
| 118 | return json; |
| 119 | } |
| 120 | |
| 121 | template <typename T> |
| 122 | NJson::TJsonValue ToJson(const THashMap<TString, THistogram<T>>& hists, const TVector<double>& percentiles) { |
no test coverage detected