Deleted Added
sdiff udiff text old ( 2680:246e7104f744 ) new ( 2716:b9114064d77a )
full compact
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" };
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{
189 assert(themode == kernel || themode == interrupt);
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
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
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, 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;
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 ---