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

Side by Side Diff: chrome/browser/metrics/renderer_uptime_tracker.h

Issue 2697323004: Adds UMA metrics for renderer uptime (Closed)
Patch Set: fix Created 3 years, 10 months 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_METRICS_RENDERER_UPTIME_TRACKER_H_
6 #define CHROME_BROWSER_METRICS_RENDERER_UPTIME_TRACKER_H_
7
8 #include <map>
9
10 #include "base/time/time.h"
11
12 // ChromeStabilityMetricsProvider gathers and logs Chrome-specific stability-
13 // related metrics.
14 class RendererUptimeTracker {
15 public:
16 // Creates the |RendererUptimeTracker| instance and initializes the
17 // observers that notify to it.
18 static void Initialize();
19
20 // Returns true if the |RendererUptimeTracker| instance has been
21 // created.
22 static bool IsInitialized();
23
24 // Returns the |RendererUptimeTracker| instance.
25 static RendererUptimeTracker* Get();
26
27 void OnRendererStarted(int pid);
28 void OnRendererTerminated(int pid);
29 void OnLoadInMainFrame(int pid);
30
31 protected:
32 RendererUptimeTracker();
33 ~RendererUptimeTracker();
34
35 struct RendererInfo {
36 base::TimeTicks launched_at_;
37 int num_loads_;
38 int num_loads_in_main_frame_;
39 };
40
41 private:
42 std::map<int, RendererInfo> info_map_;
43
44 DISALLOW_COPY_AND_ASSIGN(RendererUptimeTracker);
45 };
46
47 #endif // CHROME_BROWSER_METRICS_RENDERER_UPTIME_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698