A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
core
helper
event-garbage-collector.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007 INESC Porto
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
19
*/
20
#ifndef EVENT_GARBAGE_COLLECTOR_H
21
#define EVENT_GARBAGE_COLLECTOR_H
22
23
#include <set>
24
#include "ns3/event-id.h"
25
#include "ns3/simulator.h"
26
34
namespace
ns3
{
35
46
class
EventGarbageCollector
47
{
48
public
:
49
50
EventGarbageCollector
();
51
56
void
Track
(
EventId
event);
57
58
~EventGarbageCollector
();
59
60
private
:
61
63
typedef
std::multiset<EventId>
EventList
;
64
66
const
typename
EventList::size_type
CHUNK_INIT_SIZE
= 8;
71
const
typename
EventList::size_type
CHUNK_MAX_SIZE
= 128;
72
73
EventList::size_type
m_nextCleanupSize
;
74
EventList
m_events
;
75
80
void
Cleanup
();
87
void
Grow
();
93
void
Shrink
();
94
};
95
96
}
// namespace ns3
97
98
#endif
/* EVENT_GARBAGE_COLLECTOR_H */
ns3::EventGarbageCollector::EventGarbageCollector
EventGarbageCollector()
Definition:
event-garbage-collector.cc:32
ns3::EventGarbageCollector::Grow
void Grow()
Grow the cleanup limit.
Definition:
event-garbage-collector.cc:47
ns3::EventGarbageCollector::Cleanup
void Cleanup()
Called when a new event was added and the cleanup limit was exceeded in consequence.
Definition:
event-garbage-collector.cc:64
ns3::EventGarbageCollector
An object that tracks scheduled events and automatically cancels them when it is destroyed.
Definition:
event-garbage-collector.h:46
ns3::EventGarbageCollector::~EventGarbageCollector
~EventGarbageCollector()
Definition:
event-garbage-collector.cc:84
ns3::EventGarbageCollector::m_events
EventList m_events
The tracked event list.
Definition:
event-garbage-collector.h:74
ns3::EventGarbageCollector::CHUNK_MAX_SIZE
const EventList::size_type CHUNK_MAX_SIZE
Threshold to switch from exponential to linear growth in the cleanup frequency.
Definition:
event-garbage-collector.h:71
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::EventGarbageCollector::EventList
std::multiset< EventId > EventList
Event list container.
Definition:
event-garbage-collector.h:63
ns3::EventId
An identifier for simulation events.
Definition:
event-id.h:53
ns3::EventGarbageCollector::m_nextCleanupSize
EventList::size_type m_nextCleanupSize
Batch size for cleanup.
Definition:
event-garbage-collector.h:73
ns3::EventGarbageCollector::Track
void Track(EventId event)
Tracks a new event.
Definition:
event-garbage-collector.cc:39
ns3::EventGarbageCollector::Shrink
void Shrink()
Shrink the cleanup limit Reduce the cleanup size by factors of two until less than the current event ...
Definition:
event-garbage-collector.cc:54
ns3::EventGarbageCollector::CHUNK_INIT_SIZE
const EventList::size_type CHUNK_INIT_SIZE
Initial threshold for cleaning the event list.
Definition:
event-garbage-collector.h:66
Generated on Wed Nov 7 2018 10:01:49 for ns-3 by
1.8.14