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

Method SortChildrenByTotalTime

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

Source from the content-addressed store, hash-verified

1055}
1056
1057void RuntimeProfile::SortChildrenByTotalTime() {
1058 lock_guard<SpinLock> l(children_lock_);
1059 // Create a snapshot of total time values so that they don't change while we're
1060 // sorting. Sort the <total_time, index> pairs, then reshuffle children_.
1061 vector<pair<int64_t, int64_t>> total_times;
1062 total_times.reserve(children_.size());
1063 for (int i = 0; i < children_.size(); ++i) {
1064 total_times.emplace_back(children_[i].first->total_time_counter()->value(), i);
1065 }
1066 // Order by descending total time.
1067 sort(total_times.begin(), total_times.end(),
1068 [](const pair<int64_t, int64_t>& p1, const pair<int64_t, int64_t>& p2) {
1069 return p1.first > p2.first;
1070 });
1071 ChildVector new_children;
1072 new_children.reserve(total_times.size());
1073 for (const auto& p : total_times) new_children.emplace_back(children_[p.second]);
1074 children_ = move(new_children);
1075}
1076
1077void RuntimeProfileBase::AddInfoString(const string& key, const string& value) {
1078 return AddInfoStringInternal(key, value, false);

Callers 2

AddExecStatsMethod · 0.80
TESTFunction · 0.80

Calls 8

sortFunction · 0.85
moveFunction · 0.85
reserveMethod · 0.80
total_time_counterMethod · 0.80
sizeMethod · 0.45
valueMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

TESTFunction · 0.64