kernel_stats.cc (2665:a124942bacb8) | kernel_stats.cc (2680:246e7104f744) |
---|---|
1/* 2 * Copyright (c) 2004-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 21 unchanged lines hidden (view full) --- 30 */ 31 32#include <map> 33#include <stack> 34#include <string> 35 36#include "arch/alpha/osfpal.hh" 37#include "base/trace.hh" | 1/* 2 * Copyright (c) 2004-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 21 unchanged lines hidden (view full) --- 30 */ 31 32#include <map> 33#include <stack> 34#include <string> 35 36#include "arch/alpha/osfpal.hh" 37#include "base/trace.hh" |
38#include "cpu/exec_context.hh" | 38#include "cpu/thread_context.hh" |
39#include "kern/kernel_stats.hh" 40#include "kern/tru64/tru64_syscalls.hh" 41#include "sim/system.hh" 42 43using namespace std; 44using namespace Stats; 45 46namespace Kernel { --- 132 unchanged lines hidden (view full) --- 179 180 _swap_context 181 .name(name() + ".swap_context") 182 .desc("number of times the context was actually changed") 183 ; 184} 185 186void | 39#include "kern/kernel_stats.hh" 40#include "kern/tru64/tru64_syscalls.hh" 41#include "sim/system.hh" 42 43using namespace std; 44using namespace Stats; 45 46namespace Kernel { --- 132 unchanged lines hidden (view full) --- 179 180 _swap_context 181 .name(name() + ".swap_context") 182 .desc("number of times the context was actually changed") 183 ; 184} 185 186void |
187Statistics::setIdleProcess(Addr idlepcbb, ExecContext *xc) | 187Statistics::setIdleProcess(Addr idlepcbb, ThreadContext *tc) |
188{ 189 assert(themode == kernel || themode == interrupt); 190 idleProcess = idlepcbb; 191 themode = idle; | 188{ 189 assert(themode == kernel || themode == interrupt); 190 idleProcess = idlepcbb; 191 themode = idle; |
192 changeMode(themode, xc); | 192 changeMode(themode, tc); |
193} 194 195void | 193} 194 195void |
196Statistics::changeMode(cpu_mode newmode, ExecContext *xc) | 196Statistics::changeMode(cpu_mode newmode, ThreadContext *tc) |
197{ 198 _mode[newmode]++; 199 200 if (newmode == themode) 201 return; 202 203 DPRINTF(Context, "old mode=%-8s new mode=%-8s\n", 204 modestr[themode], modestr[newmode]); 205 206 _modeGood[newmode]++; 207 _modeTicks[themode] += curTick - lastModeTick; 208 | 197{ 198 _mode[newmode]++; 199 200 if (newmode == themode) 201 return; 202 203 DPRINTF(Context, "old mode=%-8s new mode=%-8s\n", 204 modestr[themode], modestr[newmode]); 205 206 _modeGood[newmode]++; 207 _modeTicks[themode] += curTick - lastModeTick; 208 |
209 xc->getSystemPtr()->kernelBinning->changeMode(newmode); | 209 tc->getSystemPtr()->kernelBinning->changeMode(newmode); |
210 211 lastModeTick = curTick; 212 themode = newmode; 213} 214 215void 216Statistics::swpipl(int ipl) 217{ --- 6 unchanged lines hidden (view full) --- 224 225 _iplGood[ipl]++; 226 _iplTicks[iplLast] += curTick - iplLastTick; 227 iplLastTick = curTick; 228 iplLast = ipl; 229} 230 231void | 210 211 lastModeTick = curTick; 212 themode = newmode; 213} 214 215void 216Statistics::swpipl(int ipl) 217{ --- 6 unchanged lines hidden (view full) --- 224 225 _iplGood[ipl]++; 226 _iplTicks[iplLast] += curTick - iplLastTick; 227 iplLastTick = curTick; 228 iplLast = ipl; 229} 230 231void |
232Statistics::mode(cpu_mode newmode, ExecContext *xc) | 232Statistics::mode(cpu_mode newmode, ThreadContext *tc) |
233{ | 233{ |
234 Addr pcbb = xc->readMiscReg(AlphaISA::IPR_PALtemp23); | 234 Addr pcbb = tc->readMiscReg(AlphaISA::IPR_PALtemp23); |
235 236 if ((newmode == kernel || newmode == interrupt) && 237 pcbb == idleProcess) 238 newmode = idle; 239 240 if (bin_int == false && newmode == interrupt) 241 newmode = kernel; 242 | 235 236 if ((newmode == kernel || newmode == interrupt) && 237 pcbb == idleProcess) 238 newmode = idle; 239 240 if (bin_int == false && newmode == interrupt) 241 newmode = kernel; 242 |
243 changeMode(newmode, xc); | 243 changeMode(newmode, tc); |
244} 245 246void | 244} 245 246void |
247Statistics::context(Addr oldpcbb, Addr newpcbb, ExecContext *xc) | 247Statistics::context(Addr oldpcbb, Addr newpcbb, ThreadContext *tc) |
248{ 249 assert(themode != user); 250 251 _swap_context++; | 248{ 249 assert(themode != user); 250 251 _swap_context++; |
252 changeMode(newpcbb == idleProcess ? idle : kernel, xc); | 252 changeMode(newpcbb == idleProcess ? idle : kernel, tc); |
253} 254 255void | 253} 254 255void |
256Statistics::callpal(int code, ExecContext *xc) | 256Statistics::callpal(int code, ThreadContext *tc) |
257{ 258 if (!PAL::name(code)) 259 return; 260 261 _callpal[code]++; 262 263 switch (code) { 264 case PAL::callsys: { | 257{ 258 if (!PAL::name(code)) 259 return; 260 261 _callpal[code]++; 262 263 switch (code) { 264 case PAL::callsys: { |
265 int number = xc->readIntReg(0); | 265 int number = tc->readIntReg(0); |
266 if (SystemCalls<Tru64>::validSyscallNumber(number)) { 267 int cvtnum = SystemCalls<Tru64>::convert(number); 268 _syscall[cvtnum]++; 269 } 270 } break; 271 272 case PAL::swpctx: | 266 if (SystemCalls<Tru64>::validSyscallNumber(number)) { 267 int cvtnum = SystemCalls<Tru64>::convert(number); 268 _syscall[cvtnum]++; 269 } 270 } break; 271 272 case PAL::swpctx: |
273 if (xc->getSystemPtr()->kernelBinning) 274 xc->getSystemPtr()->kernelBinning->palSwapContext(xc); | 273 if (tc->getSystemPtr()->kernelBinning) 274 tc->getSystemPtr()->kernelBinning->palSwapContext(tc); |
275 break; 276 } 277} 278 279void 280Statistics::serialize(ostream &os) 281{ 282 int exemode = themode; --- 20 unchanged lines hidden --- | 275 break; 276 } 277} 278 279void 280Statistics::serialize(ostream &os) 281{ 282 int exemode = themode; --- 20 unchanged lines hidden --- |