A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
wall-clock-synchronizer.h
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008 University of Washington
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
19
#ifndef WALL_CLOCK_CLOCK_SYNCHRONIZER_H
20
#define WALL_CLOCK_CLOCK_SYNCHRONIZER_H
21
22
#include "system-condition.h"
23
#include "synchronizer.h"
24
25
namespace
ns3 {
26
62
class
WallClockSynchronizer
:
public
Synchronizer
63
{
64
public
:
65
WallClockSynchronizer
();
66
virtual
~
WallClockSynchronizer
();
67
68
static
const
uint64_t US_PER_NS = (uint64_t)1000;
69
static
const
uint64_t US_PER_SEC = (uint64_t)1000000;
70
static
const
uint64_t NS_PER_SEC = (uint64_t)1000000000;
71
72
protected
:
84
virtual
bool
DoRealtime
(
void
);
85
99
virtual
uint64_t
DoGetCurrentRealtime
(
void
);
100
126
virtual
void
DoSetOrigin
(uint64_t ns);
127
141
virtual
int64_t
DoGetDrift
(uint64_t ns);
142
163
virtual
bool
DoSynchronize
(uint64_t nsCurrent, uint64_t nsDelay);
164
virtual
void
DoSignal
(
void
);
165
virtual
void
DoSetCondition
(
bool
cond);
166
167
virtual
void
DoEventStart (
void
);
168
virtual
uint64_t DoEventEnd (
void
);
169
170
bool
SpinWait (uint64_t);
171
bool
SleepWait (uint64_t);
172
173
uint64_t DriftCorrect (uint64_t nsNow, uint64_t nsDelay);
174
175
uint64_t GetRealtime (
void
);
176
uint64_t GetNormalizedRealtime (
void
);
177
178
void
NsToTimeval (int64_t ns,
struct
timeval *tv);
179
uint64_t TimevalToNs (
struct
timeval *tv);
180
181
void
TimevalAdd (
182
struct
timeval *tv1,
183
struct
timeval *tv2,
184
struct
timeval *result);
185
186
uint64_t m_cpuTick;
187
uint64_t m_realtimeTick;
188
uint64_t m_jiffy;
189
uint64_t m_nsEventStart;
190
191
SystemCondition
m_condition;
192
};
193
194
}
// namespace ns3
195
196
#endif
/* WALL_CLOCK_SYNCHRONIZER_H */
ns3::SystemCondition
A class which provides a relatively platform-independent conditional-wait thread synchronization prim...
Definition:
system-condition.h:56
ns3::WallClockSynchronizer::DoGetDrift
virtual int64_t DoGetDrift(uint64_t ns)
Declaration of method used to retrieve drift between the real time clock used to synchronize the simu...
Definition:
wall-clock-synchronizer.cc:107
ns3::WallClockSynchronizer::DoRealtime
virtual bool DoRealtime(void)
Return true if this synchronizer is actually synchronizing to a realtime clock. The simulator sometim...
Definition:
wall-clock-synchronizer.cc:77
ns3::WallClockSynchronizer::DoGetCurrentRealtime
virtual uint64_t DoGetCurrentRealtime(void)
Retrieve the value of the origin of the underlying normalized wall clock time in nanosecond units...
Definition:
wall-clock-synchronizer.cc:84
ns3::WallClockSynchronizer::DoSynchronize
virtual bool DoSynchronize(uint64_t nsCurrent, uint64_t nsDelay)
Wait until the real time is in sync with the specified simulation time.
Definition:
wall-clock-synchronizer.cc:147
ns3::Synchronizer
Base class used for synchronizing the simulation events to some real time "wall clock.".
Definition:
synchronizer.h:44
ns3::WallClockSynchronizer::DoSetOrigin
virtual void DoSetOrigin(uint64_t ns)
Establish a correspondence between a simulation time and a wall-clock (real) time.
Definition:
wall-clock-synchronizer.cc:91
ns3::WallClockSynchronizer::DoSetCondition
virtual void DoSetCondition(bool cond)
Declaration of the method used to set the condition variable that tells a possible simulator thread w...
Definition:
wall-clock-synchronizer.cc:274
ns3::WallClockSynchronizer
Class used for synchronizing the simulation events to a real-time "wall clock" using Posix Clock func...
Definition:
wall-clock-synchronizer.h:62
ns3::WallClockSynchronizer::DoSignal
virtual void DoSignal(void)
Declaration of the method used to tell a possible simulator thread waiting in the DoSynchronize metho...
Definition:
wall-clock-synchronizer.cc:265
src
core
model
wall-clock-synchronizer.h
Generated on Sun Mar 16 2014 11:25:02 for ns-3 by
1.8.6