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(EventQueue *queue, int _flags, Tick _when, Tick _repeat); |
164 virtual void process(); 165 virtual const char *description(); 166}; 167 |
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 |
188 if (flags & Stats::Reset) { 189 cprintf("Resetting stats!\n"); |
190 reset(); |
191 } |
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 |
219SetupEvent(int flags, Tick when, Tick repeat, EventQueue *queue) |
220{ |
221 if (queue == NULL) 222 queue = &mainEventQueue; 223 224 new StatEvent(queue, flags, when, repeat); |
225} 226 227/* namespace Stats */ } 228 229void debugDumpStats() 230{ 231 Stats::DumpNow(); 232} 233 |