gem5  v22.0.0.1
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() = default;
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 
75  Process *getProcessPtr() { return process; }
76 
78 
80  Status status() const { return _status; }
81 
83  void setStatus(Status new_status) { _status = new_status; }
84 
85  public:
86 
91  // Defining the stat group
93  {
94  ThreadStateStats(BaseCPU *cpu, const ThreadID& thread);
101  } threadStats;
102 
107 
110 
111  protected:
113 
114  // Pointer to the base CPU.
115  BaseCPU *baseCpu;
116 
117  // system wide HW context id
119 
120  // Index of hardware thread context on the CPU that this represents.
122 
123  public:
126 
129 
130  protected:
132 
133  public:
134 
135  //
136  // Count failed store conditionals so we can warn of apparent
137  // application deadlock situations.
139 };
140 
141 } // namespace gem5
142 
143 #endif // __CPU_THREAD_STATE_HH__
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1930
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::ThreadStateStats
Definition: thread_state.hh:92
gem5::ThreadState::ThreadStateStats::ThreadStateStats
ThreadStateStats(BaseCPU *cpu, const ThreadID &thread)
Definition: thread_state.cc:65
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:100
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:98
gem5::ThreadState::ThreadStateStats::numInsts
statistics::Scalar numInsts
Stat for number instructions committed.
Definition: thread_state.hh:96
gem5::ThreadState::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: thread_state.cc:60
gem5::ThreadState::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: thread_state.cc:54
gem5::ThreadContext::Status
Status
Definition: thread_context.hh:105
gem5::ThreadState::_contextId
ContextID _contextId
Definition: thread_state.hh:118
gem5::ThreadState::threadStats
gem5::ThreadState::ThreadStateStats threadStats
gem5::ThreadState::~ThreadState
virtual ~ThreadState()=default
gem5::ThreadState::lastSuspend
Tick lastSuspend
Last time suspend was called on this thread.
Definition: thread_state.hh:128
gem5::Serializable
Basic support for object serialization.
Definition: serialize.hh:169
gem5::ThreadState::cpuId
int cpuId() const
Definition: thread_state.hh:59
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::ThreadState::storeCondFailures
unsigned storeCondFailures
Definition: thread_state.hh:138
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
process.hh
gem5::ThreadState::setThreadId
void setThreadId(ThreadID id)
Definition: thread_state.hh:67
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:83
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:68
gem5::ThreadState::lastActivate
Tick lastActivate
Last time activate was called on this thread.
Definition: thread_state.hh:125
gem5::ThreadState::numInst
Counter numInst
Number of instructions committed.
Definition: thread_state.hh:88
gem5::ThreadState::setProcessPtr
void setProcessPtr(Process *p)
Definition: thread_state.hh:77
base.hh
gem5::ThreadState::_status
ThreadContext::Status _status
Definition: thread_state.hh:112
gem5::ThreadState::process
Process * process
Definition: thread_state.hh:131
gem5::ThreadState::status
Status status() const
Returns the status of this thread.
Definition: thread_state.hh:80
gem5::ContextID
int ContextID
Globally unique thread context ID.
Definition: types.hh:239
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:251
gem5::ThreadState::numOp
Counter numOp
Number of ops (including micro ops) committed.
Definition: thread_state.hh:90
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: gpu_translation_state.hh:37
gem5::ThreadState::ThreadState
ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process)
Definition: thread_state.cc:44
gem5::ThreadState::baseCpu
BaseCPU * baseCpu
Definition: thread_state.hh:115
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:109
thread_context.hh
gem5::ThreadID
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:235
gem5::ThreadState::getProcessPtr
Process * getProcessPtr()
Definition: thread_state.hh:75
gem5::ThreadState::_threadId
ThreadID _threadId
Definition: thread_state.hh:121

Generated on Sat Jun 18 2022 08:12:21 for gem5 by doxygen 1.8.17