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

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

Issue 1135073002: Revert "cc: Add UMA stats for record and raster time." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « cc/base/histograms.h ('k') | cc/base/histograms_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm>
8 #include <cmath>
9 #include <limits>
10
11 #include "base/numerics/safe_conversions.h"
12
13 namespace cc {
14
15 // Minimum elapsed time of 1us to limit weighting of fast calls.
16 static const int64 kMinimumTimeMicroseconds = 1;
17
18 ScopedUMAHistogramAreaTimerBase::ScopedUMAHistogramAreaTimerBase() : area_(0) {
19 }
20
21 ScopedUMAHistogramAreaTimerBase::~ScopedUMAHistogramAreaTimerBase() {
22 }
23
24 void ScopedUMAHistogramAreaTimerBase::GetHistogramValues(
25 Sample* time_microseconds,
26 Sample* pixels_per_ms) const {
27 GetHistogramValues(timer_.Elapsed(),
28 area_.ValueOrDefault(std::numeric_limits<int>::max()),
29 time_microseconds, pixels_per_ms);
30 }
31
32 // static
33 void ScopedUMAHistogramAreaTimerBase::GetHistogramValues(
34 base::TimeDelta elapsed,
35 int area,
36 Sample* time_microseconds,
37 Sample* pixels_per_ms) {
38 elapsed = std::max(
39 elapsed, base::TimeDelta::FromMicroseconds(kMinimumTimeMicroseconds));
40 double area_per_time = area / elapsed.InMillisecondsF();
41 DCHECK(!std::isnan(area_per_time));
42 *time_microseconds = base::saturated_cast<Sample>(elapsed.InMicroseconds());
43 *pixels_per_ms = base::saturated_cast<Sample>(area_per_time);
44 }
45
46 } // namespace cc
OLDNEW
« no previous file with comments | « cc/base/histograms.h ('k') | cc/base/histograms_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698