--- a/src/core/model/wall-clock-synchronizer.cc Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/wall-clock-synchronizer.cc Sat Nov 10 19:16:38 2012 +0100
@@ -30,7 +30,7 @@
WallClockSynchronizer::WallClockSynchronizer ()
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
//
// In Linux, the basic timekeeping unit is derived from a variable called HZ
// HZ is the frequency in hertz of the system timer. The system timer fires
@@ -70,27 +70,27 @@
WallClockSynchronizer::~WallClockSynchronizer ()
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
}
bool
WallClockSynchronizer::DoRealtime (void)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return true;
}
uint64_t
WallClockSynchronizer::DoGetCurrentRealtime (void)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return GetNormalizedRealtime ();
}
void
WallClockSynchronizer::DoSetOrigin (uint64_t ns)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << ns);
//
// In order to make sure we're really locking the simulation time to some
// wall-clock time, we need to be able to compare that simulation time to
@@ -106,7 +106,7 @@
int64_t
WallClockSynchronizer::DoGetDrift (uint64_t ns)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << ns);
//
// In order to make sure we're really locking the simulation time to some
// wall-clock time, we need to be able to compare that simulation time to
@@ -146,7 +146,7 @@
bool
WallClockSynchronizer::DoSynchronize (uint64_t nsCurrent, uint64_t nsDelay)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << nsCurrent << nsDelay);
//
// This is the belly of the beast. We have received two parameters from the
// simulator proper -- a current simulation time (nsCurrent) and a simulation
@@ -264,7 +264,7 @@
void
WallClockSynchronizer::DoSignal (void)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
m_condition.SetCondition (true);
m_condition.Signal ();
@@ -273,28 +273,28 @@
void
WallClockSynchronizer::DoSetCondition (bool cond)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << cond);
m_condition.SetCondition (cond);
}
void
WallClockSynchronizer::DoEventStart (void)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
m_nsEventStart = GetNormalizedRealtime ();
}
uint64_t
WallClockSynchronizer::DoEventEnd (void)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return GetNormalizedRealtime () - m_nsEventStart;
}
bool
WallClockSynchronizer::SpinWait (uint64_t ns)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << ns);
//
// Do a busy-wait until the normalized realtime equals the value passed in
// or the condition variable becomes true. The condition becomes true if
@@ -322,7 +322,7 @@
bool
WallClockSynchronizer::SleepWait (uint64_t ns)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << ns);
//
// Put our process to sleep for some number of nanoseconds. Typically this
// will be some time equal to an integral number of jiffies. We will usually
@@ -348,6 +348,7 @@
uint64_t
WallClockSynchronizer::DriftCorrect (uint64_t nsNow, uint64_t nsDelay)
{
+ NS_LOG_FUNCTION (this << nsNow << nsDelay);
int64_t drift = DoGetDrift (nsNow);
//
// If we're running late, drift will be positive and we need to correct by
@@ -378,6 +379,7 @@
uint64_t
WallClockSynchronizer::GetRealtime (void)
{
+ NS_LOG_FUNCTION (this);
struct timeval tvNow;
gettimeofday (&tvNow, NULL);
return TimevalToNs (&tvNow);
@@ -386,12 +388,14 @@
uint64_t
WallClockSynchronizer::GetNormalizedRealtime (void)
{
+ NS_LOG_FUNCTION (this);
return GetRealtime () - m_realtimeOriginNano;
}
void
WallClockSynchronizer::NsToTimeval (int64_t ns, struct timeval *tv)
{
+ NS_LOG_FUNCTION (this << ns << tv);
NS_ASSERT ((ns % US_PER_NS) == 0);
tv->tv_sec = ns / NS_PER_SEC;
tv->tv_usec = (ns % NS_PER_SEC) / US_PER_NS;
@@ -400,6 +404,7 @@
uint64_t
WallClockSynchronizer::TimevalToNs (struct timeval *tv)
{
+ NS_LOG_FUNCTION (this << tv);
uint64_t nsResult = tv->tv_sec * NS_PER_SEC + tv->tv_usec * US_PER_NS;
NS_ASSERT ((nsResult % US_PER_NS) == 0);
return nsResult;
@@ -411,6 +416,7 @@
struct timeval *tv2,
struct timeval *result)
{
+ NS_LOG_FUNCTION (this << tv1 << tv2 << result);
result->tv_sec = tv1->tv_sec + tv2->tv_sec;
result->tv_usec = tv1->tv_usec + tv2->tv_usec;
if (result->tv_usec > (int64_t)US_PER_SEC)