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

Side by Side Diff: components/metrics/public/cpp/call_stack_profile_struct_traits.h

Issue 2530043002: Set process phases in the StackSamplingProfiler. (Closed)
Patch Set: improved comment Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Defines StructTraits specializations for translating between mojo types and 5 // Defines StructTraits specializations for translating between mojo types and
6 // base::StackSamplingProfiler types, with data validity checks. 6 // base::StackSamplingProfiler types, with data validity checks.
7 7
8 #ifndef COMPONENTS_METRICS_CALL_STACK_PROFILE_STRUCT_TRAITS_H_ 8 #ifndef COMPONENTS_METRICS_CALL_STACK_PROFILE_STRUCT_TRAITS_H_
9 #define COMPONENTS_METRICS_CALL_STACK_PROFILE_STRUCT_TRAITS_H_ 9 #define COMPONENTS_METRICS_CALL_STACK_PROFILE_STRUCT_TRAITS_H_
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 75 }
76 }; 76 };
77 77
78 template <> 78 template <>
79 struct StructTraits<metrics::mojom::CallStackSampleDataView, 79 struct StructTraits<metrics::mojom::CallStackSampleDataView,
80 base::StackSamplingProfiler::Sample> { 80 base::StackSamplingProfiler::Sample> {
81 static const std::vector<base::StackSamplingProfiler::Frame>& frames( 81 static const std::vector<base::StackSamplingProfiler::Frame>& frames(
82 const base::StackSamplingProfiler::Sample& sample) { 82 const base::StackSamplingProfiler::Sample& sample) {
83 return sample.frames; 83 return sample.frames;
84 } 84 }
85 static int32_t process_phases( 85 static int32_t process_milestones(
86 const base::StackSamplingProfiler::Sample& sample) { 86 const base::StackSamplingProfiler::Sample& sample) {
87 return sample.process_phases; 87 return sample.process_milestones;
88 } 88 }
89 89
90 static bool Read(metrics::mojom::CallStackSampleDataView data, 90 static bool Read(metrics::mojom::CallStackSampleDataView data,
91 base::StackSamplingProfiler::Sample* out) { 91 base::StackSamplingProfiler::Sample* out) {
92 std::vector<base::StackSamplingProfiler::Frame> frames; 92 std::vector<base::StackSamplingProfiler::Frame> frames;
93 if (!data.ReadFrames(&frames)) 93 if (!data.ReadFrames(&frames))
94 return false; 94 return false;
95 95
96 *out = base::StackSamplingProfiler::Sample(); 96 *out = base::StackSamplingProfiler::Sample();
97 out->frames = std::move(frames); 97 out->frames = std::move(frames);
98 out->process_phases = data.process_phases(); 98 out->process_milestones = data.process_milestones();
99 return true; 99 return true;
100 } 100 }
101 }; 101 };
102 102
103 template <> 103 template <>
104 struct StructTraits<metrics::mojom::CallStackProfileDataView, 104 struct StructTraits<metrics::mojom::CallStackProfileDataView,
105 base::StackSamplingProfiler::CallStackProfile> { 105 base::StackSamplingProfiler::CallStackProfile> {
106 static const std::vector<base::StackSamplingProfiler::Module>& modules( 106 static const std::vector<base::StackSamplingProfiler::Module>& modules(
107 const base::StackSamplingProfiler::CallStackProfile& profile) { 107 const base::StackSamplingProfiler::CallStackProfile& profile) {
108 return profile.modules; 108 return profile.modules;
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 metrics::CallStackProfileParams::SampleOrderingSpec::PRESERVE_ORDER; 396 metrics::CallStackProfileParams::SampleOrderingSpec::PRESERVE_ORDER;
397 return true; 397 return true;
398 } 398 }
399 return false; 399 return false;
400 } 400 }
401 }; 401 };
402 402
403 } // mojo 403 } // mojo
404 404
405 #endif // COMPONENTS_METRICS_CALL_STACK_PROFILE_STRUCT_TRAITS_H_ 405 #endif // COMPONENTS_METRICS_CALL_STACK_PROFILE_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698