| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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_BROWSER_WATCHER_WATCHER_METRICS_PROVIDER_WIN_H_ | 5 #ifndef COMPONENTS_BROWSER_WATCHER_WATCHER_METRICS_PROVIDER_WIN_H_ |
| 6 #define COMPONENTS_BROWSER_WATCHER_WATCHER_METRICS_PROVIDER_WIN_H_ | 6 #define COMPONENTS_BROWSER_WATCHER_WATCHER_METRICS_PROVIDER_WIN_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "components/metrics/metrics_provider.h" | 10 #include "components/metrics/metrics_provider.h" |
| 11 | 11 |
| 12 namespace browser_watcher { | 12 namespace browser_watcher { |
| 13 | 13 |
| 14 // Provides stability data captured by the Chrome Watcher, namely the browser | 14 // Provides stability data captured by the Chrome Watcher, namely the browser |
| 15 // process exit codes, as well as exit funnel metrics. | 15 // process exit codes, as well as exit funnel metrics. |
| 16 // The exit funnel records a trace of named, timed events in registry per | 16 // The exit funnel records a trace of named, timed events in registry per |
| 17 // process. For reporting, the trace is recorded as a sequence of events | 17 // process. For reporting, the trace is recorded as a sequence of events |
| 18 // named Stability.ExitFunnel.<eventname>, associated to the time | 18 // named Stability.ExitFunnel.<eventname>, associated to the time |
| 19 // (in milliseconds) from first event in a trace. For a normal process exit, | 19 // (in milliseconds) from first event in a trace. For a normal process exit, |
| 20 // the sequence might look like this: | 20 // the sequence might look like this: |
| 21 // - Stability.ExitFunnel.Logoff: 0 | 21 // - Stability.ExitFunnel.Logoff: 0 |
| 22 // - Stability.ExitFunnel.NotifyShutdown: 10 | 22 // - Stability.ExitFunnel.NotifyShutdown: 10 |
| 23 // - Stability.ExitFunnel.EndSession: 20 | 23 // - Stability.ExitFunnel.EndSession: 20 |
| 24 // - Stability.ExitFunnel.KillProcess: 30 | 24 // - Stability.ExitFunnel.KillProcess: 30 |
| 25 class WatcherMetricsProviderWin : public metrics::MetricsProvider { | 25 class WatcherMetricsProviderWin : public metrics::MetricsProvider { |
| 26 public: | 26 public: |
| 27 static const char kBrowserExitCodeHistogramName[]; | 27 static const char kBrowserExitCodeHistogramName[]; |
| 28 static const char kExitFunnelHistogramPrefix[]; | 28 static const char kExitFunnelHistogramPrefix[]; |
| 29 | 29 |
| 30 explicit WatcherMetricsProviderWin(const base::char16* registry_path); | 30 // Initializes the reporter. If |report_exit_funnels| is false, the provider |
| 31 // will clear the registry data, but not report it. |
| 32 WatcherMetricsProviderWin(const base::char16* registry_path, |
| 33 bool report_exit_funnels); |
| 31 ~WatcherMetricsProviderWin(); | 34 ~WatcherMetricsProviderWin(); |
| 32 | 35 |
| 33 // metrics::MetricsProvider implementation. | 36 // metrics::MetricsProvider implementation. |
| 34 virtual void ProvideStabilityMetrics( | 37 virtual void ProvideStabilityMetrics( |
| 35 metrics::SystemProfileProto* system_profile_proto) override; | 38 metrics::SystemProfileProto* system_profile_proto) override; |
| 36 | 39 |
| 37 private: | 40 private: |
| 38 base::string16 registry_path_; | 41 base::string16 registry_path_; |
| 42 bool report_exit_funnels_; |
| 39 | 43 |
| 40 DISALLOW_COPY_AND_ASSIGN(WatcherMetricsProviderWin); | 44 DISALLOW_COPY_AND_ASSIGN(WatcherMetricsProviderWin); |
| 41 }; | 45 }; |
| 42 | 46 |
| 43 } // namespace browser_watcher | 47 } // namespace browser_watcher |
| 44 | 48 |
| 45 #endif // COMPONENTS_BROWSER_WATCHER_WATCHER_METRICS_PROVIDER_WIN_H_ | 49 #endif // COMPONENTS_BROWSER_WATCHER_WATCHER_METRICS_PROVIDER_WIN_H_ |
| OLD | NEW |