| 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/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 |  22   // These milestones of a process lifetime can be passed as process "mile- | 
|  23   // StackSmaplingProfile::SetProcessPhase(). Be sure to update the translation |  23   // stones" to StackSmaplingProfile::SetProcessMilestone(). Be sure to update | 
|  24   // constants at the top of the .cc file when this is changed. |  24   // the translation constants at the top of the .cc file when this is changed. | 
|  25   enum Phases : int { |  25   enum Milestones : int { | 
|  26     MAIN_LOOP_START, |  26     MAIN_LOOP_START, | 
|  27     MAIN_NAVIGATION_START, |  27     MAIN_NAVIGATION_START, | 
|  28     MAIN_NAVIGATION_FINISHED, |  28     MAIN_NAVIGATION_FINISHED, | 
|  29     FIRST_NONEMPTY_PAINT, |  29     FIRST_NONEMPTY_PAINT, | 
|  30  |  30  | 
|  31     SHUTDOWN_START, |  31     SHUTDOWN_START, | 
|  32  |  32  | 
|  33     PHASES_MAX_VALUE |  33     MILESTONES_MAX_VALUE | 
|  34   }; |  34   }; | 
|  35  |  35  | 
|  36   CallStackProfileMetricsProvider(); |  36   CallStackProfileMetricsProvider(); | 
|  37   ~CallStackProfileMetricsProvider() override; |  37   ~CallStackProfileMetricsProvider() override; | 
|  38  |  38  | 
|  39   // Get a callback for use with StackSamplingProfiler that provides completed |  39   // Get a callback for use with StackSamplingProfiler that provides completed | 
|  40   // profiles to this object. The callback should be immediately passed to the |  40   // profiles to this object. The callback should be immediately passed to the | 
|  41   // StackSamplingProfiler, and should not be reused between |  41   // StackSamplingProfiler, and should not be reused between | 
|  42   // StackSamplingProfilers. This function may be called on any thread. |  42   // StackSamplingProfilers. This function may be called on any thread. | 
|  43   static base::StackSamplingProfiler::CompletedCallback GetProfilerCallback( |  43   static base::StackSamplingProfiler::CompletedCallback GetProfilerCallback( | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
|  70   // Returns true if reporting of profiles is enabled according to the |  70   // Returns true if reporting of profiles is enabled according to the | 
|  71   // controlling Finch field trial. |  71   // controlling Finch field trial. | 
|  72   static bool IsReportingEnabledByFieldTrial(); |  72   static bool IsReportingEnabledByFieldTrial(); | 
|  73  |  73  | 
|  74   DISALLOW_COPY_AND_ASSIGN(CallStackProfileMetricsProvider); |  74   DISALLOW_COPY_AND_ASSIGN(CallStackProfileMetricsProvider); | 
|  75 }; |  75 }; | 
|  76  |  76  | 
|  77 }  // namespace metrics |  77 }  // namespace metrics | 
|  78  |  78  | 
|  79 #endif  // COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_ |  79 #endif  // COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_ | 
| OLD | NEW |