StoreTrace.hh (7048:2ab58c54de63) StoreTrace.hh (7055:4e24742201d7)
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;

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

24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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_PROFILER_STORETRACE_HH__
30#define __MEM_RUBY_PROFILER_STORETRACE_HH__
31
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;

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

24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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_PROFILER_STORETRACE_HH__
30#define __MEM_RUBY_PROFILER_STORETRACE_HH__
31
32#include <iostream>
33
32#include "mem/ruby/common/Address.hh"
33#include "mem/ruby/common/Global.hh"
34#include "mem/ruby/common/Histogram.hh"
35
36class StoreTrace
37{
38 public:
39 StoreTrace() { }
40 explicit StoreTrace(const Address& addr);
41 ~StoreTrace();
42
43 void store(NodeID node);
44 void downgrade(NodeID node);
45 int getTotal() const { return m_total_samples; }
46 static void initSummary();
34#include "mem/ruby/common/Address.hh"
35#include "mem/ruby/common/Global.hh"
36#include "mem/ruby/common/Histogram.hh"
37
38class StoreTrace
39{
40 public:
41 StoreTrace() { }
42 explicit StoreTrace(const Address& addr);
43 ~StoreTrace();
44
45 void store(NodeID node);
46 void downgrade(NodeID node);
47 int getTotal() const { return m_total_samples; }
48 static void initSummary();
47 static void printSummary(ostream& out);
49 static void printSummary(std::ostream& out);
48 static void clearSummary();
49
50 static void clearSummary();
51
50 void print(ostream& out) const;
52 void print(std::ostream& out) const;
51
52 private:
53 static bool s_init;
54 static int64 s_total_samples; // Total number of store lifetimes
55 // of all lines
56 static Histogram* s_store_count_ptr;
57 static Histogram* s_store_first_to_stolen_ptr;
58 static Histogram* s_store_last_to_stolen_ptr;

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

72};
73
74inline bool
75node_less_then_eq(const StoreTrace* n1, const StoreTrace* n2)
76{
77 return n1->getTotal() > n2->getTotal();
78}
79
53
54 private:
55 static bool s_init;
56 static int64 s_total_samples; // Total number of store lifetimes
57 // of all lines
58 static Histogram* s_store_count_ptr;
59 static Histogram* s_store_first_to_stolen_ptr;
60 static Histogram* s_store_last_to_stolen_ptr;

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

74};
75
76inline bool
77node_less_then_eq(const StoreTrace* n1, const StoreTrace* n2)
78{
79 return n1->getTotal() > n2->getTotal();
80}
81
80inline ostream&
81operator<<(ostream& out, const StoreTrace& obj)
82inline std::ostream&
83operator<<(std::ostream& out, const StoreTrace& obj)
82{
83 obj.print(out);
84{
85 obj.print(out);
84 out << flush;
86 out << std::flush;
85 return out;
86}
87
88#endif // __MEM_RUBY_PROFILER_STORETRACE_HH__
87 return out;
88}
89
90#endif // __MEM_RUBY_PROFILER_STORETRACE_HH__