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

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

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/BUILD.gn ('k') | cc/base/histograms.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 #ifndef CC_BASE_HISTOGRAMS_H_
6 #define CC_BASE_HISTOGRAMS_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/metrics/histogram_base.h"
10 #include "base/metrics/histogram_macros.h"
11 #include "base/numerics/safe_math.h"
12 #include "base/time/time.h"
13 #include "base/timer/elapsed_timer.h"
14 #include "cc/base/cc_export.h"
15
16 namespace cc {
17
18 // Emits UMA histogram trackers for time spent as well as area (in pixels)
19 // processed per unit time. Time is measured in microseconds, and work in
20 // pixels per millisecond.
21 //
22 // Usage:
23 // // Outside of a method, perhaps in a namespace.
24 // DEFINE_SCOPED_UMA_HISTOGRAM_AREA_TIMER(ScopedReticulateSplinesTimer,
25 // "ReticulateSplinesUs",
26 // "ReticulateSplinesPixelsPerMs");
27 //
28 // // Inside a method.
29 // ScopedReticulateSplinesTimer timer;
30 // timer.AddArea(some_rect.size().GetArea());
31 #define DEFINE_SCOPED_UMA_HISTOGRAM_AREA_TIMER(class_name, time_histogram, \
32 area_histogram) \
33 class class_name : public ::cc::ScopedUMAHistogramAreaTimerBase { \
34 public: \
35 ~class_name(); \
36 }; \
37 class_name::~class_name() { \
38 Sample time_sample; \
39 Sample area_sample; \
40 GetHistogramValues(&time_sample, &area_sample); \
41 UMA_HISTOGRAM_COUNTS(time_histogram, time_sample); \
42 UMA_HISTOGRAM_COUNTS(area_histogram, area_sample); \
43 }
44
45 class CC_EXPORT ScopedUMAHistogramAreaTimerBase {
46 public:
47 void AddArea(int area) { area_ += area; }
48 void SetArea(int area) { area_ = area; }
49
50 protected:
51 using Sample = base::HistogramBase::Sample;
52
53 ScopedUMAHistogramAreaTimerBase();
54 ~ScopedUMAHistogramAreaTimerBase();
55
56 // Returns true if histograms should be recorded (i.e. values are valid).
57 void GetHistogramValues(Sample* time_microseconds,
58 Sample* pixels_per_ms) const;
59
60 private:
61 static void GetHistogramValues(base::TimeDelta elapsed,
62 int area,
63 Sample* time_microseconds,
64 Sample* pixels_per_ms);
65
66 base::ElapsedTimer timer_;
67 base::CheckedNumeric<int> area_;
68
69 friend class ScopedUMAHistogramAreaTimerBaseTest;
70 DISALLOW_COPY_AND_ASSIGN(ScopedUMAHistogramAreaTimerBase);
71 };
72
73 } // namespace cc
74
75 #endif // CC_BASE_HISTOGRAMS_H_
OLDNEW
« no previous file with comments | « cc/base/BUILD.gn ('k') | cc/base/histograms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698