summaryrefslogtreecommitdiffstats
path: root/components/page_load_metrics/browser/page_load_metrics_util.h
blob: 368a019d04743de746f12638a93f18c8ddbb5864 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_UTIL_H_
#define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_UTIL_H_

#include "base/metrics/histogram_macros.h"
#include "base/time/time.h"

#define PAGE_LOAD_HISTOGRAM(name, sample)                           \
  UMA_HISTOGRAM_CUSTOM_TIMES(name, sample,                          \
                             base::TimeDelta::FromMilliseconds(10), \
                             base::TimeDelta::FromMinutes(10), 100)

namespace page_load_metrics {

struct PageLoadExtraInfo;
struct PageLoadTiming;

// Returns false for events for which we have no timing information, and events
// that happened on a page that had been in the background. When a page is
// backgrounded, some events (e.g. paint) are delayed. Since these data points
// can skew the mean, they should not be mixed with timing events that occurred
// in the foreground.
bool EventOccurredInForeground(const base::TimeDelta& event,
                               const PageLoadExtraInfo& info);

}  // namespace page_load_metrics

#endif  // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_UTIL_H_