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

Side by Side Diff: base/histogram.h

Issue 3452030: FBTF: Moves code to the headers. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 2 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/base.gypi ('k') | 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-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 Sample sample; 265 Sample sample;
266 const char* description; // Null means end of a list of pairs. 266 const char* description; // Null means end of a list of pairs.
267 }; 267 };
268 268
269 //---------------------------------------------------------------------------- 269 //----------------------------------------------------------------------------
270 // Statistic values, developed over the life of the histogram. 270 // Statistic values, developed over the life of the histogram.
271 271
272 class SampleSet { 272 class SampleSet {
273 public: 273 public:
274 explicit SampleSet(); 274 explicit SampleSet();
275 ~SampleSet();
276
275 // Adjust size of counts_ for use with given histogram. 277 // Adjust size of counts_ for use with given histogram.
276 void Resize(const Histogram& histogram); 278 void Resize(const Histogram& histogram);
277 void CheckSize(const Histogram& histogram) const; 279 void CheckSize(const Histogram& histogram) const;
278 280
279 // Accessor for histogram to make routine additions. 281 // Accessor for histogram to make routine additions.
280 void Accumulate(Sample value, Count count, size_t index); 282 void Accumulate(Sample value, Count count, size_t index);
281 283
282 // Accessor methods. 284 // Accessor methods.
283 Count counts(size_t i) const { return counts_[i]; } 285 Count counts(size_t i) const { return counts_[i]; }
284 Count TotalCount() const; 286 Count TotalCount() const;
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 virtual void SetRangeDescriptions(const DescriptionPair descriptions[]); 485 virtual void SetRangeDescriptions(const DescriptionPair descriptions[]);
484 486
485 /* minimum should start from 1. 0 is as minimum is invalid. 0 is an implicit 487 /* minimum should start from 1. 0 is as minimum is invalid. 0 is an implicit
486 default underflow bucket. */ 488 default underflow bucket. */
487 static scoped_refptr<Histogram> FactoryGet(const std::string& name, 489 static scoped_refptr<Histogram> FactoryGet(const std::string& name,
488 Sample minimum, Sample maximum, size_t bucket_count, Flags flags); 490 Sample minimum, Sample maximum, size_t bucket_count, Flags flags);
489 static scoped_refptr<Histogram> FactoryTimeGet(const std::string& name, 491 static scoped_refptr<Histogram> FactoryTimeGet(const std::string& name,
490 base::TimeDelta minimum, base::TimeDelta maximum, size_t bucket_count, 492 base::TimeDelta minimum, base::TimeDelta maximum, size_t bucket_count,
491 Flags flags); 493 Flags flags);
492 494
495 virtual ~LinearHistogram();
496
493 protected: 497 protected:
494 LinearHistogram(const std::string& name, Sample minimum, 498 LinearHistogram(const std::string& name, Sample minimum,
495 Sample maximum, size_t bucket_count); 499 Sample maximum, size_t bucket_count);
496 500
497 LinearHistogram(const std::string& name, base::TimeDelta minimum, 501 LinearHistogram(const std::string& name, base::TimeDelta minimum,
498 base::TimeDelta maximum, size_t bucket_count); 502 base::TimeDelta maximum, size_t bucket_count);
499 503
500 // Initialize ranges_ mapping. 504 // Initialize ranges_ mapping.
501 virtual void InitializeBucketRange(); 505 virtual void InitializeBucketRange();
502 virtual double GetBucketSize(Count current, size_t i) const; 506 virtual double GetBucketSize(Count current, size_t i) const;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 // lock protects access to the above map. 620 // lock protects access to the above map.
617 static Lock* lock_; 621 static Lock* lock_;
618 622
619 // Dump all known histograms to log. 623 // Dump all known histograms to log.
620 static bool dump_on_exit_; 624 static bool dump_on_exit_;
621 625
622 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); 626 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder);
623 }; 627 };
624 628
625 #endif // BASE_HISTOGRAM_H_ 629 #endif // BASE_HISTOGRAM_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698