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" }; |
49 50Statistics::Statistics(System *system) 51 : idleProcess((Addr)-1), themode(kernel), lastModeTick(0), 52 iplLast(0), iplLastTick(0) 53{ |
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{ |
188 assert(themode == kernel); |
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 |
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 |
233 if (newmode == kernel && pcbb == idleProcess) |
234 newmode = idle; 235 |
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; |
264 } 265} 266 267void 268Statistics::serialize(ostream &os) 269{ 270 int exemode = themode; 271 SERIALIZE_SCALAR(exemode); --- 19 unchanged lines hidden --- |