summaryrefslogtreecommitdiff
path: root/src/mem/ruby/common/Histogram.hh
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2010-03-22 18:43:53 -0700
committerNathan Binkert <nate@binkert.org>2010-03-22 18:43:53 -0700
commit5ab13e2deb8f904ef2a233749193fa09ea7013c4 (patch)
tree07f5f02902f9e719fe58d1a9419b5a1d51f7a2ce /src/mem/ruby/common/Histogram.hh
parent2620e08722b38660658d46cdb76c337db18e877c (diff)
downloadgem5-5ab13e2deb8f904ef2a233749193fa09ea7013c4.tar.xz
ruby: style pass
Diffstat (limited to 'src/mem/ruby/common/Histogram.hh')
-rw-r--r--src/mem/ruby/common/Histogram.hh98
1 files changed, 37 insertions, 61 deletions
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 <iostream>
#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<int64> 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<int64> 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__