equal
deleted
inserted
replaced
181 protected: |
181 protected: |
182 /** |
182 /** |
183 * @brief Establish a correspondence between a simulation time and a |
183 * @brief Establish a correspondence between a simulation time and a |
184 * wall-clock (real) time. |
184 * wall-clock (real) time. |
185 * |
185 * |
186 * @internal |
|
187 * |
|
188 * There are three timelines involved here: the simulation time, the |
186 * There are three timelines involved here: the simulation time, the |
189 * (absolute) wall-clock time and the (relative) synchronizer real time. |
187 * (absolute) wall-clock time and the (relative) synchronizer real time. |
190 * Calling this method makes a correspondence between the origin of the |
188 * Calling this method makes a correspondence between the origin of the |
191 * synchronizer time and the current wall-clock time. |
189 * synchronizer time and the current wall-clock time. |
192 * |
190 * |
210 |
208 |
211 /** |
209 /** |
212 * @brief Return true if this synchronizer is actually synchronizing to a |
210 * @brief Return true if this synchronizer is actually synchronizing to a |
213 * realtime clock. The simulator sometimes needs to know this. |
211 * realtime clock. The simulator sometimes needs to know this. |
214 * |
212 * |
215 * @internal |
|
216 * |
|
217 * Subclasses are expected to implement this method to tell the outside world |
213 * Subclasses are expected to implement this method to tell the outside world |
218 * whether or not they are synchronizing to a realtime clock. |
214 * whether or not they are synchronizing to a realtime clock. |
219 * |
215 * |
220 * @returns True if locked with realtime, false if not. |
216 * @returns True if locked with realtime, false if not. |
221 */ |
217 */ |
223 |
219 |
224 /** |
220 /** |
225 * @brief Retrieve the value of the origin of the underlying normalized wall |
221 * @brief Retrieve the value of the origin of the underlying normalized wall |
226 * clock time in simulator timestep units. |
222 * clock time in simulator timestep units. |
227 * |
223 * |
228 * @internal |
|
229 * |
|
230 * Subclasses are expected to implement this method to do the actual |
224 * Subclasses are expected to implement this method to do the actual |
231 * real-time-clock-specific work of getting the current time. |
225 * real-time-clock-specific work of getting the current time. |
232 * |
226 * |
233 * @returns The normalized wall clock time (in nanosecond units). |
227 * @returns The normalized wall clock time (in nanosecond units). |
234 * @see TimeStepPrecision::Get |
228 * @see TimeStepPrecision::Get |
237 virtual uint64_t DoGetCurrentRealtime (void) = 0; |
231 virtual uint64_t DoGetCurrentRealtime (void) = 0; |
238 |
232 |
239 /** |
233 /** |
240 * @brief Wait until the real time is in sync with the specified simulation |
234 * @brief Wait until the real time is in sync with the specified simulation |
241 * time. |
235 * time. |
242 * |
|
243 * @internal |
|
244 * |
236 * |
245 * This is where the real work of synchronization is done. The Time passed |
237 * This is where the real work of synchronization is done. The Time passed |
246 * in as a parameter is the simulation time. The job of Synchronize is to |
238 * in as a parameter is the simulation time. The job of Synchronize is to |
247 * translate from simulation time to synchronizer time (in a perfect world |
239 * translate from simulation time to synchronizer time (in a perfect world |
248 * this is the same time) and then figure out how long in real-time it needs |
240 * this is the same time) and then figure out how long in real-time it needs |
284 |
276 |
285 /** |
277 /** |
286 * @brief Declaration of method used to retrieve drift between the real time |
278 * @brief Declaration of method used to retrieve drift between the real time |
287 * clock used to synchronize the simulation and the current simulation time. |
279 * clock used to synchronize the simulation and the current simulation time. |
288 * |
280 * |
289 * @internal |
|
290 * |
|
291 * @param ns Simulation timestep from the simulator normalized to nanosecond |
281 * @param ns Simulation timestep from the simulator normalized to nanosecond |
292 * steps. |
282 * steps. |
293 * @returns Drift in nanosecond units. |
283 * @returns Drift in nanosecond units. |
294 * @see TimeStepPrecision::Get |
284 * @see TimeStepPrecision::Get |
295 * @see Synchronizer::SetOrigin |
285 * @see Synchronizer::SetOrigin |
306 private: |
296 private: |
307 /** |
297 /** |
308 * @brief Convert a simulator time step (which can be steps of time in a |
298 * @brief Convert a simulator time step (which can be steps of time in a |
309 * user-specified unit) to a normalized time step in nanosecond units. |
299 * user-specified unit) to a normalized time step in nanosecond units. |
310 * |
300 * |
311 * @internal |
|
312 * |
|
313 * @param ts The simulation time step to be normalized. |
301 * @param ts The simulation time step to be normalized. |
314 * @returns The simulation time step normalized to nanosecond units. |
302 * @returns The simulation time step normalized to nanosecond units. |
315 * @see TimeStepPrecision::Get |
303 * @see TimeStepPrecision::Get |
316 */ |
304 */ |
317 uint64_t TimeStepToNanosecond (uint64_t ts); |
305 uint64_t TimeStepToNanosecond (uint64_t ts); |
318 |
306 |
319 /** |
307 /** |
320 * @brief Convert a normalized nanosecond count into a simulator time step |
308 * @brief Convert a normalized nanosecond count into a simulator time step |
321 * (which can be steps of time in a user-specified unit). |
309 * (which can be steps of time in a user-specified unit). |
322 * |
310 * |
323 * @internal |
|
324 * |
|
325 * @param ns The nanosecond count step to be converted |
311 * @param ns The nanosecond count step to be converted |
326 * @returns The simulation time step to be interpreted in appropriate units. |
312 * @returns The simulation time step to be interpreted in appropriate units. |
327 * @see TimeStepPrecision::Get |
313 * @see TimeStepPrecision::Get |
328 */ |
314 */ |
329 uint64_t NanosecondToTimeStep (uint64_t ns); |
315 uint64_t NanosecondToTimeStep (uint64_t ns); |