eventq.hh (3329:1f5c70ca9f3e) | eventq.hh (4016:1d09f041eefa) |
---|---|
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; --- 61 unchanged lines hidden (view full) --- 70 * event is specified by deriving a subclass and overriding the 71 * process() member function. 72 */ 73class Event : public Serializable, public FastAlloc 74{ 75 friend class EventQueue; 76 77 private: | 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; --- 61 unchanged lines hidden (view full) --- 70 * event is specified by deriving a subclass and overriding the 71 * process() member function. 72 */ 73class Event : public Serializable, public FastAlloc 74{ 75 friend class EventQueue; 76 77 private: |
78 79#ifndef NDEBUG 80 /// Global counter to generate unique IDs for Event instances 81 static Counter instanceCounter; 82 83 /// This event's unique ID. We can also use pointer values for 84 /// this but they're not consistent across runs making debugging 85 /// more difficult. Thus we use a global counter value when 86 /// debugging. 87 Counter instanceId; 88#endif // NDEBUG 89 |
|
78 /// queue to which this event belongs (though it may or may not be 79 /// scheduled on this queue yet) 80 EventQueue *queue; 81 82 Event *next; 83 84 Tick _when; //!< timestamp when event should be processed 85 int _priority; //!< event priority --- 82 unchanged lines hidden (view full) --- 168 */ 169 Event(EventQueue *q, Priority p = Default_Pri) 170 : queue(q), next(NULL), _priority(p), _flags(None), 171#if TRACING_ON 172 when_created(curTick), when_scheduled(0), 173#endif 174 annotated_value(0) 175 { | 90 /// queue to which this event belongs (though it may or may not be 91 /// scheduled on this queue yet) 92 EventQueue *queue; 93 94 Event *next; 95 96 Tick _when; //!< timestamp when event should be processed 97 int _priority; //!< event priority --- 82 unchanged lines hidden (view full) --- 180 */ 181 Event(EventQueue *q, Priority p = Default_Pri) 182 : queue(q), next(NULL), _priority(p), _flags(None), 183#if TRACING_ON 184 when_created(curTick), when_scheduled(0), 185#endif 186 annotated_value(0) 187 { |
188#ifndef NDEBUG 189 instanceId = ++instanceCounter; 190#endif |
|
176 } 177 178 ~Event() {} 179 180 virtual const std::string name() const { | 191 } 192 193 ~Event() {} 194 195 virtual const std::string name() const { |
196#ifndef NDEBUG 197 return csprintf("Event_%d", instanceId); 198#else |
|
181 return csprintf("Event_%x", (uintptr_t)this); | 199 return csprintf("Event_%x", (uintptr_t)this); |
200#endif |
|
182 } 183 184 /// Determine if the current event is scheduled 185 bool scheduled() const { return getFlags(Scheduled); } 186 187 /// Schedule the event with the current priority or default priority 188 void schedule(Tick t); 189 --- 233 unchanged lines hidden --- | 201 } 202 203 /// Determine if the current event is scheduled 204 bool scheduled() const { return getFlags(Scheduled); } 205 206 /// Schedule the event with the current priority or default priority 207 void schedule(Tick t); 208 --- 233 unchanged lines hidden --- |