kernel_stats.cc (12181:2150eff234c1) kernel_stats.cc (12182:acde8d31d970)
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;

--- 38 unchanged lines hidden (view full) ---

47
48namespace AlphaISA {
49namespace Kernel {
50
51const char *modestr[] = { "kernel", "user", "idle" };
52
53Statistics::Statistics()
54 : ::Kernel::Statistics(),
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;

--- 38 unchanged lines hidden (view full) ---

47
48namespace AlphaISA {
49namespace Kernel {
50
51const char *modestr[] = { "kernel", "user", "idle" };
52
53Statistics::Statistics()
54 : ::Kernel::Statistics(),
55 idleProcess((Addr)-1), themode(kernel), lastModeTick(0)
55 idleProcess((Addr)-1), themode(kernel), lastModeTick(0),
56 iplLast(0), iplLastTick(0)
56{
57}
58
59void
60Statistics::regStats(const string &_name)
61{
62 ::Kernel::Statistics::regStats(_name);
63

--- 51 unchanged lines hidden (view full) ---

115 ;
116 for (int i = 0; i < cpu_mode_num; ++i)
117 _modeTicks.subname(i, modestr[i]);
118
119 _swap_context
120 .name(name() + ".swap_context")
121 .desc("number of times the context was actually changed")
122 ;
57{
58}
59
60void
61Statistics::regStats(const string &_name)
62{
63 ::Kernel::Statistics::regStats(_name);
64

--- 51 unchanged lines hidden (view full) ---

116 ;
117 for (int i = 0; i < cpu_mode_num; ++i)
118 _modeTicks.subname(i, modestr[i]);
119
120 _swap_context
121 .name(name() + ".swap_context")
122 .desc("number of times the context was actually changed")
123 ;
124
125 _iplCount
126 .init(32)
127 .name(name() + ".ipl_count")
128 .desc("number of times we switched to this ipl")
129 .flags(total | pdf | nozero | nonan)
130 ;
131
132 _iplGood
133 .init(32)
134 .name(name() + ".ipl_good")
135 .desc("number of times we switched to this ipl from a different ipl")
136 .flags(total | pdf | nozero | nonan)
137 ;
138
139 _iplTicks
140 .init(32)
141 .name(name() + ".ipl_ticks")
142 .desc("number of cycles we spent at this ipl")
143 .flags(total | pdf | nozero | nonan)
144 ;
145
146 _iplUsed
147 .name(name() + ".ipl_used")
148 .desc("fraction of swpipl calls that actually changed the ipl")
149 .flags(total | nozero | nonan)
150 ;
151
152 _iplUsed = _iplGood / _iplCount;
123}
124
125void
126Statistics::setIdleProcess(Addr idlepcbb, ThreadContext *tc)
127{
128 assert(themode == kernel);
129 idleProcess = idlepcbb;
130 themode = idle;

--- 48 unchanged lines hidden (view full) ---

179{
180 if (!PAL::name(code))
181 return;
182
183 _callpal[code]++;
184}
185
186void
153}
154
155void
156Statistics::setIdleProcess(Addr idlepcbb, ThreadContext *tc)
157{
158 assert(themode == kernel);
159 idleProcess = idlepcbb;
160 themode = idle;

--- 48 unchanged lines hidden (view full) ---

209{
210 if (!PAL::name(code))
211 return;
212
213 _callpal[code]++;
214}
215
216void
217Statistics::swpipl(int ipl)
218{
219 assert(ipl >= 0 && ipl <= 0x1f && "invalid IPL\n");
220
221 _iplCount[ipl]++;
222
223 if (ipl == iplLast)
224 return;
225
226 _iplGood[ipl]++;
227 _iplTicks[iplLast] += curTick() - iplLastTick;
228 iplLastTick = curTick();
229 iplLast = ipl;
230}
231
232void
187Statistics::serialize(CheckpointOut &cp) const
188{
189 ::Kernel::Statistics::serialize(cp);
190 int exemode = themode;
191 SERIALIZE_SCALAR(exemode);
192 SERIALIZE_SCALAR(idleProcess);
193 SERIALIZE_SCALAR(lastModeTick);
233Statistics::serialize(CheckpointOut &cp) const
234{
235 ::Kernel::Statistics::serialize(cp);
236 int exemode = themode;
237 SERIALIZE_SCALAR(exemode);
238 SERIALIZE_SCALAR(idleProcess);
239 SERIALIZE_SCALAR(lastModeTick);
240 SERIALIZE_SCALAR(iplLast);
241 SERIALIZE_SCALAR(iplLastTick);
194}
195
196void
197Statistics::unserialize(CheckpointIn &cp)
198{
199 ::Kernel::Statistics::unserialize(cp);
200 int exemode;
201 UNSERIALIZE_SCALAR(exemode);
202 UNSERIALIZE_SCALAR(idleProcess);
203 UNSERIALIZE_SCALAR(lastModeTick);
204 themode = (cpu_mode)exemode;
242}
243
244void
245Statistics::unserialize(CheckpointIn &cp)
246{
247 ::Kernel::Statistics::unserialize(cp);
248 int exemode;
249 UNSERIALIZE_SCALAR(exemode);
250 UNSERIALIZE_SCALAR(idleProcess);
251 UNSERIALIZE_SCALAR(lastModeTick);
252 themode = (cpu_mode)exemode;
253 UNSERIALIZE_SCALAR(iplLast);
254 UNSERIALIZE_SCALAR(iplLastTick);
205}
206
207} // namespace Kernel
208} // namespace AlphaISA
255}
256
257} // namespace Kernel
258} // namespace AlphaISA