Unverified Commit d84ba761 authored by Ge Jun's avatar Ge Jun Committed by GitHub

Merge pull request #446 from ipconfigme/master

merge from baidu, fix some typo and bvar bug
parents 9275f4d5 23cd6703
......@@ -259,7 +259,7 @@ public:
private:
template <typename _Map, typename _Element> friend class FlatMapIterator;
template <typename _Map, typename _Element> friend class FlatMapSparseIterator;
template <typename _Map, typename _Element> friend class SparseFlatMapIterator;
// True if buckets need to be resized before holding `size' elements.
inline bool is_too_crowded(size_t size) const
{ return size * 100 >= _nbucket * _load_factor; }
......
......@@ -265,6 +265,8 @@ void LatencyRecorder::hide() {
_latency_p3.hide();
_latency_999.hide();
_latency_9999.hide();
_latency_cdf.hide();
_latency_percentiles.hide();
}
LatencyRecorder& LatencyRecorder::operator<<(int64_t latency) {
......
......@@ -35,16 +35,19 @@ struct Stat {
int64_t num;
int64_t get_average_int() const {
if (num == 0) {
//num can be changed by sampling thread, use tmp_num
int64_t tmp_num = num;
if (tmp_num == 0) {
return 0;
}
return sum / (int64_t)num;
return sum / (int64_t)tmp_num;
}
double get_average_double() const {
if (num == 0) {
int64_t tmp_num = num;
if (tmp_num == 0) {
return 0.0;
}
return (double)sum / (double)num;
return (double)sum / (double)tmp_num;
}
Stat operator-(const Stat& rhs) const {
return Stat(sum - rhs.sum, num - rhs.num);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment