1 2/* 3 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright --- 23 unchanged lines hidden (view full) --- 32 * 33 * Description: The histogram class implements a simple histogram 34 * 35 */ 36 37#ifndef HISTOGRAM_H 38#define HISTOGRAM_H 39 |
40#include <iostream> 41 |
42#include "mem/ruby/common/Global.hh" 43#include "mem/gems_common/Vector.hh" 44 45class Histogram { 46public: 47 // Constructors 48 Histogram(int binsize = 1, int bins = 50); 49 --- 8 unchanged lines hidden (view full) --- 58 void clear(int bins); 59 void clear(int binsize, int bins); 60 int64 size() const { return m_count; } 61 int getBins() const { return m_bins; } 62 int getBinSize() const { return m_binsize; } 63 int64 getTotal() const { return m_sumSamples; } 64 int64 getData(int index) const { return m_data[index]; } 65 |
66 void printWithMultiplier(std::ostream& out, double multiplier) const; 67 void printPercent(std::ostream& out) const; 68 void print(std::ostream& out) const; |
69private: 70 // Private Methods 71 72 // Private copy constructor and assignment operator 73 // Histogram(const Histogram& obj); 74 // Histogram& operator=(const Histogram& obj); 75 76 // Data Members (m_ prefix) --- 8 unchanged lines hidden (view full) --- 85 int64 m_sumSquaredSamples; // the sum of the square of all samples 86 87 double getStandardDeviation() const; 88}; 89 90bool node_less_then_eq(const Histogram* n1, const Histogram* n2); 91 92// Output operator declaration |
93std::ostream& operator<<(std::ostream& out, const Histogram& obj); |
94 95// ******************* Definitions ******************* 96 97// Output operator definition 98extern inline |
99std::ostream& operator<<(std::ostream& out, const Histogram& obj) |
100{ 101 obj.print(out); |
102 out << std::flush; |
103 return out; 104} 105 106#endif //HISTOGRAM_H |