gem5  v21.1.0.2
thread_state.hh
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 #ifndef __CPU_THREAD_STATE_HH__
30 #define __CPU_THREAD_STATE_HH__
31 
32 #include "cpu/base.hh"
33 #include "cpu/thread_context.hh"
34 #include "sim/process.hh"
35 
36 namespace gem5
37 {
38 
39 class Checkpoint;
40 
47 struct ThreadState : public Serializable
48 {
50 
51  ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process);
52 
53  virtual ~ThreadState();
54 
55  void serialize(CheckpointOut &cp) const override;
56 
57  void unserialize(CheckpointIn &cp) override;
58 
59  int cpuId() const { return baseCpu->cpuId(); }
60 
61  uint32_t socketId() const { return baseCpu->socketId(); }
62 
63  ContextID contextId() const { return _contextId; }
64 
66 
67  void setThreadId(ThreadID id) { _threadId = id; }
68 
69  ThreadID threadId() const { return _threadId; }
70 
71  Tick readLastActivate() const { return lastActivate; }
72 
73  Tick readLastSuspend() const { return lastSuspend; }
74 
81  void initMemProxies(ThreadContext *tc);
82 
84 
85  Process *getProcessPtr() { return process; }
86 
88 
90  Status status() const { return _status; }
91 
93  void setStatus(Status new_status) { _status = new_status; }
94 
95  public:
96 
101  // Defining the stat group
103  {
104  ThreadStateStats(BaseCPU *cpu, const ThreadID& thread);
111  } threadStats;
112 
117 
120 
121  protected:
123 
124  // Pointer to the base CPU.
126 
127  // system wide HW context id
129 
130  // Index of hardware thread context on the CPU that this represents.
132 
133  public:
136 
139 
140  protected:
142 
146 
147  public:
148 
149  //
150  // Count failed store conditionals so we can warn of apparent
151  // application deadlock situations.
153 };
154 
155 } // namespace gem5
156 
157 #endif // __CPU_THREAD_STATE_HH__
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1927
gem5::ThreadState::numLoad
Counter numLoad
Number of simulated loads, used for tracking events based on the number of loads committed.
Definition: thread_state.hh:116
gem5::ThreadState::~ThreadState
virtual ~ThreadState()
Definition: thread_state.cc:53
gem5::ThreadState::initMemProxies
void initMemProxies(ThreadContext *tc)
Initialise the physical and virtual port proxies and tie them to the data port of the CPU.
Definition: thread_state.cc:72
gem5::ThreadState::ThreadStateStats
Definition: thread_state.hh:102
gem5::ThreadState::ThreadStateStats::ThreadStateStats
ThreadStateStats(BaseCPU *cpu, const ThreadID &thread)
Definition: thread_state.cc:94
gem5::ThreadState
Struct for holding general thread state that is needed across CPU models.
Definition: thread_state.hh:47
gem5::ThreadState::ThreadStateStats::numMemRefs
statistics::Scalar numMemRefs
Stat for number of memory references.
Definition: thread_state.hh:110
gem5::ThreadState::Status
ThreadContext::Status Status
Definition: thread_state.hh:49
gem5::CheckpointIn
Definition: serialize.hh:68
gem5::ThreadState::ThreadStateStats::numOps
statistics::Scalar numOps
Stat for number ops (including micro ops) committed.
Definition: thread_state.hh:108
gem5::ThreadState::ThreadStateStats::numInsts
statistics::Scalar numInsts
Stat for number instructions committed.
Definition: thread_state.hh:106
gem5::ThreadState::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: thread_state.cc:66
gem5::ThreadState::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: thread_state.cc:60
gem5::ThreadContext::Status
Status
Definition: thread_context.hh:104
gem5::ThreadState::_contextId
ContextID _contextId
Definition: thread_state.hh:128
gem5::BaseCPU::socketId
uint32_t socketId() const
Reads this CPU's Socket ID.
Definition: base.hh:191
gem5::ThreadState::getVirtProxy
PortProxy & getVirtProxy()
Definition: thread_state.cc:88
gem5::ThreadState::threadStats
gem5::ThreadState::ThreadStateStats threadStats
gem5::ThreadState::lastSuspend
Tick lastSuspend
Last time suspend was called on this thread.
Definition: thread_state.hh:138
gem5::ThreadState::virtProxy
PortProxy * virtProxy
A translating port proxy, outgoing only, for functional accesse to virtual addresses.
Definition: thread_state.hh:145
gem5::Serializable
Basic support for object serialization.
Definition: serialize.hh:169
gem5::ThreadState::cpuId
int cpuId() const
Definition: thread_state.hh:59
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:93
gem5::ThreadState::storeCondFailures
unsigned storeCondFailures
Definition: thread_state.hh:152
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
process.hh
gem5::PortProxy
This object is a proxy for a port or other object which implements the functional response protocol,...
Definition: port_proxy.hh:86
gem5::ThreadState::setThreadId
void setThreadId(ThreadID id)
Definition: thread_state.hh:67
gem5::BaseCPU
Definition: base.hh:107
gem5::ThreadState::threadId
ThreadID threadId() const
Definition: thread_state.hh:69
gem5::ThreadState::setStatus
void setStatus(Status new_status)
Sets the status of this thread.
Definition: thread_state.hh:93
gem5::ThreadState::contextId
ContextID contextId() const
Definition: thread_state.hh:63
gem5::ThreadState::setContextId
void setContextId(ContextID id)
Definition: thread_state.hh:65
gem5::Process
Definition: process.hh:67
gem5::ThreadState::lastActivate
Tick lastActivate
Last time activate was called on this thread.
Definition: thread_state.hh:135
gem5::ThreadState::numInst
Counter numInst
Number of instructions committed.
Definition: thread_state.hh:98
gem5::ThreadState::setProcessPtr
void setProcessPtr(Process *p)
Definition: thread_state.hh:87
base.hh
gem5::ThreadState::_status
ThreadContext::Status _status
Definition: thread_state.hh:122
gem5::ThreadState::process
Process * process
Definition: thread_state.hh:141
gem5::BaseCPU::cpuId
int cpuId() const
Reads this CPU's ID.
Definition: base.hh:188
gem5::ThreadState::status
Status status() const
Returns the status of this thread.
Definition: thread_state.hh:90
gem5::ContextID
int ContextID
Globally unique thread context ID.
Definition: types.hh:246
gem5::statistics::Counter
double Counter
All counters are of 64-bit values.
Definition: types.hh:47
gem5::statistics::Group
Statistics container.
Definition: group.hh:93
gem5::ArmISA::id
Bitfield< 33 > id
Definition: misc_types.hh:250
gem5::ThreadState::numOp
Counter numOp
Number of ops (including micro ops) committed.
Definition: thread_state.hh:100
gem5::CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:66
gem5::ThreadState::socketId
uint32_t socketId() const
Definition: thread_state.hh:61
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::ThreadState::ThreadState
ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process)
Definition: thread_state.cc:44
gem5::ThreadState::baseCpu
BaseCPU * baseCpu
Definition: thread_state.hh:125
gem5::ThreadState::readLastActivate
Tick readLastActivate() const
Definition: thread_state.hh:71
gem5::ThreadState::readLastSuspend
Tick readLastSuspend() const
Definition: thread_state.hh:73
gem5::ThreadState::startNumLoad
Counter startNumLoad
The number of simulated loads committed prior to this run.
Definition: thread_state.hh:119
thread_context.hh
gem5::ThreadID
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:242
gem5::ThreadState::getProcessPtr
Process * getProcessPtr()
Definition: thread_state.hh:85
gem5::ThreadState::_threadId
ThreadID _threadId
Definition: thread_state.hh:131

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