Deleted Added
sdiff udiff text old ( 6372:f1a41ea3bbab ) new ( 7048:2ab58c54de63 )
full compact
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;

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

21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
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 "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();
47 static void printSummary(ostream& out);
48 static void clearSummary();
49
50 void print(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;
59 static Histogram* s_store_first_to_last_ptr;
60
61 Address m_addr;
62 NodeID m_last_writer;
63 Time m_first_store;
64 Time m_last_store;
65 int m_stores_this_interval;
66
67 int64 m_total_samples; // Total number of store lifetimes of this line
68 Histogram m_store_count;
69 Histogram m_store_first_to_stolen;
70 Histogram m_store_last_to_stolen;
71 Histogram m_store_first_to_last;
72};
73
74inline bool
75node_less_then_eq(const StoreTrace* n1, const StoreTrace* n2)
76{
77 return n1->getTotal() > n2->getTotal();
78}
79
80inline ostream&
81operator<<(ostream& out, const StoreTrace& obj)
82{
83 obj.print(out);
84 out << flush;
85 return out;
86}
87
88#endif // __MEM_RUBY_PROFILER_STORETRACE_HH__