equal
deleted
inserted
replaced
19 * Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> |
19 * Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> |
20 */ |
20 */ |
21 #include "event-collector.h" |
21 #include "event-collector.h" |
22 #include <algorithm> |
22 #include <algorithm> |
23 |
23 |
|
24 #define CLEANUP_CHUNK_MIN_SIZE 8 |
|
25 #define CLEANUP_CHUNK_MAX_SIZE 1024 |
|
26 |
|
27 |
24 namespace ns3 { |
28 namespace ns3 { |
|
29 |
|
30 |
|
31 EventCollector::EventCollector () : |
|
32 m_nextCleanupSize (CLEANUP_CHUNK_MIN_SIZE) |
|
33 {} |
|
34 |
|
35 void |
|
36 EventCollector::Track (EventId event) |
|
37 { |
|
38 m_events.push_back (event); |
|
39 if (m_events.size () >= m_nextCleanupSize) |
|
40 Cleanup (); |
|
41 } |
25 |
42 |
26 inline bool |
43 inline bool |
27 EventExpiredPredicate (const EventId &event) |
44 EventExpiredPredicate (const EventId &event) |
28 { |
45 { |
29 return event.IsExpired (); |
46 return event.IsExpired (); |