Deleted Added
sdiff udiff text old ( 7005:3d5c4acb6015 ) new ( 7058:5c7416199efd )
full compact
1/*
2 * Copyright (c) 2000-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;

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

75 static const FlagsType AutoDelete = 0x0004;
76 static const FlagsType AutoSerialize = 0x0008;
77 static const FlagsType IsExitEvent = 0x0010;
78 static const FlagsType IsMainQueue = 0x0020;
79#ifdef EVENTQ_DEBUG
80 static const FlagsType Initialized = 0xf000;
81#endif
82
83 private:
84 // The event queue is now a linked list of linked lists. The
85 // 'nextBin' pointer is to find the bin, where a bin is defined as
86 // when+priority. All events in the same bin will be stored in a
87 // second linked list (a stack) maintained by the 'nextInBin'
88 // pointer. The list will be accessed in LIFO order. The end
89 // result is that the insert/removal in 'nextBin' is
90 // linear/constant, and the lookup/removal in 'nextInBin' is
91 // constant/constant. Hopefully this is a significant improvement
92 // over the current fully linear insertion.
93 Event *nextBin;
94 Event *nextInBin;
95
96 static Event *insertBefore(Event *event, Event *curr);
97 static Event *removeItem(Event *event, Event *last);
98
99 Tick _when; //!< timestamp when event should be processed
100 short _priority; //!< event priority
101 Flags flags;
102
103#ifndef NDEBUG
104 /// Global counter to generate unique IDs for Event instances
105 static Counter instanceCounter;
106
107 /// This event's unique ID. We can also use pointer values for
108 /// this but they're not consistent across runs making debugging

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

178 // This function isn't really useful if TRACING_ON is not defined
179 virtual void trace(const char *action); //!< trace event activity
180
181 public:
182 /// Event priorities, to provide tie-breakers for events scheduled
183 /// at the same cycle. Most events are scheduled at the default
184 /// priority; these values are used to control events that need to
185 /// be ordered within a cycle.
186 enum Priority {
187 /// Minimum priority
188 Minimum_Pri = SHRT_MIN,
189
190 /// If we enable tracing on a particular cycle, do that as the
191 /// very first thing so we don't miss any of the events on
192 /// that cycle (even if we enter the debugger).
193 Trace_Enable_Pri = -101,
194
195 /// Breakpoints should happen before anything else (except
196 /// enabling trace output), so we don't miss any action when
197 /// debugging.
198 Debug_Break_Pri = -100,
199
200 /// CPU switches schedule the new CPU's tick event for the
201 /// same cycle (after unscheduling the old CPU's tick event).
202 /// The switch needs to come before any tick events to make
203 /// sure we don't tick both CPUs in the same cycle.
204 CPU_Switch_Pri = -31,
205
206 /// For some reason "delayed" inter-cluster writebacks are
207 /// scheduled before regular writebacks (which have default
208 /// priority). Steve?
209 Delayed_Writeback_Pri = -1,
210
211 /// Default is zero for historical reasons.
212 Default_Pri = 0,
213
214 /// Serailization needs to occur before tick events also, so
215 /// that a serialize/unserialize is identical to an on-line
216 /// CPU switch.
217 Serialize_Pri = 32,
218
219 /// CPU ticks must come after other associated CPU events
220 /// (such as writebacks).
221 CPU_Tick_Pri = 50,
222
223 /// Statistics events (dump, reset, etc.) come after
224 /// everything else, but before exit.
225 Stat_Event_Pri = 90,
226
227 /// Progress events come at the end.
228 Progress_Event_Pri = 95,
229
230 /// If we want to exit on this cycle, it's the very last thing
231 /// we do.
232 Sim_Exit_Pri = 100,
233
234 /// Maximum priority
235 Maximum_Pri = SHRT_MAX
236 };
237
238 /*
239 * Event constructor
240 * @param queue that the event gets scheduled on
241 */
242 Event(Priority p = Default_Pri)
243 : nextBin(NULL), nextInBin(NULL), _priority(p)
244 {
245#ifndef NDEBUG

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

288
289 /// See if this is a SimExitEvent (without resorting to RTTI)
290 bool isExitEvent() const { return flags.isSet(IsExitEvent); }
291
292 /// Get the time that the event is scheduled
293 Tick when() const { return _when; }
294
295 /// Get the event priority
296 int priority() const { return _priority; }
297
298#ifndef SWIG
299 struct priority_compare
300 : public std::binary_function<Event *, Event *, bool>
301 {
302 bool
303 operator()(const Event *l, const Event *r) const
304 {

--- 282 unchanged lines hidden ---