gem5  v21.1.0.2
StoreTrace.cc
Go to the documentation of this file.
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;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
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 #include "sim/cur_tick.hh"
32 
33 namespace gem5
34 {
35 
36 namespace ruby
37 {
38 
39 bool StoreTrace::s_init = false; // Total number of store lifetimes of
40  // all lines
41 int64_t StoreTrace::s_total_samples = 0; // Total number of store
42  // lifetimes of all lines
43 Histogram* StoreTrace::s_store_count_ptr = NULL;
47 
49  : m_store_count(-1), m_store_first_to_stolen(-1),
50  m_store_last_to_stolen(-1), m_store_first_to_last(-1)
51 {
53  m_addr = addr;
54  m_total_samples = 0;
55 
56  // Really -1 isn't valid, so this will trigger the initilization code
57  m_last_writer = -1;
59 }
60 
62 {
63 }
64 
65 void
66 StoreTrace::print(std::ostream& out) const
67 {
68  out << m_addr
69  << " total_samples: " << m_total_samples << std::endl
70  << "store_count: " << m_store_count << std::endl
71  << "store_first_to_stolen: " << m_store_first_to_stolen << std::endl
72  << "store_last_to_stolen: " << m_store_last_to_stolen << std::endl
73  << "store_first_to_last: " << m_store_first_to_last << std::endl;
74 }
75 
76 void
78 {
79  if (!s_init) {
80  s_total_samples = 0;
81  s_store_count_ptr = new Histogram(-1);
85  }
86  s_init = true;
87 }
88 
89 void
90 StoreTrace::printSummary(std::ostream& out)
91 {
92  out << "total_samples: " << s_total_samples << std::endl;
93  out << "store_count: " << (*s_store_count_ptr) << std::endl;
94  out << "store_first_to_stolen: "
95  << (*s_store_first_to_stolen_ptr) << std::endl;
96  out << "store_last_to_stolen: "
97  << (*s_store_last_to_stolen_ptr) << std::endl;
98  out << "store_first_to_last: " << (*s_store_first_to_last_ptr)
99  << std::endl;
100 }
101 
102 void
104 {
106  s_total_samples = 0;
111 }
112 
113 void
115 {
116  Tick current = curTick();
117 
118  assert((m_last_writer == -1) || (m_last_writer == node));
119 
120  m_last_writer = node;
121  if (m_last_writer == -1) {
122  assert(m_stores_this_interval == 0);
123  }
124 
125  if (m_stores_this_interval == 0) {
126  // A new proessor just wrote the line, so reset the stats
127  m_first_store = current;
128  }
129 
130  m_last_store = current;
132 }
133 
134 void
136 {
137  if (node == m_last_writer) {
138  Tick current = curTick();
139  assert(m_stores_this_interval != 0);
140  assert(m_last_store != 0);
141  assert(m_first_store != 0);
142  assert(m_last_writer != -1);
143 
144  // Per line stats
149  m_total_samples++;
150 
151  // Global stats
152  assert(s_store_first_to_stolen_ptr != NULL);
157  s_total_samples++;
158 
159  // Initilize for next go round
161  m_last_store = 0;
162  m_first_store = 0;
163  m_last_writer = -1;
164  }
165 }
166 
167 } // namespace ruby
168 } // namespace gem5
gem5::ruby::StoreTrace::~StoreTrace
~StoreTrace()
Definition: StoreTrace.cc:61
gem5::curTick
Tick curTick()
The universal simulation clock.
Definition: cur_tick.hh:46
gem5::ruby::StoreTrace::m_addr
Addr m_addr
Definition: StoreTrace.hh:69
gem5::ruby::StoreTrace::s_store_first_to_stolen_ptr
static Histogram * s_store_first_to_stolen_ptr
Definition: StoreTrace.hh:65
gem5::ruby::Histogram::clear
void clear()
Definition: Histogram.hh:53
gem5::ruby::StoreTrace::m_last_writer
NodeID m_last_writer
Definition: StoreTrace.hh:70
cur_tick.hh
gem5::ruby::Histogram::add
void add(int64_t value)
Definition: Histogram.cc:93
gem5::ruby::StoreTrace::m_store_last_to_stolen
Histogram m_store_last_to_stolen
Definition: StoreTrace.hh:78
gem5::ruby::StoreTrace::s_total_samples
static int64_t s_total_samples
Definition: StoreTrace.hh:62
gem5::ruby::StoreTrace::print
void print(std::ostream &out) const
Definition: StoreTrace.cc:66
gem5::ruby::StoreTrace::StoreTrace
StoreTrace()
Definition: StoreTrace.hh:47
gem5::ruby::StoreTrace::m_stores_this_interval
int m_stores_this_interval
Definition: StoreTrace.hh:73
gem5::ruby::StoreTrace::clearSummary
static void clearSummary()
Definition: StoreTrace.cc:103
gem5::ruby::StoreTrace::initSummary
static void initSummary()
Definition: StoreTrace.cc:77
gem5::ruby::StoreTrace::m_store_count
Histogram m_store_count
Definition: StoreTrace.hh:76
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::ruby::StoreTrace::s_init
static bool s_init
Definition: StoreTrace.hh:61
gem5::ruby::StoreTrace::s_store_count_ptr
static Histogram * s_store_count_ptr
Definition: StoreTrace.hh:64
gem5::ruby::StoreTrace::m_total_samples
int64_t m_total_samples
Definition: StoreTrace.hh:75
gem5::ruby::StoreTrace::m_first_store
Tick m_first_store
Definition: StoreTrace.hh:71
gem5::ruby::StoreTrace::printSummary
static void printSummary(std::ostream &out)
Definition: StoreTrace.cc:90
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::ruby::StoreTrace::m_last_store
Tick m_last_store
Definition: StoreTrace.hh:72
gem5::ruby::StoreTrace::s_store_first_to_last_ptr
static Histogram * s_store_first_to_last_ptr
Definition: StoreTrace.hh:67
gem5::ruby::Histogram
Definition: Histogram.hh:43
StoreTrace.hh
gem5::ruby::StoreTrace::downgrade
void downgrade(NodeID node)
Definition: StoreTrace.cc:135
gem5::ruby::NodeID
unsigned int NodeID
Definition: TypeDefines.hh:40
gem5::ruby::StoreTrace::store
void store(NodeID node)
Definition: StoreTrace.cc:114
gem5::ruby::StoreTrace::m_store_first_to_last
Histogram m_store_first_to_last
Definition: StoreTrace.hh:79
gem5::ruby::StoreTrace::m_store_first_to_stolen
Histogram m_store_first_to_stolen
Definition: StoreTrace.hh:77
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::ruby::StoreTrace::s_store_last_to_stolen_ptr
static Histogram * s_store_last_to_stolen_ptr
Definition: StoreTrace.hh:66
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84

Generated on Tue Sep 21 2021 12:25:41 for gem5 by doxygen 1.8.17