SMAUG
Simulating Machine Learning Applications on gem5-Aladdin
Classes | Functions
smaug::gem5 Namespace Reference

Contains utility functions for interacting with gem5. More...

Classes

class  ScopedStats
 A RAII helper class which dumps and/or resets gem5 stats at construction and destruction. More...
 

Functions

void switchCpu ()
 Switches to the next CPU type. More...
 
void dumpStats (const char *msg, int period=0)
 Dumps gem5 stats to the stats.txt file. More...
 
void dumpResetStats (const char *msg, int period=0)
 Dumps gem5 stats to the stats.txt file and resets all stats.
 
void quiesce ()
 Puts the CPU to sleep. More...
 
void wakeCpu (int id)
 Wakes up a quiesced CPU.
 
int getCpuId ()
 Returns the logical CPU number. More...
 

Detailed Description

Contains utility functions for interacting with gem5.

In trace mode, these are no-ops.

Function Documentation

◆ dumpStats()

void smaug::gem5::dumpStats ( const char *  msg,
int  period = 0 
)

Dumps gem5 stats to the stats.txt file.

Parameters
msgA section label for this stats dump.
periodDump stats every N cycles. If 0, only dumps stats once.

Definition at line 49 of file utils.cpp.

◆ getCpuId()

int smaug::gem5::getCpuId ( )

Returns the logical CPU number.

This does not implement the cpuid instruction!

Definition at line 71 of file utils.cpp.

◆ quiesce()

void smaug::gem5::quiesce ( )

Puts the CPU to sleep.

When a CPU is sleeping, it will not generate any simulation events, respond to snoop packets, etc. It can be woken with a call to wakeCpu.

Definition at line 59 of file utils.cpp.

◆ switchCpu()

void smaug::gem5::switchCpu ( )

Switches to the next CPU type.

Often used to implement fast-forwarding, in which switchCpu is called just before starting the detailed region of simulation.

Definition at line 44 of file utils.cpp.