OLD | NEW |
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 #ifndef COMPONENTS_METRICS_CALL_STACK_PROFILE_PARAMS_H_ | 5 #ifndef COMPONENTS_METRICS_CALL_STACK_PROFILE_PARAMS_H_ |
6 #define COMPONENTS_METRICS_CALL_STACK_PROFILE_PARAMS_H_ | 6 #define COMPONENTS_METRICS_CALL_STACK_PROFILE_PARAMS_H_ |
7 | 7 |
| 8 #include "base/time/time.h" |
| 9 |
8 namespace metrics { | 10 namespace metrics { |
9 | 11 |
10 // Parameters to pass back to the metrics provider. | 12 // Parameters to pass back to the metrics provider. |
11 struct CallStackProfileParams { | 13 struct CallStackProfileParams { |
12 // The process in which the collection occurred. | 14 // The process in which the collection occurred. |
13 enum Process { | 15 enum Process { |
14 UNKNOWN_PROCESS, | 16 UNKNOWN_PROCESS, |
15 BROWSER_PROCESS, | 17 BROWSER_PROCESS, |
16 RENDERER_PROCESS, | 18 RENDERER_PROCESS, |
17 GPU_PROCESS, | 19 GPU_PROCESS, |
(...skipping 24 matching lines...) Expand all Loading... |
42 RENDER_THREAD, | 44 RENDER_THREAD, |
43 UTILITY_THREAD | 45 UTILITY_THREAD |
44 }; | 46 }; |
45 | 47 |
46 // The event that triggered the profile collection. | 48 // The event that triggered the profile collection. |
47 enum Trigger { | 49 enum Trigger { |
48 UNKNOWN, | 50 UNKNOWN, |
49 PROCESS_STARTUP, | 51 PROCESS_STARTUP, |
50 JANKY_TASK, | 52 JANKY_TASK, |
51 THREAD_HUNG, | 53 THREAD_HUNG, |
52 TRIGGER_LAST = THREAD_HUNG | 54 PERIODIC_COLLECTION, |
| 55 TRIGGER_LAST = PERIODIC_COLLECTION |
53 }; | 56 }; |
54 | 57 |
55 // Allows the caller to specify whether sample ordering is | 58 // Allows the caller to specify whether sample ordering is |
56 // important. MAY_SHUFFLE should always be used to enable better compression, | 59 // important. MAY_SHUFFLE should always be used to enable better compression, |
57 // unless the use case needs order to be preserved for a specific reason. | 60 // unless the use case needs order to be preserved for a specific reason. |
58 enum SampleOrderingSpec { | 61 enum SampleOrderingSpec { |
59 // The provider may shuffle the sample order to improve compression. | 62 // The provider may shuffle the sample order to improve compression. |
60 MAY_SHUFFLE, | 63 MAY_SHUFFLE, |
61 // The provider will not change the sample order. | 64 // The provider will not change the sample order. |
62 PRESERVE_ORDER | 65 PRESERVE_ORDER |
63 }; | 66 }; |
64 | 67 |
65 // The default constructor is required for mojo and should not be used | 68 // The default constructor is required for mojo and should not be used |
66 // otherwise. A valid trigger should always be specified. | 69 // otherwise. A valid trigger should always be specified. |
67 CallStackProfileParams(); | 70 constexpr CallStackProfileParams() |
68 CallStackProfileParams(Process process, Thread thread, Trigger trigger); | 71 : CallStackProfileParams(UNKNOWN_PROCESS, UNKNOWN_THREAD, UNKNOWN) {} |
69 CallStackProfileParams(Process process, Thread thread, Trigger trigger, | 72 constexpr CallStackProfileParams(Process process, |
70 SampleOrderingSpec ordering_spec); | 73 Thread thread, |
| 74 Trigger trigger) |
| 75 : CallStackProfileParams(process, thread, trigger, MAY_SHUFFLE) {} |
| 76 constexpr CallStackProfileParams(Process process, |
| 77 Thread thread, |
| 78 Trigger trigger, |
| 79 SampleOrderingSpec ordering_spec) |
| 80 : process(process), |
| 81 thread(thread), |
| 82 trigger(trigger), |
| 83 ordering_spec(ordering_spec) {} |
71 | 84 |
72 // The collection process. | 85 // The collection process. |
73 Process process; | 86 Process process; |
74 | 87 |
75 // The collection thread. | 88 // The collection thread. |
76 Thread thread; | 89 Thread thread; |
77 | 90 |
78 // The triggering event. | 91 // The triggering event. |
79 Trigger trigger; | 92 Trigger trigger; |
80 | 93 |
81 // Whether to preserve sample ordering. | 94 // Whether to preserve sample ordering. |
82 SampleOrderingSpec ordering_spec; | 95 SampleOrderingSpec ordering_spec; |
| 96 |
| 97 // The time at which the CallStackProfileMetricsProvider became aware of the |
| 98 // request for profiling. In particular, this is when callback was requested |
| 99 // via CallStackProfileMetricsProvider::GetProfilerCallback(). Used to |
| 100 // determine if collection was disabled during the collection of the profile. |
| 101 base::TimeTicks start_timestamp; |
83 }; | 102 }; |
84 | 103 |
85 } // namespace metrics | 104 } // namespace metrics |
86 | 105 |
87 #endif // COMPONENTS_METRICS_CALL_STACK_PROFILE_PARAMS_H_ | 106 #endif // COMPONENTS_METRICS_CALL_STACK_PROFILE_PARAMS_H_ |
OLD | NEW |