eventq.hh (5502:f0f8a3ee5aad) eventq.hh (5503:cf464d02bc57)
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;

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

72class Event : public Serializable, public FastAlloc
73{
74 friend class EventQueue;
75
76 private:
77 // The event queue is now a linked list of linked lists. The
78 // 'nextBin' pointer is to find the bin, where a bin is defined as
79 // when+priority. All events in the same bin will be stored in a
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;

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

72class Event : public Serializable, public FastAlloc
73{
74 friend class EventQueue;
75
76 private:
77 // The event queue is now a linked list of linked lists. The
78 // 'nextBin' pointer is to find the bin, where a bin is defined as
79 // when+priority. All events in the same bin will be stored in a
80 // second circularly linked list maintained by the 'nextInBin'
81 // pointer. The list will be accessed in FIFO order. The end
80 // second linked list (a stack) maintained by the 'nextInBin'
81 // pointer. The list will be accessed in LIFO order. The end
82 // result is that the insert/removal in 'nextBin' is
83 // linear/constant, and the lookup/removal in 'nextInBin' is
84 // constant/constant. Hopefully this is a significant improvement
85 // over the current fully linear insertion.
86 Event *nextBin;
87 Event *nextInBin;
88
82 // result is that the insert/removal in 'nextBin' is
83 // linear/constant, and the lookup/removal in 'nextInBin' is
84 // constant/constant. Hopefully this is a significant improvement
85 // over the current fully linear insertion.
86 Event *nextBin;
87 Event *nextInBin;
88
89 friend void insertBefore(Event *event, Event *curr);
89 friend Event *insertBefore(Event *event, Event *curr);
90 friend Event *removeItem(Event *event, Event *last);
91
92 /// queue to which this event belongs (though it may or may not be
93 /// scheduled on this queue yet)
94 EventQueue *_queue;
95
96 Tick _when; //!< timestamp when event should be processed
97 short _priority; //!< event priority

--- 435 unchanged lines hidden ---
90 friend Event *removeItem(Event *event, Event *last);
91
92 /// queue to which this event belongs (though it may or may not be
93 /// scheduled on this queue yet)
94 EventQueue *_queue;
95
96 Tick _when; //!< timestamp when event should be processed
97 short _priority; //!< event priority

--- 435 unchanged lines hidden ---