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

Side by Side Diff: cc/base/histograms.cc

Issue 1075523002: cc: Add UMA stats for record and raster time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change constructor/destructor visibility Created 5 years, 8 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 2015 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 #include "cc/base/histograms.h"
6
7 #include <limits>
8
9 #include "base/float_util.h"
10 #include "base/numerics/safe_conversions.h"
11
12 namespace cc {
13
14 ScopedUMAHistogramAreaTimerBase::ScopedUMAHistogramAreaTimerBase() : area_(0) {
15 }
16
17 ScopedUMAHistogramAreaTimerBase::~ScopedUMAHistogramAreaTimerBase() {
18 }
19
20 bool ScopedUMAHistogramAreaTimerBase::GetHistogramValues(
21 Sample* time_microseconds,
22 Sample* pixels_per_ms) const {
23 return GetHistogramValues(
24 timer_.Elapsed(), area_.ValueOrDefault(std::numeric_limits<int>::max()),
25 time_microseconds, pixels_per_ms);
26 }
27
28 // static
29 bool ScopedUMAHistogramAreaTimerBase::GetHistogramValues(
30 base::TimeDelta elapsed,
31 int area,
32 Sample* time_microseconds,
33 Sample* pixels_per_ms) {
34 double area_per_time = area / elapsed.InMillisecondsF();
35 if (base::IsNaN(area_per_time))
36 return false;
37 *time_microseconds = base::saturated_cast<Sample>(elapsed.InMicroseconds());
38 *pixels_per_ms = base::saturated_cast<Sample>(area_per_time);
39 return true;
40 }
41
42 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698