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.
This commit is contained in:
parent
1e1cd2dc01
commit
4596a33e10
1 changed files with 6 additions and 9 deletions
|
@ -228,15 +228,13 @@ main(int argc, char **argv)
|
||||||
if (checkpoint_save) {
|
if (checkpoint_save) {
|
||||||
exit_event = simulate(pre_run_time);
|
exit_event = simulate(pre_run_time);
|
||||||
|
|
||||||
DrainManager drain_manager;
|
|
||||||
unsigned int drain_count = 1;
|
unsigned int drain_count = 1;
|
||||||
do {
|
do {
|
||||||
drain_count = config_manager->drain(&drain_manager);
|
drain_count = config_manager->drain();
|
||||||
|
|
||||||
std::cerr << "Draining " << drain_count << '\n';
|
std::cerr << "Draining " << drain_count << '\n';
|
||||||
|
|
||||||
if (drain_count > 0) {
|
if (drain_count > 0) {
|
||||||
drain_manager.setCount(drain_count);
|
|
||||||
exit_event = simulate();
|
exit_event = simulate();
|
||||||
}
|
}
|
||||||
} while (drain_count > 0);
|
} while (drain_count > 0);
|
||||||
|
@ -259,11 +257,12 @@ main(int argc, char **argv)
|
||||||
if (checkpoint_restore) {
|
if (checkpoint_restore) {
|
||||||
std::cerr << "Restoring checkpoint\n";
|
std::cerr << "Restoring checkpoint\n";
|
||||||
|
|
||||||
Checkpoint *checkpoint = new Checkpoint(checkpoint_dir,
|
CheckpointIn *checkpoint = new CheckpointIn(checkpoint_dir,
|
||||||
config_manager->getSimObjectResolver());
|
config_manager->getSimObjectResolver());
|
||||||
|
|
||||||
Serializable::unserializeGlobals(checkpoint);
|
DrainManager::instance().preCheckpointRestore();
|
||||||
config_manager->loadState(checkpoint);
|
Serializable::unserializeGlobals(*checkpoint);
|
||||||
|
config_manager->loadState(*checkpoint);
|
||||||
config_manager->startup();
|
config_manager->startup();
|
||||||
|
|
||||||
config_manager->drainResume();
|
config_manager->drainResume();
|
||||||
|
@ -281,15 +280,13 @@ main(int argc, char **argv)
|
||||||
BaseCPU &old_cpu = config_manager->getObject<BaseCPU>(from_cpu);
|
BaseCPU &old_cpu = config_manager->getObject<BaseCPU>(from_cpu);
|
||||||
BaseCPU &new_cpu = config_manager->getObject<BaseCPU>(to_cpu);
|
BaseCPU &new_cpu = config_manager->getObject<BaseCPU>(to_cpu);
|
||||||
|
|
||||||
DrainManager drain_manager;
|
|
||||||
unsigned int drain_count = 1;
|
unsigned int drain_count = 1;
|
||||||
do {
|
do {
|
||||||
drain_count = config_manager->drain(&drain_manager);
|
drain_count = config_manager->drain();
|
||||||
|
|
||||||
std::cerr << "Draining " << drain_count << '\n';
|
std::cerr << "Draining " << drain_count << '\n';
|
||||||
|
|
||||||
if (drain_count > 0) {
|
if (drain_count > 0) {
|
||||||
drain_manager.setCount(drain_count);
|
|
||||||
exit_event = simulate();
|
exit_event = simulate();
|
||||||
}
|
}
|
||||||
} while (drain_count > 0);
|
} while (drain_count > 0);
|
||||||
|
|
Loading…
Reference in a new issue