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/prerender/prerender_histograms.h

Issue 7605020: Move prerender histograms out of prerender manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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_PRERENDER_PRERENDER_HISTOGRAMS_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_
7 #pragma once
8
9 #include "base/time.h"
10 #include "chrome/browser/prerender/prerender_final_status.h"
11 #include "chrome/browser/prerender/prerender_origin.h"
12 #include "googleurl/src/gurl.h"
13
14 namespace prerender {
15
16 // PrerenderHistograms is responsible for recording all prerender specific
17 // histograms for PrerenderManager. It keeps track of the type of prerender
18 // currently underway (based on the PrerenderOrigin of the most recent
dominich 2011/08/10 00:32:46 nit: close this (
tburkard 2011/08/10 01:05:13 Done.
19 // prerenders, and any experiments detected.
20 // PrerenderHistograms does not necessarily record all histograms related to
21 // prerendering, only the ones in the context of PrerenderManager.
22 class PrerenderHistograms {
23 public:
24 // Owned by a PrerenderManager object for the lifetime of the
25 // PrerenderManager.
26 explicit PrerenderHistograms(base::TimeDelta max_age);
27
28 // Records the perceived page load time for a page - effectively the time from
29 // when the user navigates to a page to when it finishes loading. The actual
30 // load may have started prior to navigation due to prerender hints.
31 void RecordPerceivedPageLoadTime(base::TimeDelta perceived_page_load_time,
32 bool was_prerender) const;
33
34 // Records the time from when a page starts prerendering to when the user
35 // navigates to it. This must be called on the UI thread.
36 void RecordTimeUntilUsed(base::TimeDelta time_until_used) const;
37
38 // Record a PerSessionCount data point.
39 void RecordPerSessionCount(int count) const;
40
41 // Record time between two prerender requests.
42 void RecordTimeBetweenPrerenderRequests(base::TimeDelta time) const;
43
44 // Record a final status of a prerendered page in a histogram.
45 void RecordFinalStatus(Origin origin,
46 uint8 experiment_id,
47 FinalStatus final_status) const;
48
49
50 // To be called when a new prerender is added.
51 void RecordPrerender(Origin origin, const GURL& url);
52
53 private:
54 virtual base::TimeTicks GetCurrentTimeTicks() const;
55
56 // Returns whether the PrerenderManager is currently within the prerender
57 // window - effectively, up to 30 seconds after a prerender tag has been
58 // observed.
59 bool WithinWindow() const;
60
61 // Composes a histogram name based on a histogram type.
62 std::string ComposeHistogramName(const std::string& prefix_type,
63 const std::string& name) const;
64
65 // Returns the histogram name for a given origin and experiment.
66 std::string GetHistogramName(Origin origin, uint8 experiment_id,
67 const std::string& name) const;
68 // Returns the histogram name for the current window.
69 std::string GetDefaultHistogramName(const std::string& name) const;
70 // Returns the current experiment.
71 uint8 GetCurrentExperimentId() const;
72 // Returns the current origin.
73 Origin GetCurrentOrigin() const;
74 // Returns whether or not there is currently an origin/experiment wash.
75 bool IsOriginExperimentWash() const;
76
77 // An integer indicating a Prerendering Experiment being currently conducted.
78 // (The last experiment ID seen).
79 uint8 last_experiment_id_;
80
81 // Origin of the last prerender seen.
82 Origin last_origin_;
83
84 // A boolean indicating that we have recently encountered a combination of
85 // different experiments and origins, making an attribution of PPLT's to
86 // experiments / origins impossible.
87 bool origin_experiment_wash_;
88
89 // The time when we last saw a prerender request coming from a renderer.
90 // This is used to record perceived PLT's for a certain amount of time
91 // from the point that we last saw a <link rel=prerender> tag.
92 base::TimeTicks last_prerender_seen_time_;
93
94 // Maximum age of prerenders.
95 base::TimeDelta max_age_;
96
97 DISALLOW_COPY_AND_ASSIGN(PrerenderHistograms);
98 };
99
100 } // namespace prerender
101
102 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_histograms.cc » ('j') | chrome/browser/prerender/prerender_histograms.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698