Histogram.hh (7039:bc0b6ea676b5) Histogram.hh (7454:3a3e8e8cce1b)
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 16 unchanged lines hidden (view full) ---

25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef __MEM_RUBY_COMMON_HISTOGRAM_HH__
30#define __MEM_RUBY_COMMON_HISTOGRAM_HH__
31
32#include <iostream>
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 16 unchanged lines hidden (view full) ---

25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef __MEM_RUBY_COMMON_HISTOGRAM_HH__
30#define __MEM_RUBY_COMMON_HISTOGRAM_HH__
31
32#include <iostream>
33#include <vector>
33
34#include "mem/ruby/common/Global.hh"
34
35#include "mem/ruby/common/Global.hh"
35#include "mem/gems_common/Vector.hh"
36
37class Histogram
38{
39 public:
40 Histogram(int binsize = 1, int bins = 50);
41 ~Histogram();
42
43 void add(int64 value);

--- 7 unchanged lines hidden (view full) ---

51 int64 getTotal() const { return m_sumSamples; }
52 int64 getData(int index) const { return m_data[index]; }
53
54 void printWithMultiplier(std::ostream& out, double multiplier) const;
55 void printPercent(std::ostream& out) const;
56 void print(std::ostream& out) const;
57
58private:
36
37class Histogram
38{
39 public:
40 Histogram(int binsize = 1, int bins = 50);
41 ~Histogram();
42
43 void add(int64 value);

--- 7 unchanged lines hidden (view full) ---

51 int64 getTotal() const { return m_sumSamples; }
52 int64 getData(int index) const { return m_data[index]; }
53
54 void printWithMultiplier(std::ostream& out, double multiplier) const;
55 void printPercent(std::ostream& out) const;
56 void print(std::ostream& out) const;
57
58private:
59 Vector<int64> m_data;
59 std::vector<int64> m_data;
60 int64 m_max; // the maximum value seen so far
61 int64 m_count; // the number of elements added
62 int m_binsize; // the size of each bucket
63 int m_bins; // the number of buckets
64 int m_largest_bin; // the largest bin used
65
66 int64 m_sumSamples; // the sum of all samples
67 int64 m_sumSquaredSamples; // the sum of the square of all samples

--- 15 unchanged lines hidden ---
60 int64 m_max; // the maximum value seen so far
61 int64 m_count; // the number of elements added
62 int m_binsize; // the size of each bucket
63 int m_bins; // the number of buckets
64 int m_largest_bin; // the largest bin used
65
66 int64 m_sumSamples; // the sum of all samples
67 int64 m_sumSquaredSamples; // the sum of the square of all samples

--- 15 unchanged lines hidden ---