diff options
Diffstat (limited to 'kern/kernel_stats.cc')
-rw-r--r-- | kern/kernel_stats.cc | 46 |
1 files changed, 17 insertions, 29 deletions
diff --git a/kern/kernel_stats.cc b/kern/kernel_stats.cc index 3a7d12443..b85d88145 100644 --- a/kern/kernel_stats.cc +++ b/kern/kernel_stats.cc @@ -35,6 +35,7 @@ #include "cpu/exec_context.hh" #include "kern/kernel_stats.hh" #include "kern/tru64/tru64_syscalls.hh" +#include "sim/system.hh" using namespace std; using namespace Stats; @@ -43,11 +44,11 @@ namespace Kernel { const char *modestr[] = { "kernel", "user", "idle", "interrupt" }; -Statistics::Statistics(ExecContext *context) - : xc(context), idleProcess((Addr)-1), themode(kernel), lastModeTick(0), +Statistics::Statistics(System *system) + : idleProcess((Addr)-1), themode(kernel), lastModeTick(0), iplLast(0), iplLastTick(0) { - bin_int = xc->system->params->bin_int; + bin_int = system->params()->bin_int; } void @@ -136,19 +137,6 @@ Statistics::regStats(const string &_name) } } - _faults - .init(Num_Faults) - .name(name() + ".faults") - .desc("number of faults") - .flags(total | pdf | nozero | nonan) - ; - - for (int i = 1; i < Num_Faults; ++i) { - const char *str = FaultName(i); - if (str) - _faults.subname(i, str); - } - _mode .init(cpu_mode_num) .name(name() + ".mode_switch") @@ -193,16 +181,16 @@ Statistics::regStats(const string &_name) } void -Statistics::setIdleProcess(Addr idlepcbb) +Statistics::setIdleProcess(Addr idlepcbb, ExecContext *xc) { assert(themode == kernel || themode == interrupt); idleProcess = idlepcbb; themode = idle; - changeMode(themode); + changeMode(themode, xc); } void -Statistics::changeMode(cpu_mode newmode) +Statistics::changeMode(cpu_mode newmode, ExecContext *xc) { _mode[newmode]++; @@ -215,7 +203,7 @@ Statistics::changeMode(cpu_mode newmode) _modeGood[newmode]++; _modeTicks[themode] += curTick - lastModeTick; - xc->system->kernelBinning->changeMode(newmode); + xc->getSystemPtr()->kernelBinning->changeMode(newmode); lastModeTick = curTick; themode = newmode; @@ -238,9 +226,9 @@ Statistics::swpipl(int ipl) } void -Statistics::mode(cpu_mode newmode) +Statistics::mode(cpu_mode newmode, ExecContext *xc) { - Addr pcbb = xc->regs.ipr[AlphaISA::IPR_PALtemp23]; + Addr pcbb = xc->readMiscReg(AlphaISA::IPR_PALtemp23); if ((newmode == kernel || newmode == interrupt) && pcbb == idleProcess) @@ -249,20 +237,20 @@ Statistics::mode(cpu_mode newmode) if (bin_int == false && newmode == interrupt) newmode = kernel; - changeMode(newmode); + changeMode(newmode, xc); } void -Statistics::context(Addr oldpcbb, Addr newpcbb) +Statistics::context(Addr oldpcbb, Addr newpcbb, ExecContext *xc) { assert(themode != user); _swap_context++; - changeMode(newpcbb == idleProcess ? idle : kernel); + changeMode(newpcbb == idleProcess ? idle : kernel, xc); } void -Statistics::callpal(int code) +Statistics::callpal(int code, ExecContext *xc) { if (!PAL::name(code)) return; @@ -271,7 +259,7 @@ Statistics::callpal(int code) switch (code) { case PAL::callsys: { - int number = xc->regs.intRegFile[0]; + int number = xc->readIntReg(0); if (SystemCalls<Tru64>::validSyscallNumber(number)) { int cvtnum = SystemCalls<Tru64>::convert(number); _syscall[cvtnum]++; @@ -279,8 +267,8 @@ Statistics::callpal(int code) } break; case PAL::swpctx: - if (xc->system->kernelBinning) - xc->system->kernelBinning->palSwapContext(xc); + if (xc->getSystemPtr()->kernelBinning) + xc->getSystemPtr()->kernelBinning->palSwapContext(xc); break; } } |