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

Side by Side Diff: chrome/browser/page_load_metrics/page_load_metrics_util.h

Issue 2681193003: Page load metrics observers cleanup (Closed)
Patch Set: address comment 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
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 CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_ 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_ 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_
7 7
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/optional.h" 9 #include "base/optional.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 11
12 #define PAGE_LOAD_HISTOGRAM(name, sample) \ 12 #define PAGE_LOAD_HISTOGRAM(name, sample) \
13 UMA_HISTOGRAM_CUSTOM_TIMES(name, sample, \ 13 UMA_HISTOGRAM_CUSTOM_TIMES(name, sample, \
14 base::TimeDelta::FromMilliseconds(10), \ 14 base::TimeDelta::FromMilliseconds(10), \
15 base::TimeDelta::FromMinutes(10), 100) 15 base::TimeDelta::FromMinutes(10), 100)
16 16
17 // Records |bytes| to |histogram_name| in kilobytes (i.e., bytes / 1024).
18 #define PAGE_BYTES_HISTOGRAM(histogram_name, bytes) \
19 UMA_HISTOGRAM_CUSTOM_COUNTS( \
20 histogram_name, static_cast<int>((bytes) / 1024), 1, 500 * 1024, 50)
21
22 #define PAGE_RESOURCE_COUNT_HISTOGRAM UMA_HISTOGRAM_COUNTS_10000
23
17 namespace page_load_metrics { 24 namespace page_load_metrics {
18 25
19 struct PageLoadExtraInfo; 26 struct PageLoadExtraInfo;
20 27
21 // Returns true if: 28 // Returns true if:
22 // - We have timing information for the event. 29 // - We have timing information for the event.
23 // - The page load started while the page was in the foreground. 30 // - The page load started while the page was in the foreground.
24 // - The event occurred prior to the page being moved to the background. 31 // - The event occurred prior to the page being moved to the background.
25 // When a page is backgrounded, some events (e.g. paint) are delayed. Since 32 // When a page is backgrounded, some events (e.g. paint) are delayed. Since
26 // these data points can skew the mean, they should not be mixed with timing 33 // these data points can skew the mean, they should not be mixed with timing
27 // events that occurred in the foreground. 34 // events that occurred in the foreground.
28 // If the event time delta and background time delta are equal, we still 35 // If the event time delta and background time delta are equal, we still
29 // consider the event to be logged in the foreground histogram since any 36 // consider the event to be logged in the foreground histogram since any
30 // background specific handling would not yet have been applied to that event. 37 // background specific handling would not yet have been applied to that event.
31 bool WasStartedInForegroundOptionalEventInForeground( 38 bool WasStartedInForegroundOptionalEventInForeground(
32 const base::Optional<base::TimeDelta>& event, 39 const base::Optional<base::TimeDelta>& event,
33 const PageLoadExtraInfo& info); 40 const PageLoadExtraInfo& info);
34 41
35 } // namespace page_load_metrics 42 } // namespace page_load_metrics
36 43
37 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_ 44 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698