| 367 | } |
| 368 | |
| 369 | void AggregatedRuntimeProfile::UpdateAggregatedFromInstanceRecursive( |
| 370 | RuntimeProfile* other, int idx, bool add_default_counters) { |
| 371 | DCHECK(other != NULL); |
| 372 | DCHECK_GE(idx, 0); |
| 373 | DCHECK_LT(idx, num_input_profiles_); |
| 374 | |
| 375 | // Merge all counters and other items in the profile at this level. |
| 376 | UpdateCountersFromInstance(other, idx); |
| 377 | UpdateInfoStringsFromInstance(other, idx); |
| 378 | UpdateSummaryStatsFromInstance(other, idx); |
| 379 | UpdateEventSequencesFromInstance(other, idx); |
| 380 | |
| 381 | { |
| 382 | lock_guard<SpinLock> l(children_lock_); |
| 383 | lock_guard<SpinLock> m(other->children_lock_); |
| 384 | // Recursively merge children with matching names. |
| 385 | // Track the current position in the vector so we preserve the order of children |
| 386 | // if children are added after the first Update() call (IMPALA-6694). |
| 387 | // E.g. if the first update sends [B, D] and the second update sends [A, B, C, D], |
| 388 | // then this code makes sure that children_ is [A, B, C, D] afterwards. |
| 389 | ChildVector::iterator insert_pos = children_.begin(); |
| 390 | for (int i = 0; i < other->children_.size(); ++i) { |
| 391 | RuntimeProfile* other_child = |
| 392 | dynamic_cast<RuntimeProfile*>(other->children_[i].first); |
| 393 | DCHECK(other_child != nullptr) |
| 394 | << other->children_[i].first->name() << " must be a RuntimeProfile"; |
| 395 | bool indent_other_child = other->children_[i].second; |
| 396 | bool is_timed = add_default_counters && !UntimedProfileNode(other_child->name()); |
| 397 | AggregatedRuntimeProfile* child = |
| 398 | dynamic_cast<AggregatedRuntimeProfile*>(AddOrCreateChild( |
| 399 | other_child->name(), &insert_pos, |
| 400 | [this, other_child, is_timed]() { |
| 401 | AggregatedRuntimeProfile* child2 = Create(pool_, other_child->name(), |
| 402 | num_input_profiles_, /*is_root=*/false, is_timed); |
| 403 | child2->metadata_ = other_child->metadata(); |
| 404 | return child2; |
| 405 | }, |
| 406 | indent_other_child)); |
| 407 | DCHECK(child != nullptr); |
| 408 | child->UpdateAggregatedFromInstanceRecursive(other_child, idx, is_timed); |
| 409 | } |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | void AggregatedRuntimeProfile::UpdateCountersFromInstance( |
| 414 | RuntimeProfile* other, int idx) { |
nothing calls this directly
no test coverage detected