misc: Adopt the gem5 namespace
Apply the gem5 namespace to the codebase. Some anonymous namespaces could theoretically be removed, but since this change's main goal was to keep conflicts at a minimum, it was decided not to modify much the general shape of the files. A few missing comments of the form "// namespace X" that occurred before the newly added "} // namespace gem5" have been added for consistency. std out should not be included in the gem5 namespace, so they weren't. ProtoMessage has not been included in the gem5 namespace, since I'm not familiar with how proto works. Regarding the SystemC files, although they belong to gem5, they actually perform integration between gem5 and SystemC; therefore, it deserved its own separate namespace. Files that are automatically generated have been included in the gem5 namespace. The .isa files currently are limited to a single namespace. This limitation should be later removed to make it easier to accomodate a better API. Regarding the files in util, gem5:: was prepended where suitable. Notice that this patch was tested as much as possible given that most of these were already not previously compiling. Change-Id: Ia53d404ec79c46edaa98f654e23bc3b0e179fe2d Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/46323 Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu> Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu> Reviewed-by: Matthew Poremba <matthew.poremba@amd.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Daniel Carvalho
parent
d4904b3b89
commit
974a47dfb9
@@ -71,6 +71,8 @@
|
||||
#include "sim/system.hh"
|
||||
#include "stats.hh"
|
||||
|
||||
using namespace gem5;
|
||||
|
||||
// Defining global string variable decalred in stats.hh
|
||||
std::string filename;
|
||||
|
||||
|
||||
@@ -59,8 +59,8 @@ class Gem5TopLevelModule : public Gem5SystemC::Module
|
||||
friend class Gem5Control;
|
||||
|
||||
protected:
|
||||
CxxConfigFileBase *config_file;
|
||||
CxxConfigManager *root_manager;
|
||||
gem5::CxxConfigFileBase *config_file;
|
||||
gem5::CxxConfigManager *root_manager;
|
||||
Gem5SystemC::Logger logger;
|
||||
|
||||
/** Things to do at end_of_elaborate */
|
||||
@@ -87,13 +87,13 @@ class Gem5TopLevelModule : public Gem5SystemC::Module
|
||||
void end_of_elaboration();
|
||||
};
|
||||
|
||||
Gem5System::Gem5System(CxxConfigManager *manager_,
|
||||
Gem5System::Gem5System(gem5::CxxConfigManager *manager_,
|
||||
const std::string &system_name, const std::string &instance_name) :
|
||||
manager(manager_),
|
||||
systemName(system_name),
|
||||
instanceName(instance_name)
|
||||
{
|
||||
manager->addRenaming(CxxConfigManager::Renaming(
|
||||
manager->addRenaming(gem5::CxxConfigManager::Renaming(
|
||||
system_name, instance_name));
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ Gem5System::instantiate()
|
||||
{
|
||||
try {
|
||||
/* Make a new System */
|
||||
SimObject *obj = manager->findObject(systemName, true);
|
||||
gem5::SimObject *obj = manager->findObject(systemName, true);
|
||||
|
||||
/* Add the System's objects to the list of managed
|
||||
* objects for initialisation */
|
||||
@@ -142,7 +142,7 @@ Gem5System::instantiate()
|
||||
manager->instantiate(false);
|
||||
manager->initState();
|
||||
manager->startup();
|
||||
} catch (CxxConfigManager::Exception &e) {
|
||||
} catch (gem5::CxxConfigManager::Exception &e) {
|
||||
fatal("Config problem in Gem5System: %s: %s",
|
||||
e.name, e.message);
|
||||
}
|
||||
@@ -165,19 +165,19 @@ Gem5Control::registerEndOfElaboration(void (*func)())
|
||||
void
|
||||
Gem5Control::setDebugFlag(const char *flag)
|
||||
{
|
||||
::setDebugFlag(flag);
|
||||
::gem5::setDebugFlag(flag);
|
||||
}
|
||||
|
||||
void
|
||||
Gem5Control::clearDebugFlag(const char *flag)
|
||||
{
|
||||
::clearDebugFlag(flag);
|
||||
::gem5::clearDebugFlag(flag);
|
||||
}
|
||||
|
||||
void
|
||||
Gem5Control::setRemoteGDBPort(unsigned int port)
|
||||
{
|
||||
::setRemoteGDBPort(port);
|
||||
::gem5::setRemoteGDBPort(port);
|
||||
}
|
||||
|
||||
Gem5System *
|
||||
@@ -185,7 +185,7 @@ Gem5Control::makeSystem(const std::string &system_name,
|
||||
const std::string &instance_name)
|
||||
{
|
||||
Gem5System *ret = new Gem5System(
|
||||
new CxxConfigManager(*(module->config_file)),
|
||||
new gem5::CxxConfigManager(*(module->config_file)),
|
||||
system_name, instance_name);
|
||||
|
||||
return ret;
|
||||
@@ -214,10 +214,10 @@ Gem5TopLevelModule::Gem5TopLevelModule(sc_core::sc_module_name name,
|
||||
{
|
||||
SC_THREAD(run);
|
||||
|
||||
cxxConfigInit();
|
||||
gem5::cxxConfigInit();
|
||||
|
||||
/* Pass DPRINTF messages to SystemC */
|
||||
Trace::setDebugLogger(&logger);
|
||||
gem5::Trace::setDebugLogger(&logger);
|
||||
|
||||
/* @todo need this as an option */
|
||||
Gem5SystemC::setTickFrequency();
|
||||
@@ -233,13 +233,14 @@ Gem5TopLevelModule::Gem5TopLevelModule(sc_core::sc_module_name name,
|
||||
}
|
||||
|
||||
/* Enable keyboard interrupt, async I/O etc. */
|
||||
initSignals();
|
||||
gem5::initSignals();
|
||||
|
||||
/* Enable stats */
|
||||
statistics::initSimStats();
|
||||
statistics::registerHandlers(CxxConfig::statsReset, CxxConfig::statsDump);
|
||||
gem5::statistics::initSimStats();
|
||||
gem5::statistics::registerHandlers(gem5::CxxConfig::statsReset,
|
||||
gem5::CxxConfig::statsDump);
|
||||
|
||||
Trace::enable();
|
||||
gem5::Trace::enable();
|
||||
|
||||
config_file = new CxxIniFile();
|
||||
|
||||
@@ -248,13 +249,13 @@ Gem5TopLevelModule::Gem5TopLevelModule(sc_core::sc_module_name name,
|
||||
config_filename);
|
||||
}
|
||||
|
||||
root_manager = new CxxConfigManager(*config_file);
|
||||
root_manager = new gem5::CxxConfigManager(*config_file);
|
||||
|
||||
CxxConfig::statsEnable();
|
||||
gem5::CxxConfig::statsEnable();
|
||||
|
||||
/* Make the root object */
|
||||
try {
|
||||
SimObject *root = root_manager->findObject("root", false);
|
||||
gem5::SimObject *root = root_manager->findObject("root", false);
|
||||
|
||||
/* Make sure we don't traverse into root's children */
|
||||
root_manager->objectsInOrder.push_back(root);
|
||||
@@ -262,7 +263,7 @@ Gem5TopLevelModule::Gem5TopLevelModule(sc_core::sc_module_name name,
|
||||
root_manager->instantiate(false);
|
||||
root_manager->initState();
|
||||
root_manager->startup();
|
||||
} catch (CxxConfigManager::Exception &e) {
|
||||
} catch (gem5::CxxConfigManager::Exception &e) {
|
||||
fatal("Config problem in Gem5TopLevelModule: %s: %s",
|
||||
e.name, e.message);
|
||||
}
|
||||
@@ -277,11 +278,11 @@ Gem5TopLevelModule::~Gem5TopLevelModule()
|
||||
void
|
||||
Gem5TopLevelModule::run()
|
||||
{
|
||||
GlobalSimLoopExitEvent *exit_event = NULL;
|
||||
gem5::GlobalSimLoopExitEvent *exit_event = NULL;
|
||||
|
||||
exit_event = simulate();
|
||||
|
||||
std::cerr << "Exit at tick " << curTick()
|
||||
std::cerr << "Exit at tick " << gem5::curTick()
|
||||
<< ", cause: " << exit_event->getCause() << '\n';
|
||||
|
||||
getEventQueue(0)->dump();
|
||||
@@ -304,4 +305,3 @@ makeGem5Control(const std::string &config_filename)
|
||||
{
|
||||
return new Gem5SystemC::Gem5Control(config_filename);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,10 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace gem5
|
||||
{
|
||||
class CxxConfigManager;
|
||||
} // namespace gem5
|
||||
|
||||
namespace Gem5SystemC
|
||||
{
|
||||
@@ -63,7 +66,7 @@ namespace Gem5SystemC
|
||||
class Gem5TopLevelModule;
|
||||
class Gem5Control;
|
||||
|
||||
/** Gem5System's wrap CxxConfigManager's instantiating a gem5 System
|
||||
/** Gem5System's wrap gem5::CxxConfigManager's instantiating a gem5 System
|
||||
* object (and its children). New Gem5Systems are created by
|
||||
* Gem5Control::makeSystem. A new system can have its parameters
|
||||
* tweaked using setParam{,Vector} before being instantiated using
|
||||
@@ -85,7 +88,7 @@ class Gem5System
|
||||
private:
|
||||
/** Config management for *just* this system's objects (notably
|
||||
* excluding root */
|
||||
CxxConfigManager *manager;
|
||||
gem5::CxxConfigManager *manager;
|
||||
|
||||
/** The config file prototype for the system */
|
||||
std::string systemName;
|
||||
@@ -95,7 +98,7 @@ class Gem5System
|
||||
|
||||
public:
|
||||
/** A constructor only used by Gem5Control */
|
||||
Gem5System(CxxConfigManager *manager_,
|
||||
Gem5System(gem5::CxxConfigManager *manager_,
|
||||
const std::string &system_name, const std::string &instance_name);
|
||||
|
||||
virtual ~Gem5System();
|
||||
@@ -110,7 +113,7 @@ class Gem5System
|
||||
|
||||
/** Build the system's gem5 infrastructure, bind its ports (note
|
||||
* that all ports *must* be internal to the system), init and
|
||||
* SimObject::startup the system */
|
||||
* gem5::SimObject::startup the system */
|
||||
virtual void instantiate();
|
||||
};
|
||||
|
||||
|
||||
@@ -60,9 +60,9 @@ class CuttingStreambuf : public std::streambuf
|
||||
std::ostringstream line;
|
||||
|
||||
/** Logger to send complete lines to */
|
||||
Trace::Logger *logger;
|
||||
gem5::Trace::Logger *logger;
|
||||
|
||||
CuttingStreambuf(Trace::Logger *logger_) : logger(logger_)
|
||||
CuttingStreambuf(gem5::Trace::Logger *logger_) : logger(logger_)
|
||||
{ }
|
||||
|
||||
/** Accumulate to line up to \n and then emit */
|
||||
@@ -130,7 +130,7 @@ Logger::~Logger()
|
||||
|
||||
/** Log a single message as a single sc_report call */
|
||||
void
|
||||
Logger::logMessage(Tick when, const std::string &name,
|
||||
Logger::logMessage(gem5::Tick when, const std::string &name,
|
||||
const std::string &flag, const std::string &message)
|
||||
{
|
||||
/* Need to chop the newline off the message */
|
||||
@@ -147,4 +147,4 @@ Logger::getOstream()
|
||||
return stream;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Gem5SystemC
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Gem5SystemC
|
||||
{
|
||||
|
||||
/** sc_report logging class */
|
||||
class Logger : public Trace::Logger
|
||||
class Logger : public gem5::Trace::Logger
|
||||
{
|
||||
protected:
|
||||
/** Stream to offer getOstream. This will cut messages up newlines and
|
||||
@@ -67,7 +67,7 @@ class Logger : public Trace::Logger
|
||||
~Logger();
|
||||
|
||||
/** Log a single message as a single sc_report call */
|
||||
void logMessage(Tick when, const std::string &name,
|
||||
void logMessage(gem5::Tick when, const std::string &name,
|
||||
const std::string &flag, const std::string &message) override;
|
||||
|
||||
std::ostream &getOstream();
|
||||
|
||||
@@ -51,6 +51,9 @@
|
||||
* most one Gem5Module instantiated in any simulation.
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "base/compiler.hh"
|
||||
#include "base/logging.hh"
|
||||
#include "base/pollevent.hh"
|
||||
#include "base/trace.hh"
|
||||
@@ -70,8 +73,8 @@ namespace Gem5SystemC
|
||||
void
|
||||
setTickFrequency()
|
||||
{
|
||||
::setClockFrequency(1000000000000);
|
||||
::fixClockFrequency();
|
||||
::gem5::setClockFrequency(1000000000000);
|
||||
::gem5::fixClockFrequency();
|
||||
}
|
||||
|
||||
Module::Module(sc_core::sc_module_name name) : sc_core::sc_channel(name),
|
||||
@@ -87,7 +90,7 @@ Module::Module(sc_core::sc_module_name name) : sc_core::sc_channel(name),
|
||||
}
|
||||
|
||||
void
|
||||
Module::SCEventQueue::wakeup(Tick when)
|
||||
Module::SCEventQueue::wakeup(gem5::Tick when)
|
||||
{
|
||||
DPRINTF(Event, "waking up SCEventQueue\n");
|
||||
/* Don't bother to use 'when' for now */
|
||||
@@ -101,17 +104,17 @@ Module::setupEventQueues(Module &module)
|
||||
"Gem5SystemC::Module::setupEventQueues must be called"
|
||||
" before any gem5 event queues are set up");
|
||||
|
||||
numMainEventQueues = 1;
|
||||
mainEventQueue.push_back(new SCEventQueue("events", module));
|
||||
curEventQueue(getEventQueue(0));
|
||||
gem5::numMainEventQueues = 1;
|
||||
gem5::mainEventQueue.push_back(new SCEventQueue("events", module));
|
||||
gem5::curEventQueue(getEventQueue(0));
|
||||
}
|
||||
|
||||
void
|
||||
Module::catchup()
|
||||
{
|
||||
EventQueue *eventq = getEventQueue(0);
|
||||
Tick systemc_time = sc_core::sc_time_stamp().value();
|
||||
Tick gem5_time = curTick();
|
||||
gem5::EventQueue *eventq = getEventQueue(0);
|
||||
gem5::Tick systemc_time = sc_core::sc_time_stamp().value();
|
||||
gem5::Tick gem5_time = gem5::curTick();
|
||||
|
||||
/* gem5 time *must* lag SystemC as SystemC is the master */
|
||||
fatal_if(gem5_time > systemc_time, "gem5 time must lag SystemC time"
|
||||
@@ -120,7 +123,7 @@ Module::catchup()
|
||||
eventq->setCurTick(systemc_time);
|
||||
|
||||
if (!eventq->empty()) {
|
||||
Tick next_event_time M5_VAR_USED = eventq->nextTick();
|
||||
gem5::Tick next_event_time M5_VAR_USED = eventq->nextTick();
|
||||
|
||||
fatal_if(gem5_time > next_event_time,
|
||||
"Missed an event at time %d gem5: %d, SystemC: %d",
|
||||
@@ -137,14 +140,14 @@ Module::notify(sc_core::sc_time time_from_now)
|
||||
void
|
||||
Module::serviceAsyncEvent()
|
||||
{
|
||||
EventQueue *eventq = getEventQueue(0);
|
||||
std::lock_guard<EventQueue> lock(*eventq);
|
||||
gem5::EventQueue *eventq = gem5::getEventQueue(0);
|
||||
std::lock_guard<gem5::EventQueue> lock(*eventq);
|
||||
|
||||
assert(async_event);
|
||||
|
||||
/* Catch up gem5 time with SystemC time so that any event here won't
|
||||
* be in the past relative to the current time */
|
||||
Tick systemc_time = sc_core::sc_time_stamp().value();
|
||||
gem5::Tick systemc_time = sc_core::sc_time_stamp().value();
|
||||
|
||||
/* Move time on to match SystemC */
|
||||
catchup();
|
||||
@@ -158,7 +161,7 @@ Module::serviceAsyncEvent()
|
||||
|
||||
if (async_exit) {
|
||||
async_exit = false;
|
||||
exitSimLoop("user interrupt received");
|
||||
gem5::exitSimLoop("user interrupt received");
|
||||
}
|
||||
|
||||
if (async_io) {
|
||||
@@ -173,7 +176,7 @@ Module::serviceAsyncEvent()
|
||||
void
|
||||
Module::serviceExternalEvent()
|
||||
{
|
||||
EventQueue *eventq = getEventQueue(0);
|
||||
gem5::EventQueue *eventq = getEventQueue(0);
|
||||
|
||||
if (!in_simulate && !async_event)
|
||||
warn("Gem5SystemC external event received while not in simulate");
|
||||
@@ -188,7 +191,7 @@ Module::serviceExternalEvent()
|
||||
void
|
||||
Module::eventLoop()
|
||||
{
|
||||
EventQueue *eventq = getEventQueue(0);
|
||||
gem5::EventQueue *eventq = getEventQueue(0);
|
||||
|
||||
fatal_if(!in_simulate, "Gem5SystemC event loop entered while"
|
||||
" outside Gem5SystemC::Module::simulate");
|
||||
@@ -197,12 +200,12 @@ Module::eventLoop()
|
||||
serviceAsyncEvent();
|
||||
|
||||
while (!eventq->empty()) {
|
||||
Tick next_event_time = eventq->nextTick();
|
||||
gem5::Tick next_event_time = eventq->nextTick();
|
||||
|
||||
/* Move time on to match SystemC */
|
||||
catchup();
|
||||
|
||||
Tick gem5_time = curTick();
|
||||
gem5::Tick gem5_time = gem5::curTick();
|
||||
|
||||
/* Woken up early */
|
||||
if (wait_exit_time > sc_core::sc_time_stamp().value()) {
|
||||
@@ -211,7 +214,7 @@ Module::eventLoop()
|
||||
}
|
||||
|
||||
if (gem5_time < next_event_time) {
|
||||
Tick wait_period = next_event_time - gem5_time;
|
||||
gem5::Tick wait_period = next_event_time - gem5_time;
|
||||
wait_exit_time = gem5_time + wait_period;
|
||||
|
||||
DPRINTF(Event, "Waiting for %d ticks for next gem5 event\n",
|
||||
@@ -224,7 +227,7 @@ Module::eventLoop()
|
||||
|
||||
return;
|
||||
} else if (gem5_time > next_event_time) {
|
||||
Tick systemc_time = sc_core::sc_time_stamp().value();
|
||||
gem5::Tick systemc_time = sc_core::sc_time_stamp().value();
|
||||
|
||||
/* Missed event, for some reason the above test didn't work
|
||||
* or an event was scheduled in the past */
|
||||
@@ -247,14 +250,15 @@ Module::eventLoop()
|
||||
GlobalSimLoopExitEvent *
|
||||
Module::simulate(Tick num_cycles)
|
||||
{
|
||||
inform("Entering event queue @ %d. Starting simulation...", curTick());
|
||||
inform("Entering event queue @ %d. Starting simulation...",
|
||||
gem5::curTick());
|
||||
|
||||
if (num_cycles < MaxTick - curTick())
|
||||
num_cycles = curTick() + num_cycles;
|
||||
if (num_cycles < gem5::MaxTick - gem5::curTick())
|
||||
num_cycles = gem5::curTick() + num_cycles;
|
||||
else /* counter would roll over or be set to MaxTick anyhow */
|
||||
num_cycles = MaxTick;
|
||||
num_cycles = gem5::MaxTick;
|
||||
|
||||
GlobalEvent *limit_event = new GlobalSimLoopExitEvent(num_cycles,
|
||||
gem5::GlobalEvent *limit_event = new GlobalSimLoopExitEvent(num_cycles,
|
||||
"simulate() limit reached", 0, 0);
|
||||
|
||||
exitEvent = NULL;
|
||||
@@ -277,10 +281,10 @@ Module::simulate(Tick num_cycles)
|
||||
in_simulate = false;
|
||||
|
||||
/* Locate the global exit event */
|
||||
BaseGlobalEvent *global_event = exitEvent->globalEvent();
|
||||
gem5::BaseGlobalEvent *global_event = exitEvent->globalEvent();
|
||||
assert(global_event != NULL);
|
||||
|
||||
GlobalSimLoopExitEvent *global_exit_event =
|
||||
gem5::GlobalSimLoopExitEvent *global_exit_event =
|
||||
dynamic_cast<GlobalSimLoopExitEvent *>(global_event);
|
||||
assert(global_exit_event != NULL);
|
||||
|
||||
@@ -292,4 +296,4 @@ Module::simulate(Tick num_cycles)
|
||||
return global_exit_event;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Gem5SystemC
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
|
||||
#include <systemc>
|
||||
|
||||
#include "base/types.hh"
|
||||
#include "sim/eventq.hh"
|
||||
#include "sim/sim_events.hh"
|
||||
|
||||
@@ -93,7 +94,7 @@ class Module : public sc_core::sc_channel
|
||||
sc_core::sc_event eventLoopEnterEvent;
|
||||
|
||||
/** Expected exit time of last eventLoop sleep */
|
||||
Tick wait_exit_time;
|
||||
gem5::Tick wait_exit_time;
|
||||
|
||||
/** Are we in Module::simulate? Used to mask events when not inside
|
||||
* the simulate loop */
|
||||
@@ -101,18 +102,18 @@ class Module : public sc_core::sc_channel
|
||||
|
||||
/** Placeholder base class for a variant event queue if this becomes
|
||||
* useful */
|
||||
class SCEventQueue : public EventQueue
|
||||
class SCEventQueue : public gem5::EventQueue
|
||||
{
|
||||
protected:
|
||||
Module &module;
|
||||
|
||||
public:
|
||||
SCEventQueue(const std::string &name,
|
||||
Module &module_) : EventQueue(name), module(module_)
|
||||
Module &module_) : gem5::EventQueue(name), module(module_)
|
||||
{ }
|
||||
|
||||
/** Signal module to wakeup */
|
||||
void wakeup(Tick when);
|
||||
void wakeup(gem5::Tick when);
|
||||
};
|
||||
|
||||
/** Service any async event marked up in the globals event_... */
|
||||
@@ -125,7 +126,7 @@ class Module : public sc_core::sc_channel
|
||||
Module(sc_core::sc_module_name name);
|
||||
|
||||
/** Last exitEvent from eventLoop */
|
||||
Event *exitEvent;
|
||||
gem5::Event *exitEvent;
|
||||
|
||||
/** Setup global event queues. Call this before any other event queues
|
||||
* are created */
|
||||
@@ -148,13 +149,14 @@ class Module : public sc_core::sc_channel
|
||||
void eventLoop();
|
||||
|
||||
/** Run eventLoop up to num_cycles and return the final event */
|
||||
GlobalSimLoopExitEvent *simulate(Tick num_cycles = MaxTick);
|
||||
gem5::GlobalSimLoopExitEvent *
|
||||
simulate(gem5::Tick num_cycles = gem5::MaxTick);
|
||||
};
|
||||
|
||||
/** There are assumptions throughout Gem5SystemC file that a tick is 1ps.
|
||||
* Make this the case */
|
||||
void setTickFrequency();
|
||||
|
||||
}
|
||||
} // namespace Gem5SystemC
|
||||
|
||||
#endif // __SIM_SC_MODULE_HH__
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
*
|
||||
* C++-only configuration stats handling example
|
||||
*
|
||||
* Register with: statistics::registerHandlers(statsReset, statsDump)
|
||||
* Register with: gem5::statistics::registerHandlers(statsReset, statsDump)
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
@@ -57,15 +57,15 @@ namespace CxxConfig
|
||||
|
||||
void statsPrepare()
|
||||
{
|
||||
std::list<statistics::Info *> stats = statistics::statsList();
|
||||
std::list<gem5::statistics::Info *> stats = gem5::statistics::statsList();
|
||||
|
||||
/* gather_stats -> prepare */
|
||||
for (auto i = stats.begin(); i != stats.end(); ++i){
|
||||
statistics::Info *stat = *i;
|
||||
statistics::VectorInfo *vector =
|
||||
dynamic_cast<statistics::VectorInfo *>(stat);
|
||||
gem5::statistics::Info *stat = *i;
|
||||
gem5::statistics::VectorInfo *vector =
|
||||
dynamic_cast<gem5::statistics::VectorInfo *>(stat);
|
||||
if (vector){
|
||||
(dynamic_cast<statistics::VectorInfo *>(*i))->prepare();
|
||||
(dynamic_cast<gem5::statistics::VectorInfo *>(*i))->prepare();
|
||||
}
|
||||
else {
|
||||
(*i)->prepare();
|
||||
@@ -77,11 +77,12 @@ void statsPrepare()
|
||||
void statsDump()
|
||||
{
|
||||
bool desc = true;
|
||||
statistics::Output *output = statistics::initText(filename, desc, true);
|
||||
gem5::statistics::Output *output =
|
||||
gem5::statistics::initText(filename, desc, true);
|
||||
|
||||
statistics::processDumpQueue();
|
||||
gem5::statistics::processDumpQueue();
|
||||
|
||||
std::list<statistics::Info *> stats = statistics::statsList();
|
||||
std::list<gem5::statistics::Info *> stats = gem5::statistics::statsList();
|
||||
|
||||
statsEnable();
|
||||
statsPrepare();
|
||||
@@ -89,32 +90,33 @@ void statsDump()
|
||||
output->begin();
|
||||
/* gather_stats -> convert_value */
|
||||
for (auto i = stats.begin(); i != stats.end(); ++i) {
|
||||
statistics::Info *stat = *i;
|
||||
gem5::statistics::Info *stat = *i;
|
||||
|
||||
const statistics::ScalarInfo *scalar =
|
||||
dynamic_cast<statistics::ScalarInfo *>(stat);
|
||||
statistics::VectorInfo *vector =
|
||||
dynamic_cast<statistics::VectorInfo *>(stat);
|
||||
const statistics::Vector2dInfo *vector2d =
|
||||
dynamic_cast<statistics::Vector2dInfo *>(vector);
|
||||
const statistics::DistInfo *dist =
|
||||
dynamic_cast<statistics::DistInfo *>(stat);
|
||||
const statistics::VectorDistInfo *vectordist =
|
||||
dynamic_cast<statistics::VectorDistInfo *>(stat);
|
||||
const statistics::SparseHistInfo *sparse =
|
||||
dynamic_cast<statistics::SparseHistInfo *>(stat);
|
||||
const statistics::InfoProxy <statistics::Vector2d,
|
||||
statistics::Vector2dInfo> *info =
|
||||
dynamic_cast<statistics::InfoProxy
|
||||
<statistics::Vector2d,statistics::Vector2dInfo>*>(stat);
|
||||
const gem5::statistics::ScalarInfo *scalar =
|
||||
dynamic_cast<gem5::statistics::ScalarInfo *>(stat);
|
||||
gem5::statistics::VectorInfo *vector =
|
||||
dynamic_cast<gem5::statistics::VectorInfo *>(stat);
|
||||
const gem5::statistics::Vector2dInfo *vector2d =
|
||||
dynamic_cast<gem5::statistics::Vector2dInfo *>(vector);
|
||||
const gem5::statistics::DistInfo *dist =
|
||||
dynamic_cast<gem5::statistics::DistInfo *>(stat);
|
||||
const gem5::statistics::VectorDistInfo *vectordist =
|
||||
dynamic_cast<gem5::statistics::VectorDistInfo *>(stat);
|
||||
const gem5::statistics::SparseHistInfo *sparse =
|
||||
dynamic_cast<gem5::statistics::SparseHistInfo *>(stat);
|
||||
const gem5::statistics::InfoProxy <gem5::statistics::Vector2d,
|
||||
gem5::statistics::Vector2dInfo> *info =
|
||||
dynamic_cast<gem5::statistics::InfoProxy
|
||||
<gem5::statistics::Vector2d,
|
||||
gem5::statistics::Vector2dInfo>*>(stat);
|
||||
|
||||
if (vector) {
|
||||
const statistics::FormulaInfo *formula =
|
||||
dynamic_cast<statistics::FormulaInfo *>(vector);
|
||||
const gem5::statistics::FormulaInfo *formula =
|
||||
dynamic_cast<gem5::statistics::FormulaInfo *>(vector);
|
||||
if (formula){
|
||||
output->visit(*formula);
|
||||
} else {
|
||||
const statistics::VectorInfo *vector1 = vector;
|
||||
const gem5::statistics::VectorInfo *vector1 = vector;
|
||||
output->visit(*vector1);
|
||||
}
|
||||
} else if (vector2d) {
|
||||
@@ -140,19 +142,19 @@ void statsReset()
|
||||
{
|
||||
std::cerr << "Stats reset\n";
|
||||
|
||||
statistics::processResetQueue();
|
||||
gem5::statistics::processResetQueue();
|
||||
}
|
||||
|
||||
void statsEnable()
|
||||
{
|
||||
std::list<statistics::Info *> stats = statistics::statsList();
|
||||
std::list<gem5::statistics::Info *> stats = gem5::statistics::statsList();
|
||||
|
||||
for (auto i = stats.begin(); i != stats.end(); ++i){
|
||||
statistics::Info *stat = *i;
|
||||
statistics::VectorInfo *vector =
|
||||
dynamic_cast<statistics::VectorInfo *>(stat);
|
||||
gem5::statistics::Info *stat = *i;
|
||||
gem5::statistics::VectorInfo *vector =
|
||||
dynamic_cast<gem5::statistics::VectorInfo *>(stat);
|
||||
if (vector){
|
||||
(dynamic_cast<statistics::VectorInfo *>(*i))->enable();
|
||||
(dynamic_cast<gem5::statistics::VectorInfo *>(*i))->enable();
|
||||
}
|
||||
else {
|
||||
(*i)->enable();
|
||||
|
||||
Reference in New Issue
Block a user