summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
Diffstat (limited to 'sim')
-rw-r--r--sim/debug.cc2
-rw-r--r--sim/debug.hh4
-rw-r--r--sim/stat_control.cc26
-rw-r--r--sim/stats.hh6
4 files changed, 24 insertions, 14 deletions
diff --git a/sim/debug.cc b/sim/debug.cc
index 09c604a95..b73ab4245 100644
--- a/sim/debug.cc
+++ b/sim/debug.cc
@@ -40,11 +40,13 @@
using namespace std;
+#ifdef DEBUG
void
debug_break()
{
kill(getpid(), SIGTRAP);
}
+#endif
//
// Debug event: place a breakpoint on the process function and
diff --git a/sim/debug.hh b/sim/debug.hh
index eb0be772e..a4f8b8702 100644
--- a/sim/debug.hh
+++ b/sim/debug.hh
@@ -29,6 +29,10 @@
#ifndef __DEBUG_HH__
#define __DEBUG_HH__
+#ifdef DEBUG
void debug_break();
+#else
+inline void debug_break() { }
+#endif
#endif // __DEBUG_HH__
diff --git a/sim/stat_control.cc b/sim/stat_control.cc
index d6d7e2c91..c7d2fdd5b 100644
--- a/sim/stat_control.cc
+++ b/sim/stat_control.cc
@@ -39,6 +39,7 @@
#include "base/str.hh"
#include "base/time.hh"
#include "base/stats/output.hh"
+#include "cpu/base_cpu.hh"
#include "sim/eventq.hh"
#include "sim/sim_object.hh"
#include "sim/stat_control.hh"
@@ -47,13 +48,14 @@
using namespace std;
Statistics::Formula hostInstRate;
-Statistics::Formula hostMemory;
-Statistics::Formula hostSeconds;
Statistics::Formula hostTickRate;
+Statistics::Value hostMemory;
+Statistics::Value hostSeconds;
-Statistics::Formula simInsts;
+Statistics::Value simTicks;
+Statistics::Value simInsts;
+Statistics::Value simFreq;
Statistics::Formula simSeconds;
-Statistics::Formula simTicks;
namespace Statistics {
@@ -84,6 +86,7 @@ void
InitSimStats()
{
simInsts
+ .functor(BaseCPU::numSimulatedInstructions)
.name("sim_insts")
.desc("Number of instructions simulated")
.precision(0)
@@ -95,7 +98,14 @@ InitSimStats()
.desc("Number of seconds simulated")
;
+ simFreq
+ .scalar(ticksPerSecond)
+ .name("sim_freq")
+ .desc("Frequency of simulated ticks")
+ ;
+
simTicks
+ .scalar(curTick)
.name("sim_ticks")
.desc("Number of ticks simulated")
;
@@ -108,12 +118,14 @@ InitSimStats()
;
hostMemory
+ .functor(memUsage)
.name("host_mem_usage")
.desc("Number of bytes of host memory used")
.prereq(hostMemory)
;
hostSeconds
+ .functor(statElapsedTime)
.name("host_seconds")
.desc("Real time elapsed on the host")
.precision(2)
@@ -125,11 +137,7 @@ InitSimStats()
.precision(0)
;
- simInsts = constant(0);
- simTicks = scalar(curTick) - scalar(startTick);
- simSeconds = simTicks / scalar(ticksPerSecond);
- hostMemory = functor(memUsage);
- hostSeconds = functor(statElapsedTime);
+ simSeconds = simTicks / simFreq;
hostInstRate = simInsts / hostSeconds;
hostTickRate = simTicks / hostSeconds;
diff --git a/sim/stats.hh b/sim/stats.hh
index b736850e7..c5e791cfb 100644
--- a/sim/stats.hh
+++ b/sim/stats.hh
@@ -31,11 +31,7 @@
#include "base/statistics.hh"
-extern Statistics::Formula simTicks;
extern Statistics::Formula simSeconds;
-extern Statistics::Formula simInsts;
-extern Statistics::Formula hostSeconds;
-extern Statistics::Formula hostTickRate;
-extern Statistics::Formula hostInstRate;
+extern Statistics::Value simTicks;
#endif // __SIM_SIM_STATS_HH__