| 469 | } |
| 470 | |
| 471 | void AggregatedRuntimeProfile::UpdateSummaryStatsFromInstance( |
| 472 | RuntimeProfile* other, int idx) { |
| 473 | lock_guard<SpinLock> l(summary_stats_map_lock_); |
| 474 | lock_guard<SpinLock> m(other->summary_stats_map_lock_); |
| 475 | for (const RuntimeProfile::SummaryStatsCounterMap::value_type& src_entry : |
| 476 | other->summary_stats_map_) { |
| 477 | DCHECK_GT(num_input_profiles_, 0); |
| 478 | AggSummaryStatsCounterMap::mapped_type& agg_entry = |
| 479 | summary_stats_map_[src_entry.first]; |
| 480 | vector<SummaryStatsCounter*>& agg_instance_counters = agg_entry.second; |
| 481 | if (agg_instance_counters.empty()) { |
| 482 | agg_instance_counters.resize(num_input_profiles_); |
| 483 | agg_entry.first = src_entry.second->unit(); |
| 484 | } else { |
| 485 | DCHECK_EQ(agg_entry.first, src_entry.second->unit()) << "Unit must be consistent"; |
| 486 | } |
| 487 | |
| 488 | // Get the counter with the same name. Create one if it doesn't exist. |
| 489 | if (agg_instance_counters[idx] == nullptr) { |
| 490 | agg_instance_counters[idx] = |
| 491 | pool_->Add(new SummaryStatsCounter(src_entry.second->unit())); |
| 492 | } |
| 493 | // Overwrite the previous value with the new value. |
| 494 | agg_instance_counters[idx]->SetStats(*src_entry.second); |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | void AggregatedRuntimeProfile::UpdateEventSequencesFromInstance( |
| 499 | RuntimeProfile* other, int idx) { |