gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
36namespace gem5
37{
38
39class Checkpoint;
40
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
68
69 ThreadID threadId() const { return _threadId; }
70
72
73 Tick readLastSuspend() const { return lastSuspend; }
74
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
102
107
110
111 protected:
113
114 // Pointer to the base CPU.
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__
uint32_t socketId() const
Reads this CPU's Socket ID.
Definition base.hh:190
int cpuId() const
Reads this CPU's ID.
Definition base.hh:187
Basic support for object serialization.
Definition serialize.hh:170
Statistics container.
Definition group.hh:93
This is a simple scalar statistic, like a counter.
Bitfield< 33 > id
Bitfield< 0 > p
double Counter
All counters are of 64-bit values.
Definition types.hh:46
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
int16_t ThreadID
Thread index/ID type.
Definition types.hh:235
std::ostream CheckpointOut
Definition serialize.hh:66
uint64_t Tick
Tick count type.
Definition types.hh:58
int ContextID
Globally unique thread context ID.
Definition types.hh:239
statistics::Scalar numOps
Stat for number ops (including micro ops) committed.
statistics::Scalar numMemRefs
Stat for number of memory references.
ThreadStateStats(BaseCPU *cpu, const ThreadID &thread)
statistics::Scalar numInsts
Stat for number instructions committed.
Struct for holding general thread state that is needed across CPU models.
ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process)
Counter numInst
Number of instructions committed.
ThreadID threadId() const
int cpuId() const
void serialize(CheckpointOut &cp) const override
Serialize an object.
void setStatus(Status new_status)
Sets the status of this thread.
Tick readLastActivate() const
ThreadContext::Status Status
unsigned storeCondFailures
Counter startNumLoad
The number of simulated loads committed prior to this run.
Tick readLastSuspend() const
void setProcessPtr(Process *p)
Counter numLoad
Number of simulated loads, used for tracking events based on the number of loads committed.
Counter numOp
Number of ops (including micro ops) committed.
gem5::ThreadState::ThreadStateStats threadStats
uint32_t socketId() const
ContextID contextId() const
ThreadContext::Status _status
void setContextId(ContextID id)
Tick lastSuspend
Last time suspend was called on this thread.
Tick lastActivate
Last time activate was called on this thread.
virtual ~ThreadState()=default
Process * getProcessPtr()
Status status() const
Returns the status of this thread.
void setThreadId(ThreadID id)
void unserialize(CheckpointIn &cp) override
Unserialize an object.

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