| 1994 | } |
| 1995 | |
| 1996 | void RuntimeProfileBase::AveragedCounter::UpdateCounter(Counter* new_counter, int idx) { |
| 1997 | DCHECK_EQ(new_counter->unit(), unit_); |
| 1998 | DCHECK_GE(idx, 0); |
| 1999 | DCHECK_LT(idx, num_values_); |
| 2000 | if (unit_ == TUnit::DOUBLE_VALUE) { |
| 2001 | double new_val = new_counter->double_value(); |
| 2002 | values_[idx].Store(BitcastToInt64(new_val)); |
| 2003 | } else { |
| 2004 | values_[idx].Store(new_counter->value()); |
| 2005 | } |
| 2006 | // Set has_value_ after the value is valid above so that readers won't |
| 2007 | // see invalid values. |
| 2008 | has_value_[idx].Store(true); |
| 2009 | } |
| 2010 | |
| 2011 | void RuntimeProfileBase::AveragedCounter::Update(int start_idx, |
| 2012 | const vector<bool>& has_value, const vector<int64_t>& values) { |