gem5  v20.1.0.0
Classes | Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
ThreadState Struct Reference

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

#include <thread_state.hh>

Inheritance diagram for ThreadState:
Serializable SimpleThread

Classes

struct  ThreadStateStats
 

Public Types

typedef ThreadContext::Status Status
 

Public Member Functions

 ThreadState (BaseCPU *cpu, ThreadID _tid, Process *_process)
 
virtual ~ThreadState ()
 
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
 
void initMemProxies (ThreadContext *tc)
 Initialise the physical and virtual port proxies and tie them to the data port of the CPU. More...
 
PortProxygetPhysProxy ()
 
PortProxygetVirtProxy ()
 
ProcessgetProcessPtr ()
 
void setProcessPtr (Process *p)
 
Counter readFuncExeInst () const
 Reads the number of instructions functionally executed and committed. More...
 
void setFuncExeInst (Counter new_val)
 Sets the total number of instructions functionally executed and committed. More...
 
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 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...
 
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...
 
Counter funcExeInst
 
unsigned storeCondFailures
 

Protected Attributes

ThreadContext::Status _status
 
BaseCPUbaseCpu
 
ContextID _contextId
 
ThreadID _threadId
 
Processprocess
 
PortProxyphysProxy
 A port proxy outgoing only for functional accesses to physical addresses. More...
 
PortProxyvirtProxy
 A translating port proxy, outgoing only, for functional accesse to virtual addresses. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Serializable
static const std::string & currentSection ()
 Gets the fully-qualified name of the active section. More...
 
static void serializeAll (const std::string &cpt_dir)
 Serializes all the SimObjects. More...
 
static void unserializeGlobals (CheckpointIn &cp)
 

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 46 of file thread_state.hh.

Member Typedef Documentation

◆ Status

Definition at line 47 of file thread_state.hh.

Constructor & Destructor Documentation

◆ ThreadState()

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

Definition at line 41 of file thread_state.cc.

◆ ~ThreadState()

ThreadState::~ThreadState ( )
virtual

Definition at line 51 of file thread_state.cc.

References physProxy, and virtProxy.

Member Function Documentation

◆ contextId()

ContextID ThreadState::contextId ( ) const
inline

Definition at line 61 of file thread_state.hh.

References _contextId.

Referenced by SimpleThread::contextId().

◆ cpuId()

int ThreadState::cpuId ( ) const
inline

Definition at line 57 of file thread_state.hh.

References baseCpu, and BaseCPU::cpuId().

Referenced by SimpleThread::cpuId().

◆ getPhysProxy()

PortProxy & ThreadState::getPhysProxy ( )

Definition at line 107 of file thread_state.cc.

References FullSystem, and physProxy.

Referenced by SimpleThread::getPhysProxy().

◆ getProcessPtr()

Process* ThreadState::getProcessPtr ( )
inline

Definition at line 85 of file thread_state.hh.

References process.

Referenced by SimpleThread::getProcessPtr().

◆ getVirtProxy()

PortProxy & ThreadState::getVirtProxy ( )

Definition at line 115 of file thread_state.cc.

References virtProxy.

Referenced by SimpleThread::getVirtProxy().

◆ initMemProxies()

void ThreadState::initMemProxies ( ThreadContext tc)

Initialise the physical and virtual port proxies and tie them to the data port of the CPU.

Parameters
tcThreadContext for the virtual-to-physical translation

Definition at line 83 of file thread_state.cc.

References baseCpu, BaseCPU::cacheLineSize(), FullSystem, BaseCPU::getSendFunctional(), SETranslatingPortProxy::NextPage, physProxy, and virtProxy.

Referenced by SimpleThread::initMemProxies().

◆ readFuncExeInst()

Counter ThreadState::readFuncExeInst ( ) const
inline

Reads the number of instructions functionally executed and committed.

Definition at line 92 of file thread_state.hh.

References funcExeInst.

Referenced by SimpleThread::readFuncExeInst().

◆ readLastActivate()

Tick ThreadState::readLastActivate ( ) const
inline

Definition at line 69 of file thread_state.hh.

References lastActivate.

Referenced by SimpleThread::readLastActivate().

◆ readLastSuspend()

Tick ThreadState::readLastSuspend ( ) const
inline

Definition at line 71 of file thread_state.hh.

References lastSuspend.

Referenced by SimpleThread::readLastSuspend().

◆ serialize()

void ThreadState::serialize ( CheckpointOut cp) const
overridevirtual

Serialize an object.

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

Parameters
cpCheckpoint state

Implements Serializable.

Definition at line 60 of file thread_state.cc.

References _status, FullSystem, funcExeInst, SERIALIZE_ENUM, and SERIALIZE_SCALAR.

Referenced by O3ThreadState< Impl >::serialize(), and SimpleThread::serialize().

◆ setContextId()

void ThreadState::setContextId ( ContextID  id)
inline

Definition at line 63 of file thread_state.hh.

References _contextId, and ArmISA::id.

Referenced by SimpleThread::setContextId().

◆ setFuncExeInst()

void ThreadState::setFuncExeInst ( Counter  new_val)
inline

Sets the total number of instructions functionally executed and committed.

Definition at line 97 of file thread_state.hh.

References funcExeInst.

◆ setProcessPtr()

void ThreadState::setProcessPtr ( Process p)
inline

Definition at line 87 of file thread_state.hh.

References MipsISA::p, and process.

Referenced by SimpleThread::setProcessPtr().

◆ setStatus()

void ThreadState::setStatus ( Status  new_status)
inline

Sets the status of this thread.

Definition at line 103 of file thread_state.hh.

References _status.

◆ setThreadId()

void ThreadState::setThreadId ( ThreadID  id)
inline

Definition at line 65 of file thread_state.hh.

References _threadId, and ArmISA::id.

Referenced by SimpleThread::setThreadId().

◆ socketId()

uint32_t ThreadState::socketId ( ) const
inline

Definition at line 59 of file thread_state.hh.

References baseCpu, and BaseCPU::socketId().

Referenced by SimpleThread::socketId().

◆ status()

Status ThreadState::status ( ) const
inline

Returns the status of this thread.

Definition at line 100 of file thread_state.hh.

References _status.

◆ threadId()

ThreadID ThreadState::threadId ( ) const
inline

Definition at line 67 of file thread_state.hh.

References _threadId.

Referenced by SimpleThread::threadId().

◆ unserialize()

void ThreadState::unserialize ( CheckpointIn cp)
overridevirtual

Unserialize an object.

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

Parameters
cpCheckpoint state

Implements Serializable.

Definition at line 71 of file thread_state.cc.

References _status, FullSystem, funcExeInst, UNSERIALIZE_ENUM, and UNSERIALIZE_SCALAR.

Referenced by O3ThreadState< Impl >::unserialize(), and SimpleThread::unserialize().

Member Data Documentation

◆ _contextId

ContextID ThreadState::_contextId
protected

Definition at line 138 of file thread_state.hh.

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

◆ _status

ThreadContext::Status ThreadState::_status
protected

◆ _threadId

ThreadID ThreadState::_threadId
protected

◆ baseCpu

BaseCPU* ThreadState::baseCpu
protected

◆ funcExeInst

Counter ThreadState::funcExeInst

◆ lastActivate

Tick ThreadState::lastActivate

Last time activate was called on this thread.

Definition at line 145 of file thread_state.hh.

Referenced by SimpleThread::activate(), BaseKvmCPU::activateContext(), readLastActivate(), and SimpleThread::suspend().

◆ lastSuspend

Tick ThreadState::lastSuspend

Last time suspend was called on this thread.

Definition at line 148 of file thread_state.hh.

Referenced by BaseKvmCPU::activateContext(), readLastSuspend(), and SimpleThread::suspend().

◆ numInst

Counter ThreadState::numInst

Number of instructions committed.

Definition at line 108 of file thread_state.hh.

Referenced by Minor::Execute::doInstCommitAccounting().

◆ numLoad

Counter ThreadState::numLoad

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

Definition at line 126 of file thread_state.hh.

◆ numOp

Counter ThreadState::numOp

Number of ops (including micro ops) committed.

Definition at line 110 of file thread_state.hh.

Referenced by Minor::Execute::doInstCommitAccounting().

◆ physProxy

PortProxy* ThreadState::physProxy
protected

A port proxy outgoing only for functional accesses to physical addresses.

Definition at line 155 of file thread_state.hh.

Referenced by getPhysProxy(), initMemProxies(), and ~ThreadState().

◆ process

Process* ThreadState::process
protected

Definition at line 151 of file thread_state.hh.

Referenced by getProcessPtr(), setProcessPtr(), and SimpleThread::syscall().

◆ startNumLoad

Counter ThreadState::startNumLoad

The number of simulated loads committed prior to this run.

Definition at line 129 of file thread_state.hh.

◆ storeCondFailures

unsigned ThreadState::storeCondFailures

◆ threadStats

ThreadState::ThreadStateStats ThreadState::threadStats

◆ virtProxy

PortProxy* ThreadState::virtProxy
protected

A translating port proxy, outgoing only, for functional accesse to virtual addresses.

Definition at line 159 of file thread_state.hh.

Referenced by getVirtProxy(), initMemProxies(), and ~ThreadState().


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

Generated on Wed Sep 30 2020 14:02:33 for gem5 by doxygen 1.8.17