Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1514)

Unified Diff: components/metrics/call_stack_profile_metrics_provider.cc

Issue 2444143002: Add process lifetime annotations to stack samples. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/metrics/call_stack_profile_metrics_provider.cc
diff --git a/components/metrics/call_stack_profile_metrics_provider.cc b/components/metrics/call_stack_profile_metrics_provider.cc
index 3dc55b9ea6d00f0a571cd4bcbb528867f03f6a9f..d704a0645b466bf342ce4026cc735e867b991dfd 100644
--- a/components/metrics/call_stack_profile_metrics_provider.cc
+++ b/components/metrics/call_stack_profile_metrics_provider.cc
@@ -220,7 +220,7 @@ void CopySampleToProto(
const StackSamplingProfiler::Sample& sample,
const std::vector<StackSamplingProfiler::Module>& modules,
CallStackProfile::Sample* proto_sample) {
- for (const StackSamplingProfiler::Frame& frame : sample) {
+ for (const StackSamplingProfiler::Frame& frame : sample.frames) {
CallStackProfile::Entry* entry = proto_sample->add_entry();
// A frame may not have a valid module. If so, we can't compute the
// instruction pointer offset, and we don't want to send bare pointers, so
@@ -247,11 +247,21 @@ void CopyProfileToProto(
if (ordering_spec == CallStackProfileParams::PRESERVE_ORDER) {
// Collapse only consecutive repeated samples together.
CallStackProfile::Sample* current_sample_proto = nullptr;
+ int32_t phases = 0;
+ int32_t activities = 0;
for (auto it = profile.samples.begin(); it != profile.samples.end(); ++it) {
if (!current_sample_proto || *it != *(it - 1)) {
current_sample_proto = proto_profile->add_sample();
CopySampleToProto(*it, profile.modules, current_sample_proto);
current_sample_proto->set_count(1);
+ if (it->process_phases != phases) {
+ phases = it->process_phases;
+ current_sample_proto->set_process_phases(phases);
+ }
+ if (it->current_activities != activities) {
+ activities = it->current_activities;
+ current_sample_proto->set_current_activities(activities);
+ }
} else {
current_sample_proto->set_count(current_sample_proto->count() + 1);
}

Powered by Google App Engine
This is Rietveld 408576698