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

Method ComputeMean

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

Source from the content-addressed store, hash-verified

2028
2029template <typename T>
2030int64_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
2046template <typename T>
2047RuntimeProfileBase::AveragedCounter::Stats<T>

Callers

nothing calls this directly

Calls 2

BitcastToInt64Function · 0.85
LoadMethod · 0.45

Tested by

no test coverage detected