From 5ab13e2deb8f904ef2a233749193fa09ea7013c4 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Mon, 22 Mar 2010 18:43:53 -0700 Subject: ruby: style pass --- src/mem/ruby/common/Histogram.hh | 98 +++++++++++++++------------------------- 1 file changed, 37 insertions(+), 61 deletions(-) (limited to 'src/mem/ruby/common/Histogram.hh') diff --git a/src/mem/ruby/common/Histogram.hh b/src/mem/ruby/common/Histogram.hh index 64247d64a..e5cd211d6 100644 --- a/src/mem/ruby/common/Histogram.hh +++ b/src/mem/ruby/common/Histogram.hh @@ -1,4 +1,3 @@ - /* * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood * All rights reserved. @@ -27,80 +26,57 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - * $Id$ - * - * Description: The histogram class implements a simple histogram - * - */ - -#ifndef HISTOGRAM_H -#define HISTOGRAM_H +#ifndef __MEM_RUBY_COMMON_HISTOGRAM_HH__ +#define __MEM_RUBY_COMMON_HISTOGRAM_HH__ #include #include "mem/ruby/common/Global.hh" #include "mem/gems_common/Vector.hh" -class Histogram { -public: - // Constructors - Histogram(int binsize = 1, int bins = 50); - - // Destructor - ~Histogram(); - - // Public Methods - - void add(int64 value); - void add(const Histogram& hist); - void clear() { clear(m_bins); } - void clear(int bins); - void clear(int binsize, int bins); - int64 size() const { return m_count; } - int getBins() const { return m_bins; } - int getBinSize() const { return m_binsize; } - int64 getTotal() const { return m_sumSamples; } - int64 getData(int index) const { return m_data[index]; } +class Histogram +{ + public: + Histogram(int binsize = 1, int bins = 50); + ~Histogram(); + + void add(int64 value); + void add(const Histogram& hist); + void clear() { clear(m_bins); } + void clear(int bins); + void clear(int binsize, int bins); + int64 size() const { return m_count; } + int getBins() const { return m_bins; } + int getBinSize() const { return m_binsize; } + int64 getTotal() const { return m_sumSamples; } + int64 getData(int index) const { return m_data[index]; } + + void printWithMultiplier(std::ostream& out, double multiplier) const; + void printPercent(std::ostream& out) const; + void print(std::ostream& out) const; - void printWithMultiplier(std::ostream& out, double multiplier) const; - void printPercent(std::ostream& out) const; - void print(std::ostream& out) const; private: - // Private Methods - - // Private copy constructor and assignment operator - // Histogram(const Histogram& obj); - // Histogram& operator=(const Histogram& obj); + Vector m_data; + int64 m_max; // the maximum value seen so far + int64 m_count; // the number of elements added + int m_binsize; // the size of each bucket + int m_bins; // the number of buckets + int m_largest_bin; // the largest bin used - // Data Members (m_ prefix) - Vector m_data; - int64 m_max; // the maximum value seen so far - int64 m_count; // the number of elements added - int m_binsize; // the size of each bucket - int m_bins; // the number of buckets - int m_largest_bin; // the largest bin used + int64 m_sumSamples; // the sum of all samples + int64 m_sumSquaredSamples; // the sum of the square of all samples - int64 m_sumSamples; // the sum of all samples - int64 m_sumSquaredSamples; // the sum of the square of all samples - - double getStandardDeviation() const; + double getStandardDeviation() const; }; bool node_less_then_eq(const Histogram* n1, const Histogram* n2); -// Output operator declaration -std::ostream& operator<<(std::ostream& out, const Histogram& obj); - -// ******************* Definitions ******************* - -// Output operator definition -extern inline -std::ostream& operator<<(std::ostream& out, const Histogram& obj) +inline std::ostream& +operator<<(std::ostream& out, const Histogram& obj) { - obj.print(out); - out << std::flush; - return out; + obj.print(out); + out << std::flush; + return out; } -#endif //HISTOGRAM_H +#endif // __MEM_RUBY_COMMON_HISTOGRAM_HH__ -- cgit v1.2.3