summaryrefslogtreecommitdiff
path: root/util/cxx_config
diff options
context:
space:
mode:
authorAndrew Bardsley <Andrew.Bardsley@arm.com>2015-09-10 16:10:49 +0100
committerAndrew Bardsley <Andrew.Bardsley@arm.com>2015-09-10 16:10:49 +0100
commit4596a33e10ebbab83d757c5c6a9efe9c299a7499 (patch)
tree95c2cf2e33fb5d3a3369d754e72233af0a267571 /util/cxx_config
parent1e1cd2dc01ca2b58ee74c45835c0799c693261ba (diff)
downloadgem5-4596a33e10ebbab83d757c5c6a9efe9c299a7499.tar.xz
sim: Update C++ config example to match SystemC example
Update the use of the drain manager, and checkpointing to match changes to gem5 since the example was written.
Diffstat (limited to 'util/cxx_config')
-rw-r--r--util/cxx_config/main.cc15
1 files changed, 6 insertions, 9 deletions
diff --git a/util/cxx_config/main.cc b/util/cxx_config/main.cc
index 2a9588f2e..0356aeaac 100644
--- a/util/cxx_config/main.cc
+++ b/util/cxx_config/main.cc
@@ -228,15 +228,13 @@ main(int argc, char **argv)
if (checkpoint_save) {
exit_event = simulate(pre_run_time);
- DrainManager drain_manager;
unsigned int drain_count = 1;
do {
- drain_count = config_manager->drain(&drain_manager);
+ drain_count = config_manager->drain();
std::cerr << "Draining " << drain_count << '\n';
if (drain_count > 0) {
- drain_manager.setCount(drain_count);
exit_event = simulate();
}
} while (drain_count > 0);
@@ -259,11 +257,12 @@ main(int argc, char **argv)
if (checkpoint_restore) {
std::cerr << "Restoring checkpoint\n";
- Checkpoint *checkpoint = new Checkpoint(checkpoint_dir,
+ CheckpointIn *checkpoint = new CheckpointIn(checkpoint_dir,
config_manager->getSimObjectResolver());
- Serializable::unserializeGlobals(checkpoint);
- config_manager->loadState(checkpoint);
+ DrainManager::instance().preCheckpointRestore();
+ Serializable::unserializeGlobals(*checkpoint);
+ config_manager->loadState(*checkpoint);
config_manager->startup();
config_manager->drainResume();
@@ -281,15 +280,13 @@ main(int argc, char **argv)
BaseCPU &old_cpu = config_manager->getObject<BaseCPU>(from_cpu);
BaseCPU &new_cpu = config_manager->getObject<BaseCPU>(to_cpu);
- DrainManager drain_manager;
unsigned int drain_count = 1;
do {
- drain_count = config_manager->drain(&drain_manager);
+ drain_count = config_manager->drain();
std::cerr << "Draining " << drain_count << '\n';
if (drain_count > 0) {
- drain_manager.setCount(drain_count);
exit_event = simulate();
}
} while (drain_count > 0);