gem5
v24.0.0.0
Loading...
Searching...
No Matches
mem
ruby
profiler
AccessTraceForAddress.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
29
#include "
mem/ruby/profiler/AccessTraceForAddress.hh
"
30
31
#include "
mem/ruby/common/Histogram.hh
"
32
33
namespace
gem5
34
{
35
36
namespace
ruby
37
{
38
39
AccessTraceForAddress::~AccessTraceForAddress
()
40
{
41
if
(
m_histogram_ptr
) {
42
delete
m_histogram_ptr
;
43
m_histogram_ptr
= NULL;
44
}
45
}
46
47
void
48
AccessTraceForAddress::print
(std::ostream& out)
const
49
{
50
out <<
m_addr
;
51
52
if
(
m_histogram_ptr
== NULL) {
53
out <<
" "
<<
m_total
;
54
out <<
" | "
<<
m_loads
;
55
out <<
" "
<<
m_stores
;
56
out <<
" "
<<
m_atomics
;
57
out <<
" | "
<<
m_user
;
58
out <<
" "
<<
m_total
-
m_user
;
59
out <<
" | "
<<
m_sharing
;
60
out <<
" | "
<<
m_touched_by
.
count
();
61
}
else
{
62
assert(
m_total
== 0);
63
out <<
" "
<< (*m_histogram_ptr);
64
}
65
}
66
67
void
68
AccessTraceForAddress::update
(RubyRequestType
type
,
69
RubyAccessMode access_mode,
NodeID
cpu,
70
bool
sharing_miss)
71
{
72
m_touched_by
.
add
(cpu);
73
m_total
++;
74
if
(
type
== RubyRequestType_ATOMIC) {
75
m_atomics
++;
76
}
else
if
(
type
== RubyRequestType_LD){
77
m_loads
++;
78
}
else
if
(
type
== RubyRequestType_ST){
79
m_stores
++;
80
}
else
{
81
// ERROR_MSG("Trying to add invalid access to trace");
82
}
83
84
if
(access_mode == RubyAccessMode_User) {
85
m_user
++;
86
}
87
88
if
(sharing_miss) {
89
m_sharing
++;
90
}
91
}
92
93
int
94
AccessTraceForAddress::getTotal
()
const
95
{
96
if
(
m_histogram_ptr
== NULL) {
97
return
m_total
;
98
}
else
{
99
return
m_histogram_ptr
->
getTotal
();
100
}
101
}
102
103
void
104
AccessTraceForAddress::addSample
(
int
value)
105
{
106
assert(
m_total
== 0);
107
if
(
m_histogram_ptr
== NULL) {
108
m_histogram_ptr
=
new
Histogram
;
109
}
110
m_histogram_ptr
->
add
(value);
111
}
112
113
}
// namespace ruby
114
}
// namespace gem5
AccessTraceForAddress.hh
Histogram.hh
gem5::ruby::AccessTraceForAddress::m_touched_by
Set m_touched_by
Definition
AccessTraceForAddress.hh:82
gem5::ruby::AccessTraceForAddress::addSample
void addSample(int value)
Definition
AccessTraceForAddress.cc:104
gem5::ruby::AccessTraceForAddress::getTotal
int getTotal() const
Definition
AccessTraceForAddress.cc:94
gem5::ruby::AccessTraceForAddress::~AccessTraceForAddress
~AccessTraceForAddress()
Definition
AccessTraceForAddress.cc:39
gem5::ruby::AccessTraceForAddress::m_loads
uint64_t m_loads
Definition
AccessTraceForAddress.hh:76
gem5::ruby::AccessTraceForAddress::m_sharing
uint64_t m_sharing
Definition
AccessTraceForAddress.hh:81
gem5::ruby::AccessTraceForAddress::m_histogram_ptr
Histogram * m_histogram_ptr
Definition
AccessTraceForAddress.hh:83
gem5::ruby::AccessTraceForAddress::m_addr
Addr m_addr
Definition
AccessTraceForAddress.hh:75
gem5::ruby::AccessTraceForAddress::m_user
uint64_t m_user
Definition
AccessTraceForAddress.hh:80
gem5::ruby::AccessTraceForAddress::update
void update(RubyRequestType type, RubyAccessMode access_mode, NodeID cpu, bool sharing_miss)
Definition
AccessTraceForAddress.cc:68
gem5::ruby::AccessTraceForAddress::m_stores
uint64_t m_stores
Definition
AccessTraceForAddress.hh:77
gem5::ruby::AccessTraceForAddress::print
void print(std::ostream &out) const
Definition
AccessTraceForAddress.cc:48
gem5::ruby::AccessTraceForAddress::m_atomics
uint64_t m_atomics
Definition
AccessTraceForAddress.hh:78
gem5::ruby::AccessTraceForAddress::m_total
uint64_t m_total
Definition
AccessTraceForAddress.hh:79
gem5::ruby::Histogram
Definition
Histogram.hh:45
gem5::ruby::Histogram::getTotal
int64_t getTotal() const
Definition
Histogram.hh:61
gem5::ruby::Histogram::add
void add(int64_t value)
Definition
Histogram.cc:93
gem5::ruby::Set::add
void add(NodeID index)
Definition
Set.hh:78
gem5::ruby::Set::count
int count() const
Definition
Set.hh:129
gem5::X86ISA::type
type
Definition
misc.hh:762
gem5::ruby::NodeID
unsigned int NodeID
Definition
TypeDefines.hh:42
gem5
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition
binary32.hh:36
Generated on Tue Jun 18 2024 16:24:05 for gem5 by
doxygen
1.11.0