| OLD | NEW |
| 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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/profiler/stack_sampling_profiler.h" | 11 #include "base/profiler/stack_sampling_profiler.h" |
| 12 #include "components/metrics/metrics_provider.h" | 12 #include "components/metrics/metrics_provider.h" |
| 13 | 13 |
| 14 namespace metrics { | 14 namespace metrics { |
| 15 class ChromeUserMetricsExtension; | 15 class ChromeUserMetricsExtension; |
| 16 | 16 |
| 17 // Performs metrics logging for the stack sampling profiler. | 17 // Performs metrics logging for the stack sampling profiler. |
| 18 class CallStackProfileMetricsProvider : public MetricsProvider { | 18 class CallStackProfileMetricsProvider : public MetricsProvider { |
| 19 public: | 19 public: |
| 20 // The event that triggered the profile collection. | 20 // The event that triggered the profile collection. |
| 21 // This enum should be kept in sync with content/common/profiled_stack_state.h |
| 21 enum Trigger { | 22 enum Trigger { |
| 22 UNKNOWN, | 23 UNKNOWN, |
| 23 PROCESS_STARTUP, | 24 PROCESS_STARTUP, |
| 24 JANKY_TASK, | 25 JANKY_TASK, |
| 25 THREAD_HUNG | 26 THREAD_HUNG, |
| 27 TRIGGER_LAST = THREAD_HUNG |
| 26 }; | 28 }; |
| 27 | 29 |
| 28 // Parameters to pass back to the metrics provider. | 30 // Parameters to pass back to the metrics provider. |
| 29 struct Params { | 31 struct Params { |
| 30 explicit Params(Trigger trigger); | 32 explicit Params(Trigger trigger); |
| 31 Params(Trigger trigger, bool preserve_sample_ordering); | 33 Params(Trigger trigger, bool preserve_sample_ordering); |
| 32 | 34 |
| 33 // The triggering event. | 35 // The triggering event. |
| 34 Trigger trigger; | 36 Trigger trigger; |
| 35 | 37 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // Returns true if reporting of profiles is enabled according to the | 73 // Returns true if reporting of profiles is enabled according to the |
| 72 // controlling Finch field trial. | 74 // controlling Finch field trial. |
| 73 static bool IsReportingEnabledByFieldTrial(); | 75 static bool IsReportingEnabledByFieldTrial(); |
| 74 | 76 |
| 75 DISALLOW_COPY_AND_ASSIGN(CallStackProfileMetricsProvider); | 77 DISALLOW_COPY_AND_ASSIGN(CallStackProfileMetricsProvider); |
| 76 }; | 78 }; |
| 77 | 79 |
| 78 } // namespace metrics | 80 } // namespace metrics |
| 79 | 81 |
| 80 #endif // COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_ | 82 #endif // COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_ |
| OLD | NEW |