gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
33namespace gem5
34{
35
36namespace ruby
37{
38
39bool StoreTrace::s_init = false; // Total number of store lifetimes of
40 // all lines
41int64_t StoreTrace::s_total_samples = 0; // Total number of store
42 // lifetimes of all lines
43Histogram* 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;
55
56 // Really -1 isn't valid, so this will trigger the initilization code
57 m_last_writer = -1;
59}
60
64
65void
66StoreTrace::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
76void
88
89void
90StoreTrace::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
102void
112
113void
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
134void
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
150
151 // Global stats
152 assert(s_store_first_to_stolen_ptr != NULL);
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
void add(int64_t value)
Definition Histogram.cc:93
void store(NodeID node)
static void printSummary(std::ostream &out)
Definition StoreTrace.cc:90
static int64_t s_total_samples
Definition StoreTrace.hh:62
static Histogram * s_store_first_to_stolen_ptr
Definition StoreTrace.hh:65
void downgrade(NodeID node)
Histogram m_store_last_to_stolen
Definition StoreTrace.hh:78
static Histogram * s_store_count_ptr
Definition StoreTrace.hh:64
static void initSummary()
Definition StoreTrace.cc:77
Histogram m_store_first_to_last
Definition StoreTrace.hh:79
static Histogram * s_store_first_to_last_ptr
Definition StoreTrace.hh:67
Histogram m_store_first_to_stolen
Definition StoreTrace.hh:77
void print(std::ostream &out) const
Definition StoreTrace.cc:66
static Histogram * s_store_last_to_stolen_ptr
Definition StoreTrace.hh:66
static void clearSummary()
Bitfield< 3 > addr
Definition types.hh:84
unsigned int NodeID
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
Tick curTick()
The universal simulation clock.
Definition cur_tick.hh:46
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
uint64_t Tick
Tick count type.
Definition types.hh:58

Generated on Tue Jun 18 2024 16:24:05 for gem5 by doxygen 1.11.0