gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::ThreadState Struct Reference

Struct for holding general thread state that is needed across CPU models. More...

#include <thread_state.hh>

Inheritance diagram for gem5::ThreadState:
gem5::Serializable gem5::SimpleThread gem5::o3::ThreadState

Classes

struct  ThreadStateStats
 

Public Types

typedef ThreadContext::Status Status
 

Public Member Functions

 ThreadState (BaseCPU *cpu, ThreadID _tid, Process *_process)
 
virtual ~ThreadState ()=default
 
void serialize (CheckpointOut &cp) const override
 Serialize an object.
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object.
 
int cpuId () const
 
uint32_t socketId () const
 
ContextID contextId () const
 
void setContextId (ContextID id)
 
void setThreadId (ThreadID id)
 
ThreadID threadId () const
 
Tick readLastActivate () const
 
Tick readLastSuspend () const
 
ProcessgetProcessPtr ()
 
void setProcessPtr (Process *p)
 
Status status () const
 Returns the status of this thread.
 
void setStatus (Status new_status)
 Sets the status of this thread.
 
- Public Member Functions inherited from gem5::Serializable
 Serializable ()
 
virtual ~Serializable ()
 
void serializeSection (CheckpointOut &cp, const char *name) const
 Serialize an object into a new section.
 
void serializeSection (CheckpointOut &cp, const std::string &name) const
 
void unserializeSection (CheckpointIn &cp, const char *name)
 Unserialize an a child object.
 
void unserializeSection (CheckpointIn &cp, const std::string &name)
 

Public Attributes

Counter numInst
 Number of instructions committed.
 
Counter numOp
 Number of ops (including micro ops) committed.
 
gem5::ThreadState::ThreadStateStats threadStats
 
Counter numLoad
 Number of simulated loads, used for tracking events based on the number of loads committed.
 
Counter startNumLoad
 The number of simulated loads committed prior to this run.
 
Tick lastActivate
 Last time activate was called on this thread.
 
Tick lastSuspend
 Last time suspend was called on this thread.
 
unsigned storeCondFailures
 

Protected Attributes

ThreadContext::Status _status
 
BaseCPUbaseCpu
 
ContextID _contextId
 
ThreadID _threadId
 
Processprocess
 

Additional Inherited Members

- Static Public Member Functions inherited from gem5::Serializable
static const std::string & currentSection ()
 Gets the fully-qualified name of the active section.
 
static void generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream)
 Generate a checkpoint file so that the serialization can be routed to it.
 

Detailed Description

Struct for holding general thread state that is needed across CPU models.

This includes things such as pointers to the process, memory, quiesce events, and certain stats. This can be expanded to hold more thread-specific stats within it.

Definition at line 47 of file thread_state.hh.

Member Typedef Documentation

◆ Status

Constructor & Destructor Documentation

◆ ThreadState()

gem5::ThreadState::ThreadState ( BaseCPU * cpu,
ThreadID _tid,
Process * _process )

Definition at line 44 of file thread_state.cc.

◆ ~ThreadState()

virtual gem5::ThreadState::~ThreadState ( )
virtualdefault

Member Function Documentation

◆ contextId()

ContextID gem5::ThreadState::contextId ( ) const
inline

◆ cpuId()

int gem5::ThreadState::cpuId ( ) const
inline

Definition at line 59 of file thread_state.hh.

References baseCpu, and gem5::BaseCPU::cpuId().

Referenced by gem5::SimpleThread::cpuId().

◆ getProcessPtr()

Process * gem5::ThreadState::getProcessPtr ( )
inline

Definition at line 75 of file thread_state.hh.

References process.

Referenced by gem5::o3::ThreadContext::getProcessPtr(), and gem5::SimpleThread::getProcessPtr().

◆ readLastActivate()

Tick gem5::ThreadState::readLastActivate ( ) const
inline

Definition at line 71 of file thread_state.hh.

References lastActivate.

Referenced by gem5::SimpleThread::readLastActivate().

◆ readLastSuspend()

Tick gem5::ThreadState::readLastSuspend ( ) const
inline

Definition at line 73 of file thread_state.hh.

References lastSuspend.

Referenced by gem5::SimpleThread::readLastSuspend().

◆ serialize()

void gem5::ThreadState::serialize ( CheckpointOut & cp) const
overridevirtual

Serialize an object.

Output an object's state into the current checkpoint section.

Parameters
cpCheckpoint state

Implements gem5::Serializable.

Definition at line 54 of file thread_state.cc.

References _status, and SERIALIZE_ENUM.

Referenced by gem5::o3::ThreadState::serialize(), and gem5::SimpleThread::serialize().

◆ setContextId()

void gem5::ThreadState::setContextId ( ContextID id)
inline

◆ setProcessPtr()

void gem5::ThreadState::setProcessPtr ( Process * p)
inline

◆ setStatus()

void gem5::ThreadState::setStatus ( Status new_status)
inline

◆ setThreadId()

void gem5::ThreadState::setThreadId ( ThreadID id)
inline

◆ socketId()

uint32_t gem5::ThreadState::socketId ( ) const
inline

Definition at line 61 of file thread_state.hh.

References baseCpu, and gem5::BaseCPU::socketId().

Referenced by gem5::SimpleThread::socketId().

◆ status()

Status gem5::ThreadState::status ( ) const
inline

Returns the status of this thread.

Definition at line 80 of file thread_state.hh.

References _status.

Referenced by gem5::o3::ThreadContext::activate(), gem5::o3::ThreadContext::halt(), gem5::o3::ThreadContext::status(), and gem5::o3::ThreadContext::suspend().

◆ threadId()

◆ unserialize()

void gem5::ThreadState::unserialize ( CheckpointIn & cp)
overridevirtual

Unserialize an object.

Read an object's state from the current checkpoint section.

Parameters
cpCheckpoint state

Implements gem5::Serializable.

Definition at line 60 of file thread_state.cc.

References _status, and UNSERIALIZE_ENUM.

Referenced by gem5::o3::ThreadState::unserialize(), and gem5::SimpleThread::unserialize().

Member Data Documentation

◆ _contextId

ContextID gem5::ThreadState::_contextId
protected

Definition at line 118 of file thread_state.hh.

Referenced by contextId(), gem5::SimpleThread::copyState(), and setContextId().

◆ _status

◆ _threadId

◆ baseCpu

◆ lastActivate

◆ lastSuspend

Tick gem5::ThreadState::lastSuspend

◆ numInst

Counter gem5::ThreadState::numInst

Number of instructions committed.

Definition at line 88 of file thread_state.hh.

Referenced by gem5::minor::Execute::doInstCommitAccounting().

◆ numLoad

Counter gem5::ThreadState::numLoad

Number of simulated loads, used for tracking events based on the number of loads committed.

Definition at line 106 of file thread_state.hh.

◆ numOp

Counter gem5::ThreadState::numOp

Number of ops (including micro ops) committed.

Definition at line 90 of file thread_state.hh.

Referenced by gem5::minor::Execute::doInstCommitAccounting().

◆ process

Process* gem5::ThreadState::process
protected

Definition at line 131 of file thread_state.hh.

Referenced by getProcessPtr(), and setProcessPtr().

◆ startNumLoad

Counter gem5::ThreadState::startNumLoad

The number of simulated loads committed prior to this run.

Definition at line 109 of file thread_state.hh.

◆ storeCondFailures

◆ threadStats


The documentation for this struct was generated from the following files:

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