A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
remote-channel-bundle-manager.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright 2013. Lawrence Livermore National Security, LLC.
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: Steven Smith <smith84@llnl.gov>
19
*
20
*/
21
28
#include "
remote-channel-bundle-manager.h
"
29
30
#include "
remote-channel-bundle.h
"
31
#include "
null-message-simulator-impl.h
"
32
33
#include "ns3/simulator.h"
34
35
namespace
ns3
{
36
37
bool
ns3::RemoteChannelBundleManager::g_initialized
=
false
;
38
ns3::RemoteChannelBundleManager::RemoteChannelMap
ns3::RemoteChannelBundleManager::g_remoteChannelBundles
;
39
40
Ptr<RemoteChannelBundle>
41
RemoteChannelBundleManager::Find
(uint32_t systemId)
42
{
43
ns3::RemoteChannelBundleManager::RemoteChannelMap::iterator kv =
g_remoteChannelBundles
.find (systemId);
44
45
if
( kv ==
g_remoteChannelBundles
.end ())
46
{
47
return
0;
48
}
49
else
50
{
51
return
kv->second;
52
}
53
}
54
55
Ptr<RemoteChannelBundle>
56
RemoteChannelBundleManager::Add
(uint32_t systemId)
57
{
58
NS_ASSERT
(!
g_initialized
);
59
NS_ASSERT
(
g_remoteChannelBundles
.find (systemId) ==
g_remoteChannelBundles
.end ());
60
61
Ptr<RemoteChannelBundle>
remoteChannelBundle = Create<RemoteChannelBundle> (systemId);
62
63
g_remoteChannelBundles
[systemId] = remoteChannelBundle;
64
65
return
remoteChannelBundle;
66
}
67
68
std::size_t
69
RemoteChannelBundleManager::Size
(
void
)
70
{
71
return
g_remoteChannelBundles
.size();
72
}
73
74
void
75
RemoteChannelBundleManager::InitializeNullMessageEvents
(
void
)
76
{
77
NS_ASSERT
(!
g_initialized
);
78
79
for
( RemoteChannelMap::const_iterator iter =
g_remoteChannelBundles
.begin ();
80
iter !=
g_remoteChannelBundles
.end ();
81
++iter )
82
{
83
Ptr<RemoteChannelBundle>
bundle = iter->second;
84
bundle->Send (bundle->GetDelay ());
85
86
NullMessageSimulatorImpl::GetInstance
()->
ScheduleNullMessageEvent
(bundle);
87
}
88
89
g_initialized
=
true
;
90
}
91
92
Time
93
RemoteChannelBundleManager::GetSafeTime
(
void
)
94
{
95
NS_ASSERT
(
g_initialized
);
96
97
Time
safeTime =
Simulator::GetMaximumSimulationTime
();
98
99
for
(RemoteChannelMap::const_iterator kv =
g_remoteChannelBundles
.begin ();
100
kv !=
g_remoteChannelBundles
.end ();
101
++kv)
102
{
103
safeTime =
Min
(safeTime, kv->second->GetGuaranteeTime ());
104
}
105
106
return
safeTime;
107
}
108
109
void
110
RemoteChannelBundleManager::Destroy
(
void
)
111
{
112
NS_ASSERT
(
g_initialized
);
113
114
g_remoteChannelBundles
.clear();
115
g_initialized
=
false
;
116
}
117
118
}
// namespace ns3
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition:
assert.h:67
remote-channel-bundle.h
Declaration of class ns3::RemoteChannelBundle.
ns3::RemoteChannelBundleManager::g_initialized
static bool g_initialized
Protect manager class from being initialized twice or incorrect ordering of method calls.
Definition:
remote-channel-bundle-manager.h:117
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::RemoteChannelBundleManager::GetSafeTime
static Time GetSafeTime(void)
Get the safe time across all channels in this bundle.
Definition:
remote-channel-bundle-manager.cc:93
ns3::Min
int64x64_t Min(const int64x64_t &a, const int64x64_t &b)
Minimum.
Definition:
int64x64.h:218
ns3::RemoteChannelBundleManager::Find
static Ptr< RemoteChannelBundle > Find(uint32_t systemId)
Get the bundle corresponding to a remote rank.
Definition:
remote-channel-bundle-manager.cc:41
ns3::NullMessageSimulatorImpl::GetInstance
static NullMessageSimulatorImpl * GetInstance(void)
Definition:
null-message-simulator-impl.cc:599
ns3::RemoteChannelBundleManager::Add
static Ptr< RemoteChannelBundle > Add(uint32_t systemId)
Add RemoteChannelBundle from this task to MPI task on other side of the link.
Definition:
remote-channel-bundle-manager.cc:56
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:74
ns3::RemoteChannelBundleManager::g_remoteChannelBundles
static RemoteChannelMap g_remoteChannelBundles
The remote channel bundles.
Definition:
remote-channel-bundle-manager.h:111
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:104
ns3::RemoteChannelBundleManager::InitializeNullMessageEvents
static void InitializeNullMessageEvents(void)
Setup initial Null Message events for every RemoteChannelBundle.
Definition:
remote-channel-bundle-manager.cc:75
ns3::RemoteChannelBundleManager::Destroy
static void Destroy(void)
Destroy the singleton.
Definition:
remote-channel-bundle-manager.cc:110
ns3::RemoteChannelBundleManager::Size
static std::size_t Size(void)
Get the number of ns-3 channels in this bundle.
Definition:
remote-channel-bundle-manager.cc:69
ns3::Simulator::GetMaximumSimulationTime
static Time GetMaximumSimulationTime(void)
Get the maximum representable simulation time.
Definition:
simulator.cc:293
remote-channel-bundle-manager.h
Declaration of class ns3::RemoteChannelBundleManager.
ns3::RemoteChannelBundleManager::RemoteChannelMap
std::unordered_map< uint32_t, Ptr< RemoteChannelBundle > > RemoteChannelMap
Container for all remote channel bundles for this task.
Definition:
remote-channel-bundle-manager.h:109
null-message-simulator-impl.h
Declaration of class ns3::NullMessageSimulatorImpl.
ns3::NullMessageSimulatorImpl::ScheduleNullMessageEvent
void ScheduleNullMessageEvent(Ptr< RemoteChannelBundle > bundle)
Definition:
null-message-simulator-impl.cc:268
src
mpi
model
remote-channel-bundle-manager.cc
Generated on Fri Oct 1 2021 17:03:28 for ns-3 by
1.8.20