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

Method UpdateCountersFromInstance

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

Source from the content-addressed store, hash-verified

411}
412
413void AggregatedRuntimeProfile::UpdateCountersFromInstance(
414 RuntimeProfile* other, int idx) {
415 CounterMap::iterator dst_iter;
416 CounterMap::const_iterator src_iter;
417 unique_lock<SpinLock> l(counter_map_lock_);
418 unique_lock<SpinLock> m(other->counter_map_lock_);
419 for (src_iter = other->counter_map_.begin();
420 src_iter != other->counter_map_.end(); ++src_iter) {
421 dst_iter = counter_map_.find(src_iter->first);
422 AveragedCounter* avg_counter;
423
424 // Get the counter with the same name in dst_iter (this->counter_map_)
425 // Create one if it doesn't exist.
426 if (dst_iter == counter_map_.end()) {
427 avg_counter = pool_->Add(
428 new AveragedCounter(src_iter->second->unit(), num_input_profiles_));
429 counter_map_[src_iter->first] = avg_counter;
430 } else {
431 DCHECK(dst_iter->second->unit() == src_iter->second->unit());
432 avg_counter = static_cast<AveragedCounter*>(dst_iter->second);
433 }
434 avg_counter->UpdateCounter(src_iter->second, idx);
435 }
436
437 for (const auto& src_entry : other->time_series_counter_map_) {
438 RuntimeProfile::TimeSeriesCounter* src = src_entry.second;
439 TAggTimeSeriesCounter& dst = time_series_counter_map_[src_entry.first];
440 if (dst.values.empty()) {
441 dst.name = src_entry.first;
442 dst.unit = src->unit();
443 dst.period_ms.resize(num_input_profiles_);
444 dst.values.resize(num_input_profiles_);
445 dst.start_index.resize(num_input_profiles_);
446 } else {
447 DCHECK_EQ(dst.unit, src->unit());
448 }
449 // Use a temporary thrift counter so we can reuse the thrift conversion code.
450 TTimeSeriesCounter tcounter;
451 src->ToThrift(&tcounter);
452 dst.period_ms[idx] = tcounter.period_ms;
453 dst.values[idx] = tcounter.values;
454 dst.start_index[idx] = tcounter.start_index;
455 }
456
457 UpdateChildCountersLocked(l, other->child_counter_map_);
458}
459
460void AggregatedRuntimeProfile::UpdateInfoStringsFromInstance(
461 RuntimeProfile* other, int idx) {

Callers

nothing calls this directly

Calls 9

resizeMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
findMethod · 0.45
AddMethod · 0.45
unitMethod · 0.45
UpdateCounterMethod · 0.45
emptyMethod · 0.45
ToThriftMethod · 0.45

Tested by

no test coverage detected