OLD | NEW |
(Empty) | |
| 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 |
| 22 #ifndef NS3_REMOTE_CHANNEL_BUNDLE |
| 23 #define NS3_REMOTE_CHANNEL_BUNDLE |
| 24 |
| 25 #include "null-message-simulator-impl.h" |
| 26 |
| 27 #include <ns3/channel.h> |
| 28 #include <ns3/ptr.h> |
| 29 #include <ns3/pointer.h> |
| 30 |
| 31 #include <map> |
| 32 |
| 33 namespace ns3 { |
| 34 |
| 35 /** |
| 36 * \ingroup mpi |
| 37 *· |
| 38 * \brief Collection of NS3 channels between local and remote nodes. |
| 39 *· |
| 40 * An instance exists for each remote system that the local system is |
| 41 * in communication with. These are created and managed by the |
| 42 * RemoteChannelBundleManager class. Stores time information for each |
| 43 * bundle. |
| 44 */ |
| 45 class RemoteChannelBundle : public Object |
| 46 { |
| 47 public: |
| 48 static TypeId GetTypeId (void); |
| 49 |
| 50 RemoteChannelBundle (); |
| 51 |
| 52 RemoteChannelBundle (const uint32_t remoteSystemId); |
| 53 |
| 54 ~RemoteChannelBundle () |
| 55 { |
| 56 } |
| 57 |
| 58 /** |
| 59 * \param channel to add to the bundle |
| 60 * \param delay time for the channel (usually the latency) |
| 61 */ |
| 62 void AddChannel (Ptr<Channel> channel, Time delay); |
| 63 |
| 64 /** |
| 65 * \return SystemID for remote side of this bundle |
| 66 */ |
| 67 uint32_t GetSystemId () const; |
| 68 |
| 69 /** |
| 70 * \return guarantee time |
| 71 */ |
| 72 Time GetGuaranteeTime (void) const; |
| 73 |
| 74 /** |
| 75 * \param guarantee time |
| 76 * |
| 77 * Set the guarantee time for the bundle. This should be called |
| 78 * after a packet or Null Message received. |
| 79 */ |
| 80 void SetGuaranteeTime (Time time); |
| 81 |
| 82 /** |
| 83 * \return the minimum delay along any channel in this bundle |
| 84 */ |
| 85 Time GetDelay (void) const; |
| 86 |
| 87 /** |
| 88 * Set the event ID of the Null Message send event current scheduled |
| 89 * for this channel. |
| 90 */ |
| 91 void SetEventId (EventId id); |
| 92 |
| 93 /** |
| 94 * \return the event ID of the Null Message send event for this bundle |
| 95 */ |
| 96 EventId GetEventId (void) const; |
| 97 |
| 98 /** |
| 99 * \return number of NS3 channels in this bundle |
| 100 */ |
| 101 int GetSize (void) const; |
| 102 |
| 103 /** |
| 104 * \param time· |
| 105 * |
| 106 * Send Null Message to the remote task associated with this bundle. |
| 107 * Message will be delivered at current simulation time + the time |
| 108 * passed in. |
| 109 */ |
| 110 void Send(Time time); |
| 111 |
| 112 /** |
| 113 * Output for debugging purposes. |
| 114 */ |
| 115 friend std::ostream& operator<< (std::ostream& out, ns3::RemoteChannelBundle&
bundle ); |
| 116 |
| 117 private: |
| 118 /* |
| 119 * Remote rank. |
| 120 */ |
| 121 uint32_t m_remoteSystemId; |
| 122 |
| 123 /* |
| 124 * NS3 Channels that are connected from nodes in this MPI task to remote_rank. |
| 125 * |
| 126 * Would be more efficient to use unordered_map when C++11 is adopted by NS3. |
| 127 */ |
| 128 std::map < uint32_t, Ptr < Channel > > m_channels; |
| 129 |
| 130 /* |
| 131 * Guarentee time for the incoming Channels from MPI task remote_rank. |
| 132 * No PacketMessage will ever arrive on any incoming channel in this bundle wi
th a |
| 133 * ReceiveTime less than this. Intialized to StartTime. |
| 134 */ |
| 135 Time m_guaranteeTime; |
| 136 |
| 137 /* |
| 138 * Delay for this Channel bundle. min link delay over all incoming channels; |
| 139 */ |
| 140 Time m_delay; |
| 141 |
| 142 /* |
| 143 * Event scheduled to send Null Message for this bundle. |
| 144 */ |
| 145 EventId m_nullEventId; |
| 146 |
| 147 }; |
| 148 |
| 149 } |
| 150 |
| 151 #endif |
OLD | NEW |