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

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

Issue 2697323004: Adds UMA metrics for renderer uptime (Closed)
Patch Set: Removed metric provider Created 3 years, 9 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 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h"
13
14 // Class for tracking and renderer uptime info.
15 class RendererUptimeTracker : public content::NotificationObserver {
16 public:
17 // Creates the |RendererUptimeTracker| instance and initializes the
18 // observers that notify to it.
19 static void Initialize();
Alexei Svitkine (slow) 2017/03/01 15:50:18 Where is this called? I think it should be called
keishi 2017/03/02 09:37:14 The first RenderProcessHost instances seem to be c
20
21 // Returns true if the |RendererUptimeTracker| instance has been
22 // created.
23 static bool IsInitialized();
Alexei Svitkine (slow) 2017/03/01 15:50:18 Any reason to have this since there's already a Ge
keishi 2017/03/02 09:37:14 Sorry. Removed.
24
25 // Returns the |RendererUptimeTracker| instance.
26 static RendererUptimeTracker* Get();
27
28 void OnRendererStarted(int pid);
29 void OnRendererTerminated(int pid);
30 void OnLoadInMainFrame(int pid);
Alexei Svitkine (slow) 2017/03/01 15:50:18 These can now be private, right?
keishi 2017/03/02 09:37:14 Done. Moved private methods to private.
31
32 // content::NotificationObserver:
33 void Observe(int type,
34 const content::NotificationSource& source,
35 const content::NotificationDetails& details) override;
36
37 protected:
38 RendererUptimeTracker();
39 ~RendererUptimeTracker() override;
40
41 struct RendererInfo {
42 base::TimeTicks launched_at_;
43 int num_loads_;
44 int num_loads_in_main_frame_;
45 };
46
47 private:
48 // Object for registering notification requests.
49 content::NotificationRegistrar registrar_;
50
51 // Maps RenderProcessHost ID to its info on uptime.
52 std::map<int, RendererInfo> info_map_;
53
54 DISALLOW_COPY_AND_ASSIGN(RendererUptimeTracker);
55 };
56
57 #endif // CHROME_BROWSER_METRICS_RENDERER_UPTIME_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698