StoreTrace.hh (6372:f1a41ea3bbab) | StoreTrace.hh (7048:2ab58c54de63) |
---|---|
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 9 * notice, this list of conditions and the following disclaimer; --- 12 unchanged lines hidden (view full) --- 22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 | 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 |
30/* 31 * $Id$ 32 * 33 * Description: 34 * 35 */ | 29#ifndef __MEM_RUBY_PROFILER_STORETRACE_HH__ 30#define __MEM_RUBY_PROFILER_STORETRACE_HH__ |
36 | 31 |
37#ifndef StoreTrace_H 38#define StoreTrace_H 39 40#include "mem/ruby/common/Global.hh" | |
41#include "mem/ruby/common/Address.hh" | 32#include "mem/ruby/common/Address.hh" |
33#include "mem/ruby/common/Global.hh" |
|
42#include "mem/ruby/common/Histogram.hh" 43 | 34#include "mem/ruby/common/Histogram.hh" 35 |
44class StoreTrace { 45public: 46 // Constructors 47 StoreTrace() { } 48 explicit StoreTrace(const Address& addr); | 36class StoreTrace 37{ 38 public: 39 StoreTrace() { } 40 explicit StoreTrace(const Address& addr); 41 ~StoreTrace(); |
49 | 42 |
50 // Destructor 51 ~StoreTrace(); | 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(); |
52 | 49 |
53 // Public Methods 54 void store(NodeID node); 55 void downgrade(NodeID node); 56 int getTotal() const { return m_total_samples; } 57 static void initSummary(); 58 static void printSummary(ostream& out); 59 static void clearSummary(); | 50 void print(ostream& out) const; |
60 | 51 |
61 void print(ostream& out) const; 62private: 63 // Private Methods | 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; |
64 | 60 |
65 // Private copy constructor and assignment operator 66 // StoreTrace(const StoreTrace& obj); 67 // StoreTrace& operator=(const StoreTrace& obj); | 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; |
68 | 66 |
69 // Class Members (s_ prefix) 70 static bool s_init; 71 static int64 s_total_samples; // Total number of store lifetimes of all lines 72 static Histogram* s_store_count_ptr; 73 static Histogram* s_store_first_to_stolen_ptr; 74 static Histogram* s_store_last_to_stolen_ptr; 75 static Histogram* s_store_first_to_last_ptr; 76 77 // Data Members (m_ prefix) 78 79 Address m_addr; 80 NodeID m_last_writer; 81 Time m_first_store; 82 Time m_last_store; 83 int m_stores_this_interval; 84 85 int64 m_total_samples; // Total number of store lifetimes of this line 86 Histogram m_store_count; 87 Histogram m_store_first_to_stolen; 88 Histogram m_store_last_to_stolen; 89 Histogram m_store_first_to_last; | 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; |
90}; 91 | 72}; 73 |
92bool node_less_then_eq(const StoreTrace* n1, const StoreTrace* n2); | 74inline bool 75node_less_then_eq(const StoreTrace* n1, const StoreTrace* n2) 76{ 77 return n1->getTotal() > n2->getTotal(); 78} |
93 | 79 |
94// Output operator declaration 95ostream& operator<<(ostream& out, const StoreTrace& obj); 96 97// ******************* Definitions ******************* 98 99// Output operator definition 100extern inline 101ostream& operator<<(ostream& out, const StoreTrace& obj) | 80inline ostream& 81operator<<(ostream& out, const StoreTrace& obj) |
102{ | 82{ |
103 obj.print(out); 104 out << flush; 105 return out; | 83 obj.print(out); 84 out << flush; 85 return out; |
106} 107 | 86} 87 |
108#endif //StoreTrace_H | 88#endif // __MEM_RUBY_PROFILER_STORETRACE_HH__ |