| 179 | } |
| 180 | |
| 181 | int64_t LatencyRecorder::qps(time_t window_size) const { |
| 182 | detail::Sample<Stat> s; |
| 183 | _latency_window.get_span(window_size, &s); |
| 184 | // Use floating point to avoid overflow. |
| 185 | if (s.time_us <= 0) { |
| 186 | return 0; |
| 187 | } |
| 188 | return detail::double_to_random_int(s.data.num * 1000000.0 / s.time_us); |
| 189 | } |
| 190 | |
| 191 | int LatencyRecorder::expose(const butil::StringPiece& prefix1, |
| 192 | const butil::StringPiece& prefix2) { |