kernel_stats.cc (2680:246e7104f744) | kernel_stats.cc (2716:b9114064d77a) |
---|---|
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; --- 31 unchanged lines hidden (view full) --- 40#include "kern/tru64/tru64_syscalls.hh" 41#include "sim/system.hh" 42 43using namespace std; 44using namespace Stats; 45 46namespace Kernel { 47 | 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; --- 31 unchanged lines hidden (view full) --- 40#include "kern/tru64/tru64_syscalls.hh" 41#include "sim/system.hh" 42 43using namespace std; 44using namespace Stats; 45 46namespace Kernel { 47 |
48const char *modestr[] = { "kernel", "user", "idle", "interrupt" }; | 48const char *modestr[] = { "kernel", "user", "idle" }; |
49 50Statistics::Statistics(System *system) 51 : idleProcess((Addr)-1), themode(kernel), lastModeTick(0), 52 iplLast(0), iplLastTick(0) 53{ | 49 50Statistics::Statistics(System *system) 51 : idleProcess((Addr)-1), themode(kernel), lastModeTick(0), 52 iplLast(0), iplLastTick(0) 53{ |
54 bin_int = system->params()->bin_int; | |
55} 56 57void 58Statistics::regStats(const string &_name) 59{ 60 myname = _name; 61 62 _arm --- 118 unchanged lines hidden (view full) --- 181 .name(name() + ".swap_context") 182 .desc("number of times the context was actually changed") 183 ; 184} 185 186void 187Statistics::setIdleProcess(Addr idlepcbb, ThreadContext *tc) 188{ | 54} 55 56void 57Statistics::regStats(const string &_name) 58{ 59 myname = _name; 60 61 _arm --- 118 unchanged lines hidden (view full) --- 180 .name(name() + ".swap_context") 181 .desc("number of times the context was actually changed") 182 ; 183} 184 185void 186Statistics::setIdleProcess(Addr idlepcbb, ThreadContext *tc) 187{ |
189 assert(themode == kernel || themode == interrupt); | 188 assert(themode == kernel); |
190 idleProcess = idlepcbb; 191 themode = idle; 192 changeMode(themode, tc); 193} 194 195void 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 | 189 idleProcess = idlepcbb; 190 themode = idle; 191 changeMode(themode, tc); 192} 193 194void 195Statistics::changeMode(cpu_mode newmode, ThreadContext *tc) 196{ 197 _mode[newmode]++; 198 199 if (newmode == themode) 200 return; 201 202 DPRINTF(Context, "old mode=%-8s new mode=%-8s\n", 203 modestr[themode], modestr[newmode]); 204 205 _modeGood[newmode]++; 206 _modeTicks[themode] += curTick - lastModeTick; 207 |
209 tc->getSystemPtr()->kernelBinning->changeMode(newmode); 210 | |
211 lastModeTick = curTick; 212 themode = newmode; 213} 214 215void 216Statistics::swpipl(int ipl) 217{ 218 assert(ipl >= 0 && ipl <= 0x1f && "invalid IPL\n"); --- 9 unchanged lines hidden (view full) --- 228 iplLast = ipl; 229} 230 231void 232Statistics::mode(cpu_mode newmode, ThreadContext *tc) 233{ 234 Addr pcbb = tc->readMiscReg(AlphaISA::IPR_PALtemp23); 235 | 208 lastModeTick = curTick; 209 themode = newmode; 210} 211 212void 213Statistics::swpipl(int ipl) 214{ 215 assert(ipl >= 0 && ipl <= 0x1f && "invalid IPL\n"); --- 9 unchanged lines hidden (view full) --- 225 iplLast = ipl; 226} 227 228void 229Statistics::mode(cpu_mode newmode, ThreadContext *tc) 230{ 231 Addr pcbb = tc->readMiscReg(AlphaISA::IPR_PALtemp23); 232 |
236 if ((newmode == kernel || newmode == interrupt) && 237 pcbb == idleProcess) | 233 if (newmode == kernel && pcbb == idleProcess) |
238 newmode = idle; 239 | 234 newmode = idle; 235 |
240 if (bin_int == false && newmode == interrupt) 241 newmode = kernel; 242 | |
243 changeMode(newmode, tc); 244} 245 246void 247Statistics::context(Addr oldpcbb, Addr newpcbb, ThreadContext *tc) 248{ 249 assert(themode != user); 250 --- 12 unchanged lines hidden (view full) --- 263 switch (code) { 264 case PAL::callsys: { 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; | 236 changeMode(newmode, tc); 237} 238 239void 240Statistics::context(Addr oldpcbb, Addr newpcbb, ThreadContext *tc) 241{ 242 assert(themode != user); 243 --- 12 unchanged lines hidden (view full) --- 256 switch (code) { 257 case PAL::callsys: { 258 int number = tc->readIntReg(0); 259 if (SystemCalls<Tru64>::validSyscallNumber(number)) { 260 int cvtnum = SystemCalls<Tru64>::convert(number); 261 _syscall[cvtnum]++; 262 } 263 } break; |
271 272 case PAL::swpctx: 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; 283 SERIALIZE_SCALAR(exemode); --- 19 unchanged lines hidden --- | 264 } 265} 266 267void 268Statistics::serialize(ostream &os) 269{ 270 int exemode = themode; 271 SERIALIZE_SCALAR(exemode); --- 19 unchanged lines hidden --- |