stat_control.cc (2802:babfc298ac86) stat_control.cc (3125:febd811bccc6)
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;

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

155
156class StatEvent : public Event
157{
158 protected:
159 int flags;
160 Tick repeat;
161
162 public:
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;

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

155
156class StatEvent : public Event
157{
158 protected:
159 int flags;
160 Tick repeat;
161
162 public:
163 StatEvent(int _flags, Tick _when, Tick _repeat);
163 StatEvent(EventQueue *queue, int _flags, Tick _when, Tick _repeat);
164 virtual void process();
165 virtual const char *description();
166};
167
164 virtual void process();
165 virtual const char *description();
166};
167
168StatEvent::StatEvent(int _flags, Tick _when, Tick _repeat)
169 : Event(&mainEventQueue, Stat_Event_Pri),
168StatEvent::StatEvent(EventQueue *queue, int _flags, Tick _when, Tick _repeat)
169 : Event(queue, Stat_Event_Pri),
170 flags(_flags), repeat(_repeat)
171{
172 setFlags(AutoDelete);
173 schedule(_when);
174}
175
176const char *
177StatEvent::description()
178{
179 return "Statistics dump and/or reset";
180}
181
182void
183StatEvent::process()
184{
185 if (flags & Stats::Dump)
186 DumpNow();
187
170 flags(_flags), repeat(_repeat)
171{
172 setFlags(AutoDelete);
173 schedule(_when);
174}
175
176const char *
177StatEvent::description()
178{
179 return "Statistics dump and/or reset";
180}
181
182void
183StatEvent::process()
184{
185 if (flags & Stats::Dump)
186 DumpNow();
187
188 if (flags & Stats::Reset)
188 if (flags & Stats::Reset) {
189 cprintf("Resetting stats!\n");
189 reset();
190 reset();
191 }
190
191 if (repeat)
192 schedule(curTick + repeat);
193}
194
195list<Output *> OutputList;
196
197void

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

209 if (!output->valid())
210 continue;
211
212 output->output();
213 }
214}
215
216void
192
193 if (repeat)
194 schedule(curTick + repeat);
195}
196
197list<Output *> OutputList;
198
199void

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

211 if (!output->valid())
212 continue;
213
214 output->output();
215 }
216}
217
218void
217SetupEvent(int flags, Tick when, Tick repeat)
219SetupEvent(int flags, Tick when, Tick repeat, EventQueue *queue)
218{
220{
219 new StatEvent(flags, when, repeat);
221 if (queue == NULL)
222 queue = &mainEventQueue;
223
224 new StatEvent(queue, flags, when, repeat);
220}
221
222/* namespace Stats */ }
223
224void debugDumpStats()
225{
226 Stats::DumpNow();
227}
228
225}
226
227/* namespace Stats */ }
228
229void debugDumpStats()
230{
231 Stats::DumpNow();
232}
233