gem5  v21.2.0.0
Classes | Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
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::o3::ThreadState gem5::SimpleThread

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. More...
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object. More...
 
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. More...
 
void setStatus (Status new_status)
 Sets the status of this thread. More...
 
- 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. More...
 
void serializeSection (CheckpointOut &cp, const std::string &name) const
 
void unserializeSection (CheckpointIn &cp, const char *name)
 Unserialize an a child object. More...
 
void unserializeSection (CheckpointIn &cp, const std::string &name)
 

Public Attributes

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

Protected Attributes

ThreadContext::Status _status
 
BaseCPU * baseCpu
 
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. More...
 
static void generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream)
 Generate a checkpoint file so that the serialization can be routed to it. More...
 

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

Definition at line 49 of file thread_state.hh.

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.

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.

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()

ThreadID gem5::ThreadState::threadId ( ) const
inline

◆ 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

ThreadContext::Status gem5::ThreadState::_status
protected

◆ _threadId

ThreadID gem5::ThreadState::_threadId
protected

◆ baseCpu

BaseCPU* gem5::ThreadState::baseCpu
protected

◆ lastActivate

Tick gem5::ThreadState::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

unsigned gem5::ThreadState::storeCondFailures

◆ threadStats

gem5::ThreadState::ThreadStateStats gem5::ThreadState::threadStats

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

Generated on Tue Dec 21 2021 11:35:14 for gem5 by doxygen 1.8.17