/*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2000-2004 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "base/misc.hh"
#include "base/pollevent.hh"
#include "base/statistics.hh"
+#include "base/time.hh"
#include "cpu/base_cpu.hh"
#include "cpu/full_cpu/smt.hh"
#include "sim/async.hh"
#include "sim/host.hh"
#include "sim/sim_events.hh"
#include "sim/sim_exit.hh"
+#include "sim/sim_init.hh"
#include "sim/sim_object.hh"
-#include "sim/sim_stats.hh"
-#include "sim/sim_time.hh"
+#include "sim/stat_control.hh"
+#include "sim/stats.hh"
+#include "sim/universe.hh"
using namespace std;
myProgName = argv[0];
signal(SIGFPE, SIG_IGN); // may occur on misspeculated paths
- signal(SIGPIPE, SIG_IGN);
signal(SIGTRAP, SIG_IGN);
signal(SIGUSR1, dumpStatsHandler); // dump intermediate stats
signal(SIGUSR2, dumprstStatsHandler); // dump and reset stats
sayHello(cerr);
// Initialize statistics database
- initBaseStats();
+ Stats::InitSimStats();
vector<char *> cppArgs;
// Print hello message to stats file if it's actually a file. If
// it's not (i.e. it's cout or cerr) then we already did it above.
- if (statStreamIsFile)
- sayHello(*statStream);
+ if (outputStream != &cout && outputStream != &cerr)
+ sayHello(*outputStream);
// Echo command line and all parameter settings to stats file as well.
- echoCommandLine(argc, argv, *statStream);
- ParamContext::showAllContexts(*statStream);
+ echoCommandLine(argc, argv, *outputStream);
+ ParamContext::showAllContexts(builderStream());
// Now process the configuration hierarchy and create the SimObjects.
ConfigHierarchy configHierarchy(simConfigDB);
#endif
// Check to make sure that the stats package is properly initialized
- Statistics::check();
+ Stats::check();
+
+ // Reset to put the stats in a consistent state.
+ Stats::reset();
// Nothing to simulate if we don't have at least one CPU somewhere.
if (BaseCPU::numSimulatedCPUs() == 0) {
exit(1);
}
+ SimInit();
+ warn("Entering event queue. Starting simulation...\n");
+
while (!mainEventQueue.empty()) {
assert(curTick <= mainEventQueue.nextTick() &&
"event scheduled in the past");
if (async_dump) {
async_dump = false;
- using namespace Statistics;
+ using namespace Stats;
SetupEvent(Dump, curTick);
}
if (async_dumpreset) {
async_dumpreset = false;
- using namespace Statistics;
+ using namespace Stats;
SetupEvent(Dump | Reset, curTick);
}
// simulation to terminate (hit max cycles/insts, signal,
// simulated system halts/exits) generates an exit event, so we
// should never run out of events on the queue.
- exitNow("improperly exited event loop!", 1);
+ exitNow("no events on event loop! All CPUs must be idle.", 1);
return 0;
}