gem5
[DEVELOP-FOR-25.0]
Loading...
Searching...
No Matches
cpu
thread_state.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2006 The Regents of The University of Michigan
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 "
cpu/thread_state.hh
"
30
31
#include "
base/output.hh
"
32
#include "
cpu/base.hh
"
33
#include "
mem/port.hh
"
34
#include "
mem/port_proxy.hh
"
35
#include "
mem/se_translating_port_proxy.hh
"
36
#include "
mem/translating_port_proxy.hh
"
37
#include "
sim/full_system.hh
"
38
#include "
sim/serialize.hh
"
39
#include "
sim/system.hh
"
40
41
namespace
gem5
42
{
43
44
ThreadState::ThreadState
(
BaseCPU
*cpu,
ThreadID
_tid,
Process
*_process)
45
:
numInst
(0),
numOp
(0),
threadStats
(cpu, _tid),
46
numLoad
(0),
startNumLoad
(0),
47
_status
(
ThreadContext
::Halted),
baseCpu
(cpu),
48
_contextId
(0),
_threadId
(_tid),
lastActivate
(0),
lastSuspend
(0),
49
process
(_process),
storeCondFailures
(0)
50
{
51
}
52
53
void
54
ThreadState::serialize
(
CheckpointOut
&
cp
)
const
55
{
56
SERIALIZE_ENUM
(
_status
);
57
}
58
59
void
60
ThreadState::unserialize
(
CheckpointIn
&
cp
)
61
{
62
UNSERIALIZE_ENUM
(
_status
);
63
}
64
65
ThreadState::ThreadStateStats::ThreadStateStats
(
BaseCPU
*cpu,
66
const
ThreadID
& tid)
67
:
statistics
::
Group
(cpu,
csprintf
(
"thread_%i"
, tid).c_str()),
68
ADD_STAT
(
numInsts
,
statistics
::
units
::Count::get(),
69
"Number of Instructions committed"
),
70
ADD_STAT
(
numOps
,
statistics
::
units
::Count::get(),
71
"Number of Ops committed"
),
72
ADD_STAT
(
numMemRefs
,
statistics
::
units
::Count::get(),
73
"Number of Memory References"
)
74
{
75
}
76
77
}
// namespace gem5
gem5::BaseCPU
Definition
base.hh:106
gem5::CheckpointIn
Definition
serialize.hh:69
gem5::Process
Definition
process.hh:68
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition
thread_context.hh:89
base.hh
full_system.hh
ADD_STAT
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
Definition
group.hh:75
SERIALIZE_ENUM
#define SERIALIZE_ENUM(scalar)
Definition
serialize.hh:591
UNSERIALIZE_ENUM
#define UNSERIALIZE_ENUM(scalar)
Definition
serialize.hh:598
gem5::statistics::Group::Group
Group()=delete
port.hh
Port Object Declaration.
gem5::cp
Definition
cprintf.cc:41
gem5::statistics::units
Units for Stats.
Definition
units.hh:113
gem5::statistics
Definition
statistics.cc:57
gem5
Copyright (c) 2024 Arm Limited All rights reserved.
Definition
binary32.hh:36
gem5::ThreadID
int16_t ThreadID
Thread index/ID type.
Definition
types.hh:235
gem5::CheckpointOut
std::ostream CheckpointOut
Definition
serialize.hh:66
gem5::csprintf
std::string csprintf(const char *format, const Args &...args)
Definition
cprintf.hh:161
output.hh
port_proxy.hh
PortProxy Object Declaration.
se_translating_port_proxy.hh
serialize.hh
system.hh
gem5::ThreadState::ThreadStateStats::numOps
statistics::Scalar numOps
Stat for number ops (including micro ops) committed.
Definition
thread_state.hh:98
gem5::ThreadState::ThreadStateStats::numMemRefs
statistics::Scalar numMemRefs
Stat for number of memory references.
Definition
thread_state.hh:100
gem5::ThreadState::ThreadStateStats::ThreadStateStats
ThreadStateStats(BaseCPU *cpu, const ThreadID &thread)
Definition
thread_state.cc:65
gem5::ThreadState::ThreadStateStats::numInsts
statistics::Scalar numInsts
Stat for number instructions committed.
Definition
thread_state.hh:96
gem5::ThreadState::ThreadState
ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process)
Definition
thread_state.cc:44
gem5::ThreadState::numInst
Counter numInst
Number of instructions committed.
Definition
thread_state.hh:88
gem5::ThreadState::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition
thread_state.cc:54
gem5::ThreadState::_contextId
ContextID _contextId
Definition
thread_state.hh:118
gem5::ThreadState::storeCondFailures
unsigned storeCondFailures
Definition
thread_state.hh:138
gem5::ThreadState::startNumLoad
Counter startNumLoad
The number of simulated loads committed prior to this run.
Definition
thread_state.hh:109
gem5::ThreadState::_threadId
ThreadID _threadId
Definition
thread_state.hh:121
gem5::ThreadState::process
Process * process
Definition
thread_state.hh:131
gem5::ThreadState::numLoad
Counter numLoad
Number of simulated loads, used for tracking events based on the number of loads committed.
Definition
thread_state.hh:106
gem5::ThreadState::numOp
Counter numOp
Number of ops (including micro ops) committed.
Definition
thread_state.hh:90
gem5::ThreadState::threadStats
gem5::ThreadState::ThreadStateStats threadStats
gem5::ThreadState::_status
ThreadContext::Status _status
Definition
thread_state.hh:112
gem5::ThreadState::lastSuspend
Tick lastSuspend
Last time suspend was called on this thread.
Definition
thread_state.hh:128
gem5::ThreadState::lastActivate
Tick lastActivate
Last time activate was called on this thread.
Definition
thread_state.hh:125
gem5::ThreadState::baseCpu
BaseCPU * baseCpu
Definition
thread_state.hh:115
gem5::ThreadState::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition
thread_state.cc:60
thread_state.hh
translating_port_proxy.hh
Generated on Mon May 26 2025 09:19:09 for gem5 by
doxygen
1.13.2