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

Side by Side Diff: base/histogram.h

Issue 50014: Fix a bunch of tiny near-bugs and bugs that static analysis identified... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | base/histogram.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 (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 8
9 // It supports calls to accumulate either time intervals (which are processed 9 // It supports calls to accumulate either time intervals (which are processed
10 // as integral number of milliseconds), or arbitrary integral units. 10 // as integral number of milliseconds), or arbitrary integral units.
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 ThreadSafeHistogram(const char* name, Sample minimum, 468 ThreadSafeHistogram(const char* name, Sample minimum,
469 Sample maximum, size_t bucket_count); 469 Sample maximum, size_t bucket_count);
470 470
471 // Provide the analog to Add() 471 // Provide the analog to Add()
472 void Remove(int value); 472 void Remove(int value);
473 473
474 protected: 474 protected:
475 // Provide locked versions to get precise counts. 475 // Provide locked versions to get precise counts.
476 virtual void Accumulate(Sample value, Count count, size_t index); 476 virtual void Accumulate(Sample value, Count count, size_t index);
477 477
478 virtual void SnapshotSample(SampleSet* sample); 478 virtual void SnapshotSample(SampleSet* sample) const;
479 479
480 private: 480 private:
481 Lock lock_; 481 mutable Lock lock_;
482 482
483 DISALLOW_COPY_AND_ASSIGN(ThreadSafeHistogram); 483 DISALLOW_COPY_AND_ASSIGN(ThreadSafeHistogram);
484 }; 484 };
485 485
486 //------------------------------------------------------------------------------ 486 //------------------------------------------------------------------------------
487 // StatisticsRecorder handles all histograms in the system. It provides a 487 // StatisticsRecorder handles all histograms in the system. It provides a
488 // general place for histograms to register, and supports a global API for 488 // general place for histograms to register, and supports a global API for
489 // accessing (i.e., dumping, or graphing) the data in all the histograms. 489 // accessing (i.e., dumping, or graphing) the data in all the histograms.
490 490
491 class StatisticsRecorder { 491 class StatisticsRecorder {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 // lock protects access to the above map. 534 // lock protects access to the above map.
535 static Lock* lock_; 535 static Lock* lock_;
536 536
537 // Dump all known histograms to log. 537 // Dump all known histograms to log.
538 static bool dump_on_exit_; 538 static bool dump_on_exit_;
539 539
540 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); 540 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder);
541 }; 541 };
542 542
543 #endif // BASE_HISTOGRAM_H__ 543 #endif // BASE_HISTOGRAM_H__
OLDNEW
« no previous file with comments | « no previous file | base/histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698