OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * This program is free software; you can redistribute it and/or modify | 3 * This program is free software; you can redistribute it and/or modify |
4 * it under the terms of the GNU General Public License version 2 as | 4 * it under the terms of the GNU General Public License version 2 as |
5 * published by the Free Software Foundation; | 5 * published by the Free Software Foundation; |
6 * | 6 * |
7 * This program is distributed in the hope that it will be useful, | 7 * This program is distributed in the hope that it will be useful, |
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 * GNU General Public License for more details. | 10 * GNU General Public License for more details. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 /** | 78 /** |
79 * \return id which corresponds to mpi rank | 79 * \return id which corresponds to mpi rank |
80 */ | 80 */ |
81 uint32_t GetMyId (); | 81 uint32_t GetMyId (); |
82 /** | 82 /** |
83 * \return true if system is finished | 83 * \return true if system is finished |
84 */ | 84 */ |
85 bool IsFinished (); | 85 bool IsFinished (); |
86 | 86 |
87 private: | 87 private: |
88 uint32_t m_txCount; | 88 uint32_t m_txCount; ///< transmit count |
89 uint32_t m_rxCount; | 89 uint32_t m_rxCount; ///< receive count |
90 uint32_t m_myId; | 90 uint32_t m_myId; ///< ID |
91 Time m_smallestTime; | 91 Time m_smallestTime; ///< smallest time |
92 bool m_isFinished; | 92 bool m_isFinished; ///< is finished |
93 }; | 93 }; |
94 | 94 |
95 /** | 95 /** |
96 * \ingroup simulator | 96 * \ingroup simulator |
97 * \ingroup mpi | 97 * \ingroup mpi |
98 * | 98 * |
99 * \brief Distributed simulator implementation using lookahead | 99 * \brief Distributed simulator implementation using lookahead |
100 */ | 100 */ |
101 class DistributedSimulatorImpl : public SimulatorImpl | 101 class DistributedSimulatorImpl : public SimulatorImpl |
102 { | 102 { |
103 public: | 103 public: |
| 104 /** |
| 105 * \brief Get the type ID. |
| 106 * \return the object TypeId |
| 107 */ |
104 static TypeId GetTypeId (void); | 108 static TypeId GetTypeId (void); |
105 | 109 |
106 DistributedSimulatorImpl (); | 110 DistributedSimulatorImpl (); |
107 ~DistributedSimulatorImpl (); | 111 ~DistributedSimulatorImpl (); |
108 | 112 |
109 // virtual from SimulatorImpl | 113 // virtual from SimulatorImpl |
110 virtual void Destroy (); | 114 virtual void Destroy (); |
111 virtual bool IsFinished (void) const; | 115 virtual bool IsFinished (void) const; |
112 virtual void Stop (void); | 116 virtual void Stop (void); |
113 virtual void Stop (Time const &delay); | 117 virtual void Stop (Time const &delay); |
114 virtual EventId Schedule (Time const &delay, EventImpl *event); | 118 virtual EventId Schedule (Time const &delay, EventImpl *event); |
115 virtual void ScheduleWithContext (uint32_t context, Time const &delay, EventIm
pl *event); | 119 virtual void ScheduleWithContext (uint32_t context, Time const &delay, EventIm
pl *event); |
116 virtual EventId ScheduleNow (EventImpl *event); | 120 virtual EventId ScheduleNow (EventImpl *event); |
117 virtual EventId ScheduleDestroy (EventImpl *event); | 121 virtual EventId ScheduleDestroy (EventImpl *event); |
118 virtual void Remove (const EventId &id); | 122 virtual void Remove (const EventId &id); |
119 virtual void Cancel (const EventId &id); | 123 virtual void Cancel (const EventId &id); |
120 virtual bool IsExpired (const EventId &id) const; | 124 virtual bool IsExpired (const EventId &id) const; |
121 virtual void Run (void); | 125 virtual void Run (void); |
122 virtual Time Now (void) const; | 126 virtual Time Now (void) const; |
123 virtual Time GetDelayLeft (const EventId &id) const; | 127 virtual Time GetDelayLeft (const EventId &id) const; |
124 virtual Time GetMaximumSimulationTime (void) const; | 128 virtual Time GetMaximumSimulationTime (void) const; |
| 129 /** |
| 130 * Set maximum look ahead function |
| 131 * \param lookAhead the maximum look ahead time |
| 132 */ |
125 virtual void SetMaximumLookAhead (const Time lookAhead); | 133 virtual void SetMaximumLookAhead (const Time lookAhead); |
126 virtual void SetScheduler (ObjectFactory schedulerFactory); | 134 virtual void SetScheduler (ObjectFactory schedulerFactory); |
127 virtual uint32_t GetSystemId (void) const; | 135 virtual uint32_t GetSystemId (void) const; |
128 virtual uint32_t GetContext (void) const; | 136 virtual uint32_t GetContext (void) const; |
129 | 137 |
130 private: | 138 private: |
131 virtual void DoDispose (void); | 139 virtual void DoDispose (void); |
| 140 /// Calculate look ahead function |
132 void CalculateLookAhead (void); | 141 void CalculateLookAhead (void); |
| 142 /** |
| 143 * Is local finished function |
| 144 * \returns true if finished |
| 145 */ |
133 bool IsLocalFinished (void) const; | 146 bool IsLocalFinished (void) const; |
134 | 147 |
| 148 /// Process one event function |
135 void ProcessOneEvent (void); | 149 void ProcessOneEvent (void); |
| 150 /** |
| 151 * Next timestamp function |
| 152 * \returns the next timestamp |
| 153 */ |
136 uint64_t NextTs (void) const; | 154 uint64_t NextTs (void) const; |
| 155 /** |
| 156 * Next function |
| 157 * \returns the next time |
| 158 */ |
137 Time Next (void) const; | 159 Time Next (void) const; |
138 typedef std::list<EventId> DestroyEvents; | 160 typedef std::list<EventId> DestroyEvents; ///< DestroyEvents typedef |
139 | 161 |
140 DestroyEvents m_destroyEvents; | 162 DestroyEvents m_destroyEvents; ///< destroy events |
141 bool m_stop; | 163 bool m_stop; ///< stop? |
142 bool m_globalFinished; // Are all parallel instances completed. | 164 bool m_globalFinished; ///< Are all parallel instances completed. |
143 Ptr<Scheduler> m_events; | 165 Ptr<Scheduler> m_events; ///< events |
144 uint32_t m_uid; | 166 uint32_t m_uid; ///< UID |
145 uint32_t m_currentUid; | 167 uint32_t m_currentUid; ///< current UID |
146 uint64_t m_currentTs; | 168 uint64_t m_currentTs; ///< current timestamp |
147 uint32_t m_currentContext; | 169 uint32_t m_currentContext; ///< current context |
148 // number of events that have been inserted but not yet scheduled, | 170 // number of events that have been inserted but not yet scheduled, |
149 // not counting the "destroy" events; this is used for validation | 171 // not counting the "destroy" events; this is used for validation |
150 int m_unscheduledEvents; | 172 int m_unscheduledEvents; ///< unscheduled events |
151 | 173 |
152 LbtsMessage* m_pLBTS; // Allocated once we know how many systems | 174 LbtsMessage* m_pLBTS; ///< Allocated once we know how many systems |
153 uint32_t m_myId; // MPI Rank | 175 uint32_t m_myId; ///< MPI Rank |
154 uint32_t m_systemCount; // MPI Size | 176 uint32_t m_systemCount; ///< MPI Size |
155 Time m_grantedTime; // Last LBTS | 177 Time m_grantedTime; ///< Last LBTS |
156 static Time m_lookAhead; // Lookahead value | 178 static Time m_lookAhead; ///< Lookahead value |
157 | 179 |
158 }; | 180 }; |
159 | 181 |
160 } // namespace ns3 | 182 } // namespace ns3 |
161 | 183 |
162 #endif /* NS3_DISTRIBUTED_SIMULATOR_IMPL_H */ | 184 #endif /* NS3_DISTRIBUTED_SIMULATOR_IMPL_H */ |
OLD | NEW |