| 2028 | |
| 2029 | template <typename T> |
| 2030 | int64_t RuntimeProfileBase::AveragedCounter::ComputeMean() const { |
| 2031 | // Compute the mean in a single pass over the input. We could instead call GetStats(), |
| 2032 | // but this would add some additional overhead when serializing thrift profiles, which |
| 2033 | // include the mean counter values. |
| 2034 | T sum = 0; |
| 2035 | int num_vals = 0; |
| 2036 | for (int i = 0; i < num_values_; ++i) { |
| 2037 | if (has_value_[i].Load()) { |
| 2038 | sum += BitcastFromInt64<T>(values_[i].Load()); |
| 2039 | ++num_vals; |
| 2040 | } |
| 2041 | } |
| 2042 | if (num_vals == 0) return 0; // Avoid divide-by-zero. |
| 2043 | return BitcastToInt64(sum / num_vals); |
| 2044 | } |
| 2045 | |
| 2046 | template <typename T> |
| 2047 | RuntimeProfileBase::AveragedCounter::Stats<T> |
nothing calls this directly
no test coverage detected