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

Side by Side Diff: cc/scheduler/compositor_timing_history.cc

Issue 1229853004: Base: Make TimeDelta constructors deal with overflow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove static initializers Created 5 years, 5 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 | « base/time/time_unittest.cc ('k') | chrome/browser/sync/sync_stopped_reporter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "cc/scheduler/compositor_timing_history.h" 5 #include "cc/scheduler/compositor_timing_history.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "cc/debug/rendering_stats_instrumentation.h" 9 #include "cc/debug/rendering_stats_instrumentation.h"
10 10
(...skipping 27 matching lines...) Expand all
38 // The estimates related to main-thread responsiveness affect whether 38 // The estimates related to main-thread responsiveness affect whether
39 // we attempt to recovery latency or not and use the 50th percentile. 39 // we attempt to recovery latency or not and use the 50th percentile.
40 // TODO(brianderson): Fine tune the percentiles below. 40 // TODO(brianderson): Fine tune the percentiles below.
41 const size_t kDurationHistorySize = 60; 41 const size_t kDurationHistorySize = 60;
42 const double kBeginMainFrameToCommitEstimationPercentile = 50.0; 42 const double kBeginMainFrameToCommitEstimationPercentile = 50.0;
43 const double kCommitToReadyToActivateEstimationPercentile = 50.0; 43 const double kCommitToReadyToActivateEstimationPercentile = 50.0;
44 const double kPrepareTilesEstimationPercentile = 100.0; 44 const double kPrepareTilesEstimationPercentile = 100.0;
45 const double kActivateEstimationPercentile = 100.0; 45 const double kActivateEstimationPercentile = 100.0;
46 const double kDrawEstimationPercentile = 100.0; 46 const double kDrawEstimationPercentile = 100.0;
47 47
48 const base::TimeDelta kUmaDurationMin = base::TimeDelta::FromMicroseconds(1); 48 const int kUmaDurationMin_uS = 1;
49 const base::TimeDelta kUmaDurationMax = base::TimeDelta::FromSeconds(1); 49 const int64 kUmaDurationMax_uS = 1 * base::Time::kMicrosecondsPerSecond;
50 const size_t kUmaDurationBucketCount = 100; 50 const size_t kUmaDurationBucketCount = 100;
51 51
52 // Deprecated because they combine Browser and Renderer stats and have low 52 // Deprecated because they combine Browser and Renderer stats and have low
53 // precision. 53 // precision.
54 // TODO(brianderson): Remove. 54 // TODO(brianderson): Remove.
55 void DeprecatedDrawDurationUMA(base::TimeDelta duration, 55 void DeprecatedDrawDurationUMA(base::TimeDelta duration,
56 base::TimeDelta estimate) { 56 base::TimeDelta estimate) {
57 base::TimeDelta duration_overestimate; 57 base::TimeDelta duration_overestimate;
58 base::TimeDelta duration_underestimate; 58 base::TimeDelta duration_underestimate;
59 if (duration > estimate) 59 if (duration > estimate)
60 duration_underestimate = duration - estimate; 60 duration_underestimate = duration - estimate;
61 else 61 else
62 duration_overestimate = estimate - duration; 62 duration_overestimate = estimate - duration;
63 UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.DrawDuration", duration, 63 UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.DrawDuration", duration,
64 base::TimeDelta::FromMilliseconds(1), 64 base::TimeDelta::FromMilliseconds(1),
65 base::TimeDelta::FromMilliseconds(100), 50); 65 base::TimeDelta::FromMilliseconds(100), 50);
66 UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.DrawDurationUnderestimate", 66 UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.DrawDurationUnderestimate",
67 duration_underestimate, 67 duration_underestimate,
68 base::TimeDelta::FromMilliseconds(1), 68 base::TimeDelta::FromMilliseconds(1),
69 base::TimeDelta::FromMilliseconds(100), 50); 69 base::TimeDelta::FromMilliseconds(100), 50);
70 UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.DrawDurationOverestimate", 70 UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.DrawDurationOverestimate",
71 duration_overestimate, 71 duration_overestimate,
72 base::TimeDelta::FromMilliseconds(1), 72 base::TimeDelta::FromMilliseconds(1),
73 base::TimeDelta::FromMilliseconds(100), 50); 73 base::TimeDelta::FromMilliseconds(100), 50);
74 } 74 }
75 75
76 #define UMA_HISTOGRAM_CUSTOM_TIMES_MICROS(name, sample) \ 76 #define UMA_HISTOGRAM_CUSTOM_TIMES_MICROS(name, sample) \
77 UMA_HISTOGRAM_CUSTOM_COUNTS( \ 77 UMA_HISTOGRAM_CUSTOM_COUNTS( \
78 name, sample.InMicroseconds(), kUmaDurationMin.InMicroseconds(), \ 78 name, sample.InMicroseconds(), kUmaDurationMin_uS, \
79 kUmaDurationMax.InMicroseconds(), kUmaDurationBucketCount); 79 kUmaDurationMax_uS, kUmaDurationBucketCount);
80 80
81 #define REPORT_COMPOSITOR_TIMING_HISTORY_UMA(category, subcategory) \ 81 #define REPORT_COMPOSITOR_TIMING_HISTORY_UMA(category, subcategory) \
82 do { \ 82 do { \
83 base::TimeDelta duration_overestimate; \ 83 base::TimeDelta duration_overestimate; \
84 base::TimeDelta duration_underestimate; \ 84 base::TimeDelta duration_underestimate; \
85 if (duration > estimate) \ 85 if (duration > estimate) \
86 duration_underestimate = duration - estimate; \ 86 duration_underestimate = duration - estimate; \
87 else \ 87 else \
88 duration_overestimate = estimate - duration; \ 88 duration_overestimate = estimate - duration; \
89 UMA_HISTOGRAM_CUSTOM_TIMES_MICROS( \ 89 UMA_HISTOGRAM_CUSTOM_TIMES_MICROS( \
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 uma_reporter_->AddDrawDuration(draw_duration, draw_estimate, enabled_); 390 uma_reporter_->AddDrawDuration(draw_duration, draw_estimate, enabled_);
391 391
392 if (enabled_) { 392 if (enabled_) {
393 draw_duration_history_.InsertSample(draw_duration); 393 draw_duration_history_.InsertSample(draw_duration);
394 } 394 }
395 395
396 start_draw_time_ = base::TimeTicks(); 396 start_draw_time_ = base::TimeTicks();
397 } 397 }
398 398
399 } // namespace cc 399 } // namespace cc
OLDNEW
« no previous file with comments | « base/time/time_unittest.cc ('k') | chrome/browser/sync/sync_stopped_reporter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698