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

Side by Side Diff: components/metrics/call_stack_profile_metrics_provider.h

Issue 2444143002: Add process lifetime annotations to stack samples. (Closed)
Patch Set: addressed review comments and finished converting tests Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_ 5 #ifndef COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_
6 #define COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_ 6 #define COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/profiler/stack_sampling_profiler.h" 12 #include "base/profiler/stack_sampling_profiler.h"
13 #include "components/metrics/call_stack_profile_params.h" 13 #include "components/metrics/call_stack_profile_params.h"
14 #include "components/metrics/metrics_provider.h" 14 #include "components/metrics/metrics_provider.h"
15 15
16 namespace metrics { 16 namespace metrics {
17 class ChromeUserMetricsExtension; 17 class ChromeUserMetricsExtension;
18 18
19 // Performs metrics logging for the stack sampling profiler. 19 // Performs metrics logging for the stack sampling profiler.
20 class CallStackProfileMetricsProvider : public MetricsProvider { 20 class CallStackProfileMetricsProvider : public MetricsProvider {
21 public: 21 public:
22 // These phases of a process lifetime can be passed as process "phases" to
23 // StackSmaplingProfile::SetProcessPhase(). Be sure to update the translation
24 // constants at the top of the .cc file when this is changed.
25 enum Phases : int {
26 MAIN_LOOP_START,
27 MAIN_NAVIGATION_START,
28 MAIN_NAVIGATION_FINISHED,
29 FIRST_NONEMPTY_PAINT,
30
31 SHUTDOWN_START,
32
33 PHASES_MAX_VALUE
34 };
35
36 // These common activities that occur within the browser lifetime can be
37 // passed to StackSmaplingProfile::ProcessActivityBegin/End(). Be sure to
38 // update the translation constants at the top of the .cc file when this is
39 // changed.
40 enum Activities : int {
Alexei Svitkine (slow) 2016/11/16 19:10:24 Nit: Remove from this CL.
bcwhite 2016/11/16 23:10:49 Doh! I thought I got them all. <sigh> Done.
Mike Wittman 2016/11/17 17:23:21 Also update the CL description.
bcwhite 2016/11/17 17:43:19 Done.
41 COLLECTING_METRICS,
42 WRITING_PROFILES_STATE,
43
44 ACTIVITIES_MAX_VALUE
45 };
46
22 CallStackProfileMetricsProvider(); 47 CallStackProfileMetricsProvider();
23 ~CallStackProfileMetricsProvider() override; 48 ~CallStackProfileMetricsProvider() override;
24 49
25 // Get a callback for use with StackSamplingProfiler that provides completed 50 // Get a callback for use with StackSamplingProfiler that provides completed
26 // profiles to this object. The callback should be immediately passed to the 51 // profiles to this object. The callback should be immediately passed to the
27 // StackSamplingProfiler, and should not be reused between 52 // StackSamplingProfiler, and should not be reused between
28 // StackSamplingProfilers. This function may be called on any thread. 53 // StackSamplingProfilers. This function may be called on any thread.
29 static base::StackSamplingProfiler::CompletedCallback GetProfilerCallback( 54 static base::StackSamplingProfiler::CompletedCallback GetProfilerCallback(
30 const CallStackProfileParams& params); 55 const CallStackProfileParams& params);
31 56
(...skipping 24 matching lines...) Expand all
56 // Returns true if reporting of profiles is enabled according to the 81 // Returns true if reporting of profiles is enabled according to the
57 // controlling Finch field trial. 82 // controlling Finch field trial.
58 static bool IsReportingEnabledByFieldTrial(); 83 static bool IsReportingEnabledByFieldTrial();
59 84
60 DISALLOW_COPY_AND_ASSIGN(CallStackProfileMetricsProvider); 85 DISALLOW_COPY_AND_ASSIGN(CallStackProfileMetricsProvider);
61 }; 86 };
62 87
63 } // namespace metrics 88 } // namespace metrics
64 89
65 #endif // COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_ 90 #endif // COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698