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

Side by Side Diff: base/metrics/histogram.cc

Issue 10833026: Allow a tad more race-induced histogram errors (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Histogram is an object that aggregates statistics, and can summarize them in 5 // Histogram is an object that aggregates statistics, and can summarize them in
6 // various forms, including ASCII graphical, HTML, and numerically (as a 6 // various forms, including ASCII graphical, HTML, and numerically (as a
7 // vector of numbers corresponding to each of the aggregating buckets). 7 // vector of numbers corresponding to each of the aggregating buckets).
8 // See header file for details and examples. 8 // See header file for details and examples.
9 9
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 if (delta != delta64) 359 if (delta != delta64)
360 delta = INT_MAX; // Flag all giant errors as INT_MAX. 360 delta = INT_MAX; // Flag all giant errors as INT_MAX.
361 // Since snapshots of histograms are taken asynchronously relative to 361 // Since snapshots of histograms are taken asynchronously relative to
362 // sampling (and snapped from different threads), it is pretty likely that 362 // sampling (and snapped from different threads), it is pretty likely that
363 // we'll catch a redundant count that doesn't match the sample count. We 363 // we'll catch a redundant count that doesn't match the sample count. We
364 // allow for a certain amount of slop before flagging this as an 364 // allow for a certain amount of slop before flagging this as an
365 // inconsistency. Even with an inconsistency, we'll snapshot it again (for 365 // inconsistency. Even with an inconsistency, we'll snapshot it again (for
366 // UMA in about a half hour, so we'll eventually get the data, if it was 366 // UMA in about a half hour, so we'll eventually get the data, if it was
367 // not the result of a corruption. If histograms show that 1 is "too tight" 367 // not the result of a corruption. If histograms show that 1 is "too tight"
368 // then we may try to use 2 or 3 for this slop value. 368 // then we may try to use 2 or 3 for this slop value.
369 const int kCommonRaceBasedCountMismatch = 1; 369 const int kCommonRaceBasedCountMismatch = 5;
370 if (delta > 0) { 370 if (delta > 0) {
371 UMA_HISTOGRAM_COUNTS("Histogram.InconsistentCountHigh", delta); 371 UMA_HISTOGRAM_COUNTS("Histogram.InconsistentCountHigh", delta);
372 if (delta > kCommonRaceBasedCountMismatch) 372 if (delta > kCommonRaceBasedCountMismatch)
373 inconsistencies |= COUNT_HIGH_ERROR; 373 inconsistencies |= COUNT_HIGH_ERROR;
374 } else { 374 } else {
375 DCHECK_GT(0, delta); 375 DCHECK_GT(0, delta);
376 UMA_HISTOGRAM_COUNTS("Histogram.InconsistentCountLow", -delta); 376 UMA_HISTOGRAM_COUNTS("Histogram.InconsistentCountLow", -delta);
377 if (-delta > kCommonRaceBasedCountMismatch) 377 if (-delta > kCommonRaceBasedCountMismatch)
378 inconsistencies |= COUNT_LOW_ERROR; 378 inconsistencies |= COUNT_LOW_ERROR;
379 } 379 }
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 1324
1325 // static 1325 // static
1326 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; 1326 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL;
1327 // static 1327 // static
1328 StatisticsRecorder::RangesMap* StatisticsRecorder::ranges_ = NULL; 1328 StatisticsRecorder::RangesMap* StatisticsRecorder::ranges_ = NULL;
1329 // static 1329 // static
1330 base::Lock* StatisticsRecorder::lock_ = NULL; 1330 base::Lock* StatisticsRecorder::lock_ = NULL;
1331 // static 1331 // static
1332 bool StatisticsRecorder::dump_on_exit_ = false; 1332 bool StatisticsRecorder::dump_on_exit_ = false;
1333 } // namespace base 1333 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698