Clean up function logging of core module.
authorMaja Grubišić <maja.grubisic@live.com>
Sat, 10 Nov 2012 19:16:38 +0100
changeset 9134 7a750f032acd
parent 9133 bcf7cef191c1
child 9135 5016d4c1ad81
Clean up function logging of core module.
src/core/model/attribute-construction-list.cc
src/core/model/attribute.cc
src/core/model/boolean.cc
src/core/model/breakpoint.cc
src/core/model/calendar-scheduler.cc
src/core/model/callback.cc
src/core/model/command-line.cc
src/core/model/config.cc
src/core/model/default-simulator-impl.cc
src/core/model/double.cc
src/core/model/enum.cc
src/core/model/event-id.cc
src/core/model/event-impl.cc
src/core/model/fatal-impl.cc
src/core/model/global-value.cc
src/core/model/heap-scheduler.cc
src/core/model/int64x64-128.cc
src/core/model/int64x64-cairo.cc
src/core/model/int64x64.cc
src/core/model/integer.cc
src/core/model/list-scheduler.cc
src/core/model/make-event.cc
src/core/model/map-scheduler.cc
src/core/model/names.cc
src/core/model/object-base.cc
src/core/model/object-factory.cc
src/core/model/object-ptr-container.cc
src/core/model/object.cc
src/core/model/pointer.cc
src/core/model/random-variable-stream-helper.cc
src/core/model/random-variable-stream.cc
src/core/model/random-variable.cc
src/core/model/realtime-simulator-impl.cc
src/core/model/ref-count-base.cc
src/core/model/rng-seed-manager.cc
src/core/model/rng-stream.cc
src/core/model/scheduler.cc
src/core/model/simulator-impl.cc
src/core/model/simulator.cc
src/core/model/synchronizer.cc
src/core/model/system-path.cc
src/core/model/system-thread.cc
src/core/model/test.cc
src/core/model/time.cc
src/core/model/timer.cc
src/core/model/trace-source-accessor.cc
src/core/model/type-id.cc
src/core/model/uinteger.cc
src/core/model/unix-fd-reader.cc
src/core/model/unix-system-condition.cc
src/core/model/unix-system-mutex.cc
src/core/model/unix-system-wall-clock-ms.cc
src/core/model/vector.cc
src/core/model/wall-clock-synchronizer.cc
src/core/model/watchdog.cc
src/core/model/win32-system-wall-clock-ms.cc
--- a/src/core/model/attribute-construction-list.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/attribute-construction-list.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -25,13 +25,17 @@
 NS_LOG_COMPONENT_DEFINE("AttributeConstructionList");
 
 AttributeConstructionList::AttributeConstructionList ()
-{}
+{
+  NS_LOG_FUNCTION (this);
+}
 
 void 
 AttributeConstructionList::Add (std::string name, Ptr<const AttributeChecker> checker, Ptr<AttributeValue> value)
 {
   // get rid of any previous value stored in this
   // vector of values.
+  NS_LOG_FUNCTION (this << name << checker << value);
+
   for (std::list<struct Item>::iterator k = m_list.begin (); k != m_list.end (); k++)
     {
       if (k->checker == checker)
@@ -51,7 +55,7 @@
 Ptr<AttributeValue> 
 AttributeConstructionList::Find (Ptr<const AttributeChecker> checker) const
 {
-  NS_LOG_FUNCTION (checker);
+  NS_LOG_FUNCTION (this << checker);
   for (CIterator k = m_list.begin (); k != m_list.end (); k++)
     {
       NS_LOG_DEBUG ("Found " << k->name << " " << k->checker << " " << k->value);
@@ -66,11 +70,13 @@
 AttributeConstructionList::CIterator 
 AttributeConstructionList::Begin (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_list.begin();
 }
 AttributeConstructionList::CIterator
 AttributeConstructionList::End (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_list.end();
 }
 
--- a/src/core/model/attribute.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/attribute.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -29,29 +29,36 @@
 
 AttributeValue::AttributeValue ()
 {
+  NS_LOG_FUNCTION (this);
 }
 AttributeValue::~AttributeValue ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 
 AttributeAccessor::AttributeAccessor ()
 {
+  NS_LOG_FUNCTION (this);
 }
 AttributeAccessor::~AttributeAccessor ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 AttributeChecker::AttributeChecker ()
 {
+  NS_LOG_FUNCTION (this);
 }
 AttributeChecker::~AttributeChecker ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 Ptr<AttributeValue> 
 AttributeChecker::CreateValidValue (const AttributeValue &value) const
 {
+  NS_LOG_FUNCTION (this << &value);
   if (Check (value))
     {
       return value.Copy ();
@@ -79,20 +86,24 @@
 
 EmptyAttributeValue::EmptyAttributeValue ()
 {
+  NS_LOG_FUNCTION (this);
 }
 Ptr<AttributeValue>
 EmptyAttributeValue::Copy (void) const
 {
+  NS_LOG_FUNCTION (this);
   return Create<EmptyAttributeValue> ();
 }
 std::string
 EmptyAttributeValue::SerializeToString (Ptr<const AttributeChecker> checker) const
 {
+  NS_LOG_FUNCTION (this << checker);
   return "";
 }
 bool
 EmptyAttributeValue::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker)
 {
+  NS_LOG_FUNCTION (this << value << checker);
   return true;
 }
 
--- a/src/core/model/boolean.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/boolean.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -19,34 +19,44 @@
  */
 #include "boolean.h"
 #include "fatal-error.h"
+#include "log.h"
+
+NS_LOG_COMPONENT_DEFINE ("Boolean");
 
 namespace ns3 {
 
 BooleanValue::BooleanValue ()
   : m_value (false)
 {
+  NS_LOG_FUNCTION (this);
 }
 BooleanValue::BooleanValue (bool value)
   : m_value (value)
 {
+  NS_LOG_FUNCTION (this << value);
 }
 void
 BooleanValue::Set (bool value)
 {
+  NS_LOG_FUNCTION (this << value);
   m_value = value;
 }
 bool
 BooleanValue::Get (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_value;
 }
 BooleanValue::operator bool () const
 {
+  NS_LOG_FUNCTION (this);
   return m_value;
 }
 
 std::ostream & operator << (std::ostream &os, const BooleanValue &value)
 {
+  NS_LOG_FUNCTION (&os << &value);
+
   if (value.Get ())
     {
       os << "true";
@@ -61,11 +71,15 @@
 Ptr<AttributeValue> 
 BooleanValue::Copy (void) const
 {
+  NS_LOG_FUNCTION (this);
+
   return Create<BooleanValue> (*this);
 }
 std::string 
 BooleanValue::SerializeToString (Ptr<const AttributeChecker> checker) const
 {
+  NS_LOG_FUNCTION (this << checker);
+
   if (m_value)
     {
       return "true";
@@ -78,6 +92,8 @@
 bool 
 BooleanValue::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker)
 {
+  NS_LOG_FUNCTION (this << value << checker);
+
   if (value == "true" ||
       value == "1" ||
       value == "t")
--- a/src/core/model/breakpoint.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/breakpoint.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -21,10 +21,13 @@
 
 #include "breakpoint.h"
 #include "ns3/core-config.h"
+#include "log.h"
 #ifdef HAVE_SIGNAL_H
 # include <signal.h>
 #endif
 
+NS_LOG_COMPONENT_DEFINE ("Breakpoint");
+
 namespace ns3 {
 
 #if defined (HAVE_SIGNAL_H) && defined (SIGTRAP)
@@ -32,6 +35,8 @@
 void
 BreakpointFallback (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
+
   raise (SIGTRAP);
 }
 
@@ -40,6 +45,8 @@
 void
 BreakpointFallback (void)
 {
+  NS_LOG_FUNCTION (this);
+
   int *a = 0;
   /**
    * we test here to allow a debugger to change the value of
--- a/src/core/model/calendar-scheduler.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/calendar-scheduler.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -35,6 +35,7 @@
 TypeId
 CalendarScheduler::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::CalendarScheduler")
     .SetParent<Scheduler> ()
     .AddConstructor<CalendarScheduler> ()
@@ -70,6 +71,8 @@
 void
 CalendarScheduler::PrintInfo (void)
 {
+  NS_LOG_FUNCTION (this);
+
   std::cout << "nBuckets=" << m_nBuckets << ", width=" << m_width << std::endl;
   std::cout << "Bucket Distribution ";
   for (uint32_t i = 0; i < m_nBuckets; i++)
@@ -81,6 +84,8 @@
 uint32_t
 CalendarScheduler::Hash (uint64_t ts) const
 {
+  NS_LOG_FUNCTION (this);
+
   uint32_t bucket = (ts / m_width) % m_nBuckets;
   return bucket;
 }
@@ -109,6 +114,7 @@
 void
 CalendarScheduler::Insert (const Event &ev)
 {
+  NS_LOG_FUNCTION (this << &ev);
   DoInsert (ev);
   m_qSize++;
   ResizeUp ();
@@ -116,12 +122,13 @@
 bool
 CalendarScheduler::IsEmpty (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_qSize == 0;
 }
 Scheduler::Event
 CalendarScheduler::PeekNext (void) const
 {
-  NS_LOG_FUNCTION (this << m_lastBucket << m_bucketTop);
+  NS_LOG_FUNCTION (this);
   NS_ASSERT (!IsEmpty ());
   uint32_t i = m_lastBucket;
   uint64_t bucketTop = m_bucketTop;
@@ -152,6 +159,8 @@
 Scheduler::Event
 CalendarScheduler::DoRemoveNext (void)
 {
+  NS_LOG_FUNCTION (this);
+
   uint32_t i = m_lastBucket;
   uint64_t bucketTop = m_bucketTop;
   int32_t minBucket = -1;
@@ -212,6 +221,7 @@
 void
 CalendarScheduler::Remove (const Event &ev)
 {
+  NS_LOG_FUNCTION (this << &ev);
   NS_ASSERT (!IsEmpty ());
   // bucket index of event
   uint32_t bucket = Hash (ev.key.m_ts);
@@ -235,6 +245,8 @@
 void
 CalendarScheduler::ResizeUp (void)
 {
+  NS_LOG_FUNCTION (this);
+
   if (m_qSize > m_nBuckets * 2
       && m_nBuckets < 32768)
     {
@@ -244,6 +256,8 @@
 void
 CalendarScheduler::ResizeDown (void)
 {
+  NS_LOG_FUNCTION (this);
+
   if (m_qSize < m_nBuckets / 2)
     {
       Resize (m_nBuckets / 2);
@@ -253,6 +267,8 @@
 uint32_t
 CalendarScheduler::CalculateNewWidth (void)
 {
+  NS_LOG_FUNCTION (this);
+
   if (m_qSize < 2)
     {
       return 1;
@@ -330,6 +346,8 @@
 void
 CalendarScheduler::DoResize (uint32_t newSize, uint32_t newWidth)
 {
+  NS_LOG_FUNCTION (this << newSize << newWidth);
+
   Bucket *oldBuckets = m_buckets;
   uint32_t oldNBuckets = m_nBuckets;
   Init (newSize, newWidth, m_lastPrio);
--- a/src/core/model/callback.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/callback.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -1,31 +1,41 @@
 #include "callback.h"
+#include "log.h"
+
+NS_LOG_COMPONENT_DEFINE ("Callback");
 
 namespace ns3 {
 
 CallbackValue::CallbackValue ()
   : m_value ()
 {
+  NS_LOG_FUNCTION (this);
 }
 CallbackValue::CallbackValue (const CallbackBase &base)
   : m_value (base)
 {
+  NS_LOG_FUNCTION (&base);
 }
 CallbackValue::~CallbackValue ()
 {
+  NS_LOG_FUNCTION (this);
 }
 void
 CallbackValue::Set (CallbackBase base)
 {
+  NS_LOG_FUNCTION (&base);
+
   m_value = base;
 }
 Ptr<AttributeValue>
 CallbackValue::Copy (void) const
 {
+  NS_LOG_FUNCTION (this);
   return Create<CallbackValue> (m_value);
 }
 std::string
 CallbackValue::SerializeToString (Ptr<const AttributeChecker> checker) const
 {
+  NS_LOG_FUNCTION (this << checker);
   std::ostringstream oss;
   oss << PeekPointer (m_value.GetImpl ());
   return oss.str ();
@@ -33,6 +43,7 @@
 bool
 CallbackValue::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker)
 {
+  NS_LOG_FUNCTION (this << value << checker);
   return false;
 }
 
@@ -51,6 +62,8 @@
 std::string
 CallbackBase::Demangle (const std::string& mangled)
 {
+  NS_LOG_FUNCTION (mangled);
+
   int status;
   char* demangled = abi::__cxa_demangle (mangled.c_str (),
                                          NULL, NULL, &status);
@@ -90,6 +103,7 @@
 std::string
 ns3::CallbackBase::Demangle (const std::string& mangled)
 {
+  NS_LOG_FUNCTION (this << mangled);
   return mangled;
 }
 
--- a/src/core/model/command-line.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/command-line.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -34,25 +34,31 @@
 
 CommandLine::CommandLine ()
 {
+  NS_LOG_FUNCTION (this);
 }
 CommandLine::CommandLine (const CommandLine &cmd)
 {
+  NS_LOG_FUNCTION (&cmd);
   Copy (cmd);
 }
 CommandLine &
 CommandLine::operator = (const CommandLine &cmd)
 {
+  NS_LOG_FUNCTION (&cmd);
   Clear ();
   Copy (cmd);
   return *this;
 }
 CommandLine::~CommandLine ()
 {
+  NS_LOG_FUNCTION (this);
   Clear ();
 }
 void
 CommandLine::Copy (const CommandLine &cmd)
 {
+  NS_LOG_FUNCTION (&cmd);
+
   for (Items::const_iterator i = cmd.m_items.begin (); 
        i != cmd.m_items.end (); ++i)
     {
@@ -62,6 +68,8 @@
 void
 CommandLine::Clear (void)
 {
+  NS_LOG_FUNCTION (this);
+
   for (Items::const_iterator i = m_items.begin (); i != m_items.end (); ++i)
     {
       delete *i;
@@ -71,11 +79,14 @@
 
 CommandLine::Item::~Item ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 void
 CommandLine::Parse (int iargc, char *argv[]) const
 {
+  NS_LOG_FUNCTION (this << iargc << argv);
+
   int argc = iargc;
   for (argc--, argv++; argc > 0; argc--, argv++)
     {
@@ -118,6 +129,8 @@
 void
 CommandLine::PrintHelp (void) const
 {
+  NS_LOG_FUNCTION (this);
+
   std::cout << "--PrintHelp: Print this help message." << std::endl;
   std::cout << "--PrintGroups: Print the list of groups." << std::endl;
   std::cout << "--PrintTypeIds: Print all TypeIds." << std::endl;
@@ -137,6 +150,8 @@
 void
 CommandLine::PrintGlobals (void) const
 {
+  NS_LOG_FUNCTION (this);
+
   for (GlobalValue::Iterator i = GlobalValue::Begin (); i != GlobalValue::End (); ++i)
     {
       std::cout << "    --" << (*i)->GetName () << "=[";
@@ -151,6 +166,8 @@
 void
 CommandLine::PrintAttributes (std::string type) const
 {
+  NS_LOG_FUNCTION (this);
+
   TypeId tid;
   if (!TypeId::LookupByNameFailSafe (type, &tid))
     {
@@ -169,6 +186,8 @@
 void
 CommandLine::PrintGroup (std::string group) const
 {
+  NS_LOG_FUNCTION (this);
+
   for (uint32_t i = 0; i < TypeId::GetRegisteredN (); ++i)
     {
       TypeId tid = TypeId::GetRegistered (i);
@@ -182,6 +201,8 @@
 void
 CommandLine::PrintTypeIds (void) const
 {
+  NS_LOG_FUNCTION (this);
+
   for (uint32_t i = 0; i < TypeId::GetRegisteredN (); ++i)
     {
       TypeId tid = TypeId::GetRegistered (i);
@@ -192,6 +213,8 @@
 void
 CommandLine::PrintGroups (void) const
 {
+  NS_LOG_FUNCTION (this);
+
   std::list<std::string> groups;
   for (uint32_t i = 0; i < TypeId::GetRegisteredN (); ++i)
     {
@@ -224,6 +247,8 @@
 void
 CommandLine::HandleArgument (std::string name, std::string value) const
 {
+  NS_LOG_FUNCTION (this << name << value);
+
   NS_LOG_DEBUG ("Handle arg name="<<name<<" value="<<value);
   if (name == "PrintHelp")
     {
@@ -291,6 +316,7 @@
 bool
 CommandLine::CallbackItem::Parse (std::string value)
 {
+  NS_LOG_FUNCTION (this);
   NS_LOG_DEBUG ("CommandLine::CallbackItem::Parse \"" << value << "\"");
   return m_callback (value);
 }
@@ -300,7 +326,7 @@
                        const std::string &help,
                        Callback<bool, std::string> callback)
 {
-  NS_LOG_FUNCTION (this << name << help << "callback");
+  NS_LOG_FUNCTION (this << &name << &help << &callback);
   CallbackItem *item = new CallbackItem ();
   item->m_name = name;
   item->m_help = help;
--- a/src/core/model/config.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/config.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -36,6 +36,7 @@
 
 MatchContainer::MatchContainer ()
 {
+  NS_LOG_FUNCTION (this);
 }
 MatchContainer::MatchContainer (const std::vector<Ptr<Object> > &objects,
                                 const std::vector<std::string> &contexts,
@@ -44,41 +45,49 @@
     m_contexts (contexts),
     m_path (path)
 {
+  NS_LOG_FUNCTION (this << &objects << &contexts << path);
 }
 MatchContainer::Iterator
 MatchContainer::Begin (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_objects.begin ();
 }
 MatchContainer::Iterator
 MatchContainer::End (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_objects.end ();
 }
 uint32_t
 MatchContainer::GetN (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_objects.size ();
 }
 Ptr<Object>
 MatchContainer::Get (uint32_t i) const
 {
+  NS_LOG_FUNCTION (this << i);
   return m_objects[i];
 }
 std::string
 MatchContainer::GetMatchedPath (uint32_t i) const
 {
+  NS_LOG_FUNCTION (this << i);
   return m_contexts[i];
 }
 std::string
 MatchContainer::GetPath (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_path;
 }
 
 void
 MatchContainer::Set (std::string name, const AttributeValue &value)
 {
+  NS_LOG_FUNCTION (this << name << &value);
   for (Iterator tmp = Begin (); tmp != End (); ++tmp)
     {
       Ptr<Object> object = *tmp;
@@ -88,6 +97,7 @@
 void 
 MatchContainer::Connect (std::string name, const CallbackBase &cb)
 {
+  NS_LOG_FUNCTION (this << name << &cb);
   NS_ASSERT (m_objects.size () == m_contexts.size ());
   for (uint32_t i = 0; i < m_objects.size (); ++i)
     {
@@ -99,6 +109,8 @@
 void 
 MatchContainer::ConnectWithoutContext (std::string name, const CallbackBase &cb)
 {
+  NS_LOG_FUNCTION (this << name << &cb);
+
   for (Iterator tmp = Begin (); tmp != End (); ++tmp)
     {
       Ptr<Object> object = *tmp;
@@ -108,6 +120,7 @@
 void 
 MatchContainer::Disconnect (std::string name, const CallbackBase &cb)
 {
+  NS_LOG_FUNCTION (this << name << &cb);
   NS_ASSERT (m_objects.size () == m_contexts.size ());
   for (uint32_t i = 0; i < m_objects.size (); ++i)
     {
@@ -119,6 +132,7 @@
 void 
 MatchContainer::DisconnectWithoutContext (std::string name, const CallbackBase &cb)
 {
+  NS_LOG_FUNCTION (this << name << &cb);
   for (Iterator tmp = Begin (); tmp != End (); ++tmp)
     {
       Ptr<Object> object = *tmp;
@@ -142,10 +156,12 @@
 ArrayMatcher::ArrayMatcher (std::string element)
   : m_element (element)
 {
+  NS_LOG_FUNCTION (this << element);
 }
 bool
 ArrayMatcher::Matches (uint32_t i) const
 {
+  NS_LOG_FUNCTION (this << i);
   if (m_element == "*")
     {
       NS_LOG_DEBUG ("Array "<<i<<" matches *");
@@ -209,6 +225,7 @@
 bool
 ArrayMatcher::StringToUint32 (std::string str, uint32_t *value) const
 {
+  NS_LOG_FUNCTION (this << str << value);
   std::istringstream iss;
   iss.str (str);
   iss >> (*value);
@@ -237,14 +254,18 @@
 Resolver::Resolver (std::string path)
   : m_path (path)
 {
+  NS_LOG_FUNCTION (this << path);
   Canonicalize ();
 }
 Resolver::~Resolver ()
 {
+  NS_LOG_FUNCTION (this);
 }
 void
 Resolver::Canonicalize (void)
 {
+  NS_LOG_FUNCTION (this);
+
   // ensure that we start and end with a '/'
   std::string::size_type tmp = m_path.find ("/");
   if (tmp != 0)
@@ -263,12 +284,16 @@
 void 
 Resolver::Resolve (Ptr<Object> root)
 {
+  NS_LOG_FUNCTION (this << root);
+
   DoResolve (m_path, root);
 }
 
 std::string
 Resolver::GetResolvedPath (void) const
 {
+  NS_LOG_FUNCTION (this);
+
   std::string fullPath = "/";
   for (std::vector<std::string>::const_iterator i = m_workStack.begin (); i != m_workStack.end (); i++)
     {
@@ -280,6 +305,8 @@
 void 
 Resolver::DoResolveOne (Ptr<Object> object)
 {
+  NS_LOG_FUNCTION (this << object);
+
   NS_LOG_DEBUG ("resolved="<<GetResolvedPath ());
   DoOne (object, GetResolvedPath ());
 }
@@ -287,7 +314,7 @@
 void
 Resolver::DoResolve (std::string path, Ptr<Object> root)
 {
-  NS_LOG_FUNCTION (path << root);
+  NS_LOG_FUNCTION (this << path << root);
   NS_ASSERT ((path.find ("/")) == 0);
   std::string::size_type next = path.find ("/", 1);
 
@@ -433,7 +460,7 @@
 void 
 Resolver::DoArrayResolve (std::string path, const ObjectPtrContainerValue &container)
 {
-  NS_LOG_FUNCTION(this << path);
+  NS_LOG_FUNCTION(this << path << &container);
   NS_ASSERT (path != "");
   NS_ASSERT ((path.find ("/")) == 0);
   std::string::size_type next = path.find ("/", 1);
@@ -485,6 +512,8 @@
 void 
 ConfigImpl::ParsePath (std::string path, std::string *root, std::string *leaf) const
 {
+  NS_LOG_FUNCTION (this << path << root << leaf);
+
   std::string::size_type slash = path.find_last_of ("/");
   NS_ASSERT (slash != std::string::npos);
   *root = path.substr (0, slash);
@@ -495,6 +524,8 @@
 void 
 ConfigImpl::Set (std::string path, const AttributeValue &value)
 {
+  NS_LOG_FUNCTION (this << path << &value);
+
   std::string root, leaf;
   ParsePath (path, &root, &leaf);
   Config::MatchContainer container = LookupMatches (root);
@@ -503,6 +534,7 @@
 void 
 ConfigImpl::ConnectWithoutContext (std::string path, const CallbackBase &cb)
 {
+  NS_LOG_FUNCTION (this << path << &cb);
   std::string root, leaf;
   ParsePath (path, &root, &leaf);
   Config::MatchContainer container = LookupMatches (root);
@@ -511,6 +543,7 @@
 void 
 ConfigImpl::DisconnectWithoutContext (std::string path, const CallbackBase &cb)
 {
+  NS_LOG_FUNCTION (this << path << &cb);
   std::string root, leaf;
   ParsePath (path, &root, &leaf);
   Config::MatchContainer container = LookupMatches (root);
@@ -519,6 +552,8 @@
 void 
 ConfigImpl::Connect (std::string path, const CallbackBase &cb)
 {
+  NS_LOG_FUNCTION (this << path << &cb);
+
   std::string root, leaf;
   ParsePath (path, &root, &leaf);
   Config::MatchContainer container = LookupMatches (root);
@@ -527,6 +562,8 @@
 void 
 ConfigImpl::Disconnect (std::string path, const CallbackBase &cb)
 {
+  NS_LOG_FUNCTION (this << path << &cb);
+
   std::string root, leaf;
   ParsePath (path, &root, &leaf);
   Config::MatchContainer container = LookupMatches (root);
@@ -536,7 +573,7 @@
 Config::MatchContainer 
 ConfigImpl::LookupMatches (std::string path)
 {
-  NS_LOG_FUNCTION (path);
+  NS_LOG_FUNCTION (this << path);
   class LookupMatchesResolver : public Resolver 
   {
   public:
@@ -568,12 +605,15 @@
 void 
 ConfigImpl::RegisterRootNamespaceObject (Ptr<Object> obj)
 {
+  NS_LOG_FUNCTION (this << obj);
   m_roots.push_back (obj);
 }
 
 void 
 ConfigImpl::UnregisterRootNamespaceObject (Ptr<Object> obj)
 {
+  NS_LOG_FUNCTION (this << obj);
+
   for (std::vector<Ptr<Object> >::iterator i = m_roots.begin (); i != m_roots.end (); i++)
     {
       if (*i == obj)
@@ -587,11 +627,13 @@
 uint32_t 
 ConfigImpl::GetRootNamespaceObjectN (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_roots.size ();
 }
 Ptr<Object> 
 ConfigImpl::GetRootNamespaceObject (uint32_t i) const
 {
+  NS_LOG_FUNCTION (this << i);
   return m_roots[i];
 }
 
@@ -599,6 +641,7 @@
 
 void Reset (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   // First, let's reset the initial value of every attribute
   for (uint32_t i = 0; i < TypeId::GetRegisteredN (); i++)
     {
@@ -618,10 +661,12 @@
 
 void Set (std::string path, const AttributeValue &value)
 {
+  NS_LOG_FUNCTION (path << &value);
   Singleton<ConfigImpl>::Get ()->Set (path, value);
 }
 void SetDefault (std::string name, const AttributeValue &value)
 {
+  NS_LOG_FUNCTION (name << &value);
   if (!SetDefaultFailSafe(name, value))
     {
       NS_FATAL_ERROR ("Could not set default value for " << name);
@@ -629,6 +674,7 @@
 }
 bool SetDefaultFailSafe (std::string fullName, const AttributeValue &value)
 {
+  NS_LOG_FUNCTION (fullName << &value);
   std::string::size_type pos = fullName.rfind ("::");
   if (pos == std::string::npos)
     {
@@ -660,52 +706,63 @@
 }
 void SetGlobal (std::string name, const AttributeValue &value)
 {
+  NS_LOG_FUNCTION (name << &value);
   GlobalValue::Bind (name, value);
 }
 bool SetGlobalFailSafe (std::string name, const AttributeValue &value)
 {
+  NS_LOG_FUNCTION (name << &value);
   return GlobalValue::BindFailSafe (name, value);
 }
 void ConnectWithoutContext (std::string path, const CallbackBase &cb)
 {
+  NS_LOG_FUNCTION (path << &cb);
   Singleton<ConfigImpl>::Get ()->ConnectWithoutContext (path, cb);
 }
 void DisconnectWithoutContext (std::string path, const CallbackBase &cb)
 {
+  NS_LOG_FUNCTION (path << &cb);
   Singleton<ConfigImpl>::Get ()->DisconnectWithoutContext (path, cb);
 }
 void 
 Connect (std::string path, const CallbackBase &cb)
 {
+  NS_LOG_FUNCTION (path << &cb);
   Singleton<ConfigImpl>::Get ()->Connect (path, cb);
 }
 void 
 Disconnect (std::string path, const CallbackBase &cb)
 {
+  NS_LOG_FUNCTION (path << &cb);
   Singleton<ConfigImpl>::Get ()->Disconnect (path, cb);
 }
 Config::MatchContainer LookupMatches (std::string path)
 {
+  NS_LOG_FUNCTION (path);
   return Singleton<ConfigImpl>::Get ()->LookupMatches (path);
 }
 
 void RegisterRootNamespaceObject (Ptr<Object> obj)
 {
+  NS_LOG_FUNCTION (obj);
   Singleton<ConfigImpl>::Get ()->RegisterRootNamespaceObject (obj);
 }
 
 void UnregisterRootNamespaceObject (Ptr<Object> obj)
 {
+  NS_LOG_FUNCTION (obj);
   Singleton<ConfigImpl>::Get ()->UnregisterRootNamespaceObject (obj);
 }
 
 uint32_t GetRootNamespaceObjectN (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   return Singleton<ConfigImpl>::Get ()->GetRootNamespaceObjectN ();
 }
 
 Ptr<Object> GetRootNamespaceObject (uint32_t i)
 {
+  NS_LOG_FUNCTION (i);
   return Singleton<ConfigImpl>::Get ()->GetRootNamespaceObject (i);
 }
 
--- a/src/core/model/default-simulator-impl.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/default-simulator-impl.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -48,7 +48,7 @@
 
 DefaultSimulatorImpl::DefaultSimulatorImpl ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   m_stop = false;
   // uids are allocated from 4.
   // uid 0 is "invalid" events
@@ -66,13 +66,13 @@
 
 DefaultSimulatorImpl::~DefaultSimulatorImpl ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
 }
 
 void
 DefaultSimulatorImpl::DoDispose (void)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   while (!m_events->IsEmpty ())
     {
       Scheduler::Event next = m_events->RemoveNext ();
@@ -84,7 +84,7 @@
 void
 DefaultSimulatorImpl::Destroy ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   while (!m_destroyEvents.empty ()) 
     {
       Ptr<EventImpl> ev = m_destroyEvents.front ().PeekEventImpl ();
@@ -100,7 +100,7 @@
 void
 DefaultSimulatorImpl::SetScheduler (ObjectFactory schedulerFactory)
 {
-  NS_LOG_FUNCTION (this << &schedulerFactory);
+  NS_LOG_FUNCTION (this << schedulerFactory);
   Ptr<Scheduler> scheduler = schedulerFactory.Create<Scheduler> ();
 
   if (m_events != 0)
@@ -118,14 +118,14 @@
 uint32_t 
 DefaultSimulatorImpl::GetSystemId (void) const
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   return 0;
 }
 
 void
 DefaultSimulatorImpl::ProcessOneEvent (void)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   Scheduler::Event next = m_events->RemoveNext ();
 
   NS_ASSERT (next.key.m_ts >= m_currentTs);
@@ -144,14 +144,14 @@
 bool 
 DefaultSimulatorImpl::IsFinished (void) const
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   return m_events->IsEmpty () || m_stop;
 }
 
 void
 DefaultSimulatorImpl::ProcessEventsWithContext (void)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   if (m_eventsWithContextEmpty)
     {
       return;
@@ -182,7 +182,7 @@
 void
 DefaultSimulatorImpl::Run (void)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   // Set the current threadId as the main threadId
   m_main = SystemThread::Self();
   ProcessEventsWithContext ();
@@ -201,7 +201,7 @@
 void 
 DefaultSimulatorImpl::Stop (void)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   m_stop = true;
 }
 
@@ -239,7 +239,7 @@
 void
 DefaultSimulatorImpl::ScheduleWithContext (uint32_t context, Time const &time, EventImpl *event)
 {
-  NS_LOG_FUNCTION (this << context << time.GetTimeStep () << m_currentTs << event);
+  NS_LOG_FUNCTION (this << context << time.GetTimeStep () << event);
 
   if (SystemThread::Equals (m_main))
     {
@@ -299,7 +299,7 @@
 Time
 DefaultSimulatorImpl::Now (void) const
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   return TimeStep (m_currentTs);
 }
 
@@ -399,7 +399,7 @@
 Time 
 DefaultSimulatorImpl::GetMaximumSimulationTime (void) const
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   // XXX: I am fairly certain other compilers use other non-standard
   // post-fixes to indicate 64 bit constants.
   return TimeStep (0x7fffffffffffffffLL);
@@ -408,7 +408,7 @@
 uint32_t
 DefaultSimulatorImpl::GetContext (void) const
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   return m_currentContext;
 }
 
--- a/src/core/model/double.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/double.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -19,8 +19,11 @@
  */
 #include "double.h"
 #include "object.h"
+#include "log.h"
 #include <sstream>
 
+NS_LOG_COMPONENT_DEFINE ("Double");
+
 namespace ns3 {
 
 ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME (double, Double);
@@ -29,6 +32,8 @@
 
 Ptr<const AttributeChecker> MakeDoubleChecker (double min, double max, std::string name)
 {
+  NS_LOG_FUNCTION (min << max << name);
+
   struct Checker : public AttributeChecker
   {
     Checker (double minValue, double maxValue, std::string name)
@@ -36,6 +41,7 @@
         m_maxValue (maxValue),
         m_name (name) {}
     virtual bool Check (const AttributeValue &value) const {
+      NS_LOG_FUNCTION (&value);
       const DoubleValue *v = dynamic_cast<const DoubleValue *> (&value);
       if (v == 0)
         {
@@ -44,20 +50,25 @@
       return v->Get () >= m_minValue && v->Get () <= m_maxValue;
     }
     virtual std::string GetValueTypeName (void) const {
+      NS_LOG_FUNCTION_NOARGS ();
       return "ns3::DoubleValue";
     }
     virtual bool HasUnderlyingTypeInformation (void) const {
+      NS_LOG_FUNCTION_NOARGS ();
       return true;
     }
     virtual std::string GetUnderlyingTypeInformation (void) const {
+      NS_LOG_FUNCTION_NOARGS ();
       std::ostringstream oss;
       oss << m_name << " " << m_minValue << ":" << m_maxValue;
       return oss.str ();
     }
     virtual Ptr<AttributeValue> Create (void) const {
+      NS_LOG_FUNCTION_NOARGS ();
       return ns3::Create<DoubleValue> ();
     }
     virtual bool Copy (const AttributeValue &source, AttributeValue &destination) const {
+      NS_LOG_FUNCTION (&source << &destination);
       const DoubleValue *src = dynamic_cast<const DoubleValue *> (&source);
       DoubleValue *dst = dynamic_cast<DoubleValue *> (&destination);
       if (src == 0 || dst == 0)
--- a/src/core/model/enum.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/enum.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -19,36 +19,45 @@
  */
 #include "enum.h"
 #include "fatal-error.h"
+#include "log.h"
 #include <sstream>
 
+NS_LOG_COMPONENT_DEFINE ("Enum");
+
 namespace ns3 {
 
 EnumValue::EnumValue ()
   : m_v ()
 {
+  NS_LOG_FUNCTION (this);
 }
 EnumValue::EnumValue (int v)
   : m_v (v)
 {
+  NS_LOG_FUNCTION (this << v);
 }
 void
 EnumValue::Set (int v)
 {
+  NS_LOG_FUNCTION (this << v);
   m_v = v;
 }
 int
 EnumValue::Get (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_v;
 }
 Ptr<AttributeValue>
 EnumValue::Copy (void) const
 {
+  NS_LOG_FUNCTION (this);
   return ns3::Create<EnumValue> (*this);
 }
 std::string 
 EnumValue::SerializeToString (Ptr<const AttributeChecker> checker) const
 {
+  NS_LOG_FUNCTION (this << checker);
   const EnumChecker *p = dynamic_cast<const EnumChecker *> (PeekPointer (checker));
   NS_ASSERT (p != 0);
   for (EnumChecker::ValueSet::const_iterator i = p->m_valueSet.begin (); i != p->m_valueSet.end (); i++)
@@ -66,6 +75,7 @@
 bool 
 EnumValue::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker)
 {
+  NS_LOG_FUNCTION (this << value << checker);
   const EnumChecker *p = dynamic_cast<const EnumChecker *> (PeekPointer (checker));
   NS_ASSERT (p != 0);
   for (EnumChecker::ValueSet::const_iterator i = p->m_valueSet.begin (); i != p->m_valueSet.end (); i++)
@@ -81,21 +91,25 @@
 
 EnumChecker::EnumChecker ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 void
 EnumChecker::AddDefault (int v, std::string name)
 {
+  NS_LOG_FUNCTION (this << v << name);
   m_valueSet.push_front (std::make_pair (v, name));
 }
 void
 EnumChecker::Add (int v, std::string name)
 {
+  NS_LOG_FUNCTION (this << v << name);
   m_valueSet.push_back (std::make_pair (v, name));
 }
 bool
 EnumChecker::Check (const AttributeValue &value) const
 {
+  NS_LOG_FUNCTION (this << &value);
   const EnumValue *p = dynamic_cast<const EnumValue *> (&value);
   if (p == 0)
     {
@@ -113,16 +127,19 @@
 std::string 
 EnumChecker::GetValueTypeName (void) const
 {
+  NS_LOG_FUNCTION (this);
   return "ns3::EnumValue";
 }
 bool 
 EnumChecker::HasUnderlyingTypeInformation (void) const
 {
+  NS_LOG_FUNCTION (this);
   return true;
 }
 std::string 
 EnumChecker::GetUnderlyingTypeInformation (void) const
 {
+  NS_LOG_FUNCTION (this);
   std::ostringstream oss;
   for (ValueSet::const_iterator i = m_valueSet.begin (); i != m_valueSet.end ();)
     {
@@ -138,12 +155,14 @@
 Ptr<AttributeValue>
 EnumChecker::Create (void) const
 {
+  NS_LOG_FUNCTION (this);
   return ns3::Create<EnumValue> ();
 }
 
 bool 
 EnumChecker::Copy (const AttributeValue &source, AttributeValue &destination) const
 {
+  NS_LOG_FUNCTION (this << &source << &destination);
   const EnumValue *src = dynamic_cast<const EnumValue *> (&source);
   EnumValue *dst = dynamic_cast<EnumValue *> (&destination);
   if (src == 0 || dst == 0)
@@ -179,6 +198,11 @@
                  int v21, std::string n21,
                  int v22, std::string n22)
 {
+  NS_LOG_FUNCTION (v1 << n1 << v2 << n2 << v3 << n3 << v4 << n4 << v5 << n5 <<
+                   v6 << n6 << v7 << n7 << v8 << n8 << v9 << n9 << v10 << n10 <<
+                   v11 << n11 << v12 << n12 << v13 << n13 << v14 << n14 <<
+                   v15 << n15 << v16 << n16 << v17 << n17 << v18 << n18 <<
+                   v19 << n19 << v20 << n20 << v21 << n21 << v22 << n22);
   Ptr<EnumChecker> checker = Create<EnumChecker> ();
   checker->AddDefault (v1, n1);
   if (n2 == "")
--- a/src/core/model/event-id.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/event-id.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -20,6 +20,9 @@
 #include "event-id.h"
 #include "simulator.h"
 #include "event-impl.h"
+#include "log.h"
+
+NS_LOG_COMPONENT_DEFINE ("EventId");
 
 namespace ns3 {
 
@@ -29,6 +32,7 @@
     m_context (0),
     m_uid (0)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 EventId::EventId (const Ptr<EventImpl> &impl, uint64_t ts, uint32_t context, uint32_t uid)
@@ -37,45 +41,54 @@
     m_context (context),
     m_uid (uid)
 {
+  NS_LOG_FUNCTION (this << impl << ts << context << uid);
 }
 void
 EventId::Cancel (void)
 {
+  NS_LOG_FUNCTION (this);
   Simulator::Cancel (*this);
 }
 bool
 EventId::IsExpired (void) const
 {
+  NS_LOG_FUNCTION (this);
   return Simulator::IsExpired (*this);
 }
 bool
 EventId::IsRunning (void) const
 {
+  NS_LOG_FUNCTION (this);
   return !IsExpired ();
 }
 EventImpl *
 EventId::PeekEventImpl (void) const
 {
+  NS_LOG_FUNCTION (this);
   return PeekPointer (m_eventImpl);
 }
 uint64_t 
 EventId::GetTs (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_ts;
 }
 uint32_t 
 EventId::GetContext (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_context;
 }
 uint32_t 
 EventId::GetUid (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_uid;
 }
 
 bool operator == (const EventId &a, const EventId &b)
 {
+  NS_LOG_FUNCTION (a.GetUid () << b.GetUid ());
   return 
     a.m_uid == b.m_uid && 
     a.m_context == b.m_context && 
@@ -84,6 +97,7 @@
 }
 bool operator != (const EventId &a, const EventId &b)
 {
+  NS_LOG_FUNCTION (a.GetUid () << b.GetUid ());
   return !(a == b);
 }
 
--- a/src/core/model/event-impl.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/event-impl.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -19,21 +19,27 @@
  */
 
 #include "event-impl.h"
+#include "log.h"
+
+NS_LOG_COMPONENT_DEFINE ("EventImpl");
 
 namespace ns3 {
 
 EventImpl::~EventImpl ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 EventImpl::EventImpl ()
   : m_cancel (false)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 void
 EventImpl::Invoke (void)
 {
+  NS_LOG_FUNCTION (this);
   if (!m_cancel)
     {
       Notify ();
@@ -43,12 +49,14 @@
 void
 EventImpl::Cancel (void)
 {
+  NS_LOG_FUNCTION (this);
   m_cancel = true;
 }
 
 bool
 EventImpl::IsCancelled (void)
 {
+  NS_LOG_FUNCTION (this);
   return m_cancel;
 }
 
--- a/src/core/model/fatal-impl.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/fatal-impl.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -18,6 +18,7 @@
  * Author: Quincy Tse <quincy.tse@nicta.com.au>
  */
 #include "fatal-impl.h"
+#include "log.h"
 
 #include <iostream>
 #include <list>
@@ -27,6 +28,8 @@
 
 #include <csignal>
 
+NS_LOG_COMPONENT_DEFINE ("FatalImpl");
+
 namespace ns3 {
 namespace FatalImpl {
 
@@ -47,11 +50,13 @@
 namespace {
 std::list<std::ostream*> **PeekStreamList (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static std::list<std::ostream*> *streams = 0;
   return &streams;
 }
 std::list<std::ostream*> *GetStreamList (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   std::list<std::ostream*> **pstreams = PeekStreamList ();
   if (*pstreams == 0)
     {
@@ -63,6 +68,7 @@
 {
   ~destructor ()
   {
+    NS_LOG_FUNCTION (this);
     std::list<std::ostream*> **pstreams = PeekStreamList ();
     delete *pstreams;
     *pstreams = 0;
@@ -73,12 +79,14 @@
 void
 RegisterStream (std::ostream* stream)
 {
+  NS_LOG_FUNCTION (stream);
   GetStreamList ()->push_back (stream);
 }
 
 void
 UnregisterStream (std::ostream* stream)
 {
+  NS_LOG_FUNCTION (stream);
   std::list<std::ostream*> **pl = PeekStreamList ();
   if (*pl == 0)
     {
@@ -98,6 +106,7 @@
  * HandleTerminate function is run. */
 void sigHandler (int sig)
 {
+  NS_LOG_FUNCTION (sig);
   FlushStreams ();
   std::abort ();
 }
@@ -106,6 +115,7 @@
 void 
 FlushStreams (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   std::list<std::ostream*> **pl = PeekStreamList ();
   if (*pl == 0)
     {
--- a/src/core/model/global-value.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/global-value.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -22,6 +22,7 @@
 #include "attribute.h"
 #include "string.h"
 #include "uinteger.h"
+#include "log.h"
 
 #include "ns3/core-config.h"
 #ifdef HAVE_STDLIB_H
@@ -30,6 +31,8 @@
 
 namespace ns3 {
 
+NS_LOG_COMPONENT_DEFINE ("GlobalValue");
+
 GlobalValue::GlobalValue (std::string name, std::string help,
                           const AttributeValue &initialValue,
                           Ptr<const AttributeChecker> checker)
@@ -39,6 +42,7 @@
     m_currentValue (0),
     m_checker (checker)
 {
+  NS_LOG_FUNCTION (name << help << &initialValue << checker);
   if (m_checker == 0)
     {
       NS_FATAL_ERROR ("Checker should not be zero on " << name );
@@ -56,6 +60,7 @@
 void
 GlobalValue::InitializeFromEnv (void)
 {
+  NS_LOG_FUNCTION (this);
 #ifdef HAVE_GETENV
   char *envVar = getenv ("NS_GLOBAL_VALUE");
   if (envVar == 0)
@@ -93,16 +98,19 @@
 std::string 
 GlobalValue::GetName (void) const
 {
+  NS_LOG_FUNCTION_NOARGS ();
   return m_name;
 }
 std::string 
 GlobalValue::GetHelp (void) const
 {
+  NS_LOG_FUNCTION_NOARGS ();
   return m_help;
 }
 void
 GlobalValue::GetValue (AttributeValue &value) const
 {
+  NS_LOG_FUNCTION (&value);
   bool ok = m_checker->Copy (*m_currentValue, value);
   if (ok)
     {
@@ -118,12 +126,16 @@
 Ptr<const AttributeChecker> 
 GlobalValue::GetChecker (void) const
 {
+  NS_LOG_FUNCTION (this);
+
   return m_checker;
 }
 
 bool
 GlobalValue::SetValue (const AttributeValue &value)
 {
+  NS_LOG_FUNCTION (&value);
+
   Ptr<AttributeValue> v = m_checker->CreateValidValue (value);
   if (v == 0)
     {
@@ -136,6 +148,8 @@
 void 
 GlobalValue::Bind (std::string name, const AttributeValue &value)
 {
+  NS_LOG_FUNCTION (name << &value);
+
   for (Iterator i = Begin (); i != End (); i++)
     {
       if ((*i)->GetName () == name)
@@ -152,6 +166,8 @@
 bool 
 GlobalValue::BindFailSafe (std::string name, const AttributeValue &value)
 {
+  NS_LOG_FUNCTION (name << &value);
+
   for (Iterator i = Begin (); i != End (); i++)
     {
       if ((*i)->GetName () == name)
@@ -164,23 +180,28 @@
 GlobalValue::Iterator 
 GlobalValue::Begin (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
+
   return GetVector ()->begin ();
 }
 GlobalValue::Iterator 
 GlobalValue::End (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   return GetVector ()->end ();
 }
 
 void 
 GlobalValue::ResetInitialValue (void)
 {
+  NS_LOG_FUNCTION (this);
   m_currentValue = m_initialValue;
 }
 
 bool
 GlobalValue::GetValueByNameFailSafe (std::string name, AttributeValue &value)
 {
+  NS_LOG_FUNCTION (name << &value);
   for (GlobalValue::Iterator gvit = GlobalValue::Begin (); gvit != GlobalValue::End (); ++gvit)
     {
       if ((*gvit)->GetName () == name)
@@ -195,6 +216,7 @@
 void
 GlobalValue::GetValueByName (std::string name, AttributeValue &value)
 {
+  NS_LOG_FUNCTION (name << &value);
   if (!GetValueByNameFailSafe (name, value))
     {
       NS_FATAL_ERROR ("Could not find GlobalValue named \"" << name << "\"");
@@ -204,6 +226,7 @@
 GlobalValue::Vector *
 GlobalValue::GetVector (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static Vector vector;
   return &vector;
 }
--- a/src/core/model/heap-scheduler.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/heap-scheduler.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -34,6 +34,7 @@
 TypeId
 HeapScheduler::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::HeapScheduler")
     .SetParent<Scheduler> ()
     .AddConstructor<HeapScheduler> ()
@@ -43,6 +44,7 @@
 
 HeapScheduler::HeapScheduler ()
 {
+  NS_LOG_FUNCTION (this);
   // we purposedly waste an item at the start of
   // the array to make sure the indexes in the
   // array start at one.
@@ -52,44 +54,52 @@
 
 HeapScheduler::~HeapScheduler ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 uint32_t
 HeapScheduler::Parent (uint32_t id) const
 {
+  NS_LOG_FUNCTION (this << id);
   return id / 2;
 }
 uint32_t
 HeapScheduler::Sibling (uint32_t id) const
 {
+  NS_LOG_FUNCTION (this << id);
   return id + 1;
 }
 uint32_t
 HeapScheduler::LeftChild (uint32_t id) const
 {
+  NS_LOG_FUNCTION (this << id);
   return id * 2;
 }
 uint32_t
 HeapScheduler::RightChild (uint32_t id) const
 {
+  NS_LOG_FUNCTION (this << id);
   return id * 2 + 1;
 }
 
 uint32_t
 HeapScheduler::Root (void) const
 {
+  NS_LOG_FUNCTION (this);
   return 1;
 }
 
 bool
 HeapScheduler::IsRoot (uint32_t id) const
 {
+  NS_LOG_FUNCTION (this << id);
   return (id == Root ()) ? true : false;
 }
 
 uint32_t
 HeapScheduler::Last (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_heap.size () - 1;
 }
 
@@ -97,12 +107,14 @@
 bool
 HeapScheduler::IsBottom (uint32_t id) const
 {
+  NS_LOG_FUNCTION (this << id);
   return (id >= m_heap.size ()) ? true : false;
 }
 
 void
 HeapScheduler::Exch (uint32_t a, uint32_t b)
 {
+  NS_LOG_FUNCTION (this << a << b);
   NS_ASSERT (b < m_heap.size () && a < m_heap.size ());
   NS_LOG_DEBUG ("Exch " << a << ", " << b);
   Event tmp (m_heap[a]);
@@ -113,24 +125,28 @@
 bool
 HeapScheduler::IsLessStrictly (uint32_t a, uint32_t b) const
 {
+  NS_LOG_FUNCTION (this << a << b);
   return m_heap[a] < m_heap[b];
 }
 
 uint32_t
 HeapScheduler::Smallest (uint32_t a, uint32_t b) const
 {
+  NS_LOG_FUNCTION (this << a << b);
   return IsLessStrictly (a,b) ? a : b;
 }
 
 bool
 HeapScheduler::IsEmpty (void) const
 {
+  NS_LOG_FUNCTION (this);
   return (m_heap.size () == 1) ? true : false;
 }
 
 void
 HeapScheduler::BottomUp (void)
 {
+  NS_LOG_FUNCTION (this);
   uint32_t index = Last ();
   while (!IsRoot (index)
          && IsLessStrictly (index, Parent (index)))
@@ -143,6 +159,7 @@
 void
 HeapScheduler::TopDown (uint32_t start)
 {
+  NS_LOG_FUNCTION (this << start);
   uint32_t index = start;
   uint32_t right = RightChild (index);
   while (!IsBottom (right))
@@ -178,6 +195,7 @@
 void
 HeapScheduler::Insert (const Event &ev)
 {
+  NS_LOG_FUNCTION (this << &ev);
   m_heap.push_back (ev);
   BottomUp ();
 }
@@ -185,11 +203,13 @@
 Scheduler::Event
 HeapScheduler::PeekNext (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_heap[Root ()];
 }
 Scheduler::Event
 HeapScheduler::RemoveNext (void)
 {
+  NS_LOG_FUNCTION (this);
   Event next = m_heap[Root ()];
   Exch (Root (), Last ());
   m_heap.pop_back ();
@@ -201,6 +221,7 @@
 void
 HeapScheduler::Remove (const Event &ev)
 {
+  NS_LOG_FUNCTION (this << &ev);
   uint32_t uid = ev.key.m_uid;
   for (uint32_t i = 1; i < m_heap.size (); i++)
     {
--- a/src/core/model/int64x64-128.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/int64x64-128.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -1,6 +1,9 @@
 #include "int64x64-128.h"
 #include "abort.h"
 #include "assert.h"
+#include "log.h"
+
+NS_LOG_COMPONENT_DEFINE ("int64x64-128");
 
 namespace ns3 {
 
@@ -19,6 +22,7 @@
 void
 int64x64_t::Mul (int64x64_t const &o)
 {
+  NS_LOG_FUNCTION (this << &o);
   bool negResult;
   uint128_t a, b;
   negResult = OUTPUT_SIGN (_v, o._v, a, b);
@@ -31,6 +35,7 @@
 uint128_t
 int64x64_t::Umul (uint128_t a, uint128_t b)
 {
+  NS_LOG_FUNCTION (&a << &b);
   uint128_t aL = a & MASK_LO;
   uint128_t bL = b & MASK_LO;
   uint128_t aH = (a >> 64) & MASK_LO;
@@ -60,6 +65,7 @@
 void
 int64x64_t::Div (int64x64_t const &o)
 {
+  NS_LOG_FUNCTION (this << &o);
   bool negResult;
   uint128_t a, b;
   negResult = OUTPUT_SIGN (_v, o._v, a, b);
@@ -71,6 +77,7 @@
 uint128_t
 int64x64_t::Divu (uint128_t a, uint128_t b)
 {
+  NS_LOG_FUNCTION (&a << &b);
   uint128_t quo = a / b;
   uint128_t rem = (a % b);
   uint128_t result = quo << 64;
@@ -94,6 +101,7 @@
 void 
 int64x64_t::MulByInvert (const int64x64_t &o)
 {
+  NS_LOG_FUNCTION (this << &o);
   bool negResult = _v < 0;
   uint128_t a = negResult ? -_v : _v;
   uint128_t result = UmulByInvert (a, o._v);
@@ -103,6 +111,7 @@
 uint128_t
 int64x64_t::UmulByInvert (uint128_t a, uint128_t b)
 {
+  NS_LOG_FUNCTION (&a << &b);
   uint128_t result, ah, bh, al, bl;
   uint128_t hi, mid;
   ah = a >> 64;
@@ -118,6 +127,7 @@
 int64x64_t 
 int64x64_t::Invert (uint64_t v)
 {
+  NS_LOG_FUNCTION (v);
   NS_ASSERT (v > 1);
   uint128_t a;
   a = 1;
--- a/src/core/model/int64x64-cairo.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/int64x64-cairo.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -21,11 +21,14 @@
 #include "test.h"
 #include "abort.h"
 #include "assert.h"
+#include "log.h"
 #include <cmath>
 #include <iostream>
 
 namespace ns3 {
 
+NS_LOG_COMPONENT_DEFINE ("int64x64-cairo");
+
 #define OUTPUT_SIGN(sa,sb,ua,ub)                                        \
   ({ bool negA, negB;                                                    \
      negA = _cairo_int128_negative (sa);                                   \
@@ -39,6 +42,7 @@
 void
 int64x64_t::Mul (int64x64_t const &o)
 {
+  NS_LOG_FUNCTION (this << &o);
   cairo_uint128_t a, b, result;
   bool sign = OUTPUT_SIGN (_v, o._v, a, b);
   result = Umul (a, b);
@@ -54,6 +58,7 @@
 cairo_uint128_t
 int64x64_t::Umul (cairo_uint128_t a, cairo_uint128_t b)
 {
+  NS_LOG_FUNCTION (&a << &b);
   cairo_uint128_t result;
   cairo_uint128_t hiPart,loPart,midPart;
 
@@ -80,6 +85,7 @@
 void
 int64x64_t::Div (int64x64_t const &o)
 {
+  NS_LOG_FUNCTION (this << &o);
   cairo_uint128_t a, b, result;
   bool sign = OUTPUT_SIGN (_v, o._v, a, b);
   result = Udiv (a, b);
@@ -89,6 +95,7 @@
 cairo_uint128_t
 int64x64_t::Udiv (cairo_uint128_t a, cairo_uint128_t b)
 {
+  NS_LOG_FUNCTION (&a << &b);
   cairo_uquorem128_t qr = _cairo_uint128_divrem (a, b);
   cairo_uint128_t result = _cairo_uint128_lsl (qr.quo, 64);
   // Now, manage the remainder
@@ -113,6 +120,7 @@
 void 
 int64x64_t::MulByInvert (const int64x64_t &o)
 {
+  NS_LOG_FUNCTION (this << &o);
   bool negResult = _cairo_int128_negative (_v);
   cairo_uint128_t a = negResult ? _cairo_int128_negate (_v) : _v;
   cairo_uint128_t result = UmulByInvert (a, o._v);
@@ -122,6 +130,7 @@
 cairo_uint128_t
 int64x64_t::UmulByInvert (cairo_uint128_t a, cairo_uint128_t b)
 {
+  NS_LOG_FUNCTION (&a << &b);
   cairo_uint128_t result;
   cairo_uint128_t hi, mid;
   hi = _cairo_uint64x64_128_mul (a.hi, b.hi);
@@ -135,6 +144,7 @@
 int64x64_t 
 int64x64_t::Invert (uint64_t v)
 {
+  NS_LOG_FUNCTION (v);
   NS_ASSERT (v > 1);
   cairo_uint128_t a, factor;
   a.hi = 1;
--- a/src/core/model/int64x64.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/int64x64.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -3,11 +3,15 @@
 #include <iostream>
 #include <sstream>
 #include "assert.h"
+#include "log.h"
+
+NS_LOG_COMPONENT_DEFINE ("int64x64");
 
 namespace ns3 {
 
 static uint8_t MostSignificantDigit (uint64_t value)
 {
+  NS_LOG_FUNCTION (value);
   uint8_t n = 0;
   do
     {
@@ -19,6 +23,7 @@
 
 static uint64_t PowerOfTen (uint8_t n)
 {
+  NS_LOG_FUNCTION (n);
   uint64_t retval = 1;
   while (n > 0)
     {
@@ -30,6 +35,7 @@
 
 std::ostream &operator << (std::ostream &os, const int64x64_t &value)
 {
+  NS_LOG_FUNCTION (&os << &value);
   int64_t hi = value.GetHigh ();
   os << ((hi<0) ? "-" : "+") << ((hi<0) ? -hi : hi) << ".";
   uint64_t low = value.GetLow ();
@@ -48,6 +54,7 @@
 
 static uint64_t ReadDigits (std::string str)
 {
+  NS_LOG_FUNCTION (str);
   const char *buf = str.c_str ();
   uint64_t retval = 0;
   while (*buf != 0)
@@ -61,6 +68,7 @@
 
 std::istream &operator >> (std::istream &is, int64x64_t &value)
 {
+  NS_LOG_FUNCTION (&is << &value);
   std::string str;
 
   is >> str;
--- a/src/core/model/integer.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/integer.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -19,8 +19,11 @@
  */
 #include "integer.h"
 #include "fatal-error.h"
+#include "log.h"
 #include <sstream>
 
+NS_LOG_COMPONENT_DEFINE ("Integer");
+
 namespace ns3 {
 
 ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME (int64_t, Integer);
@@ -30,6 +33,7 @@
 Ptr<const AttributeChecker>
 MakeIntegerChecker (int64_t min, int64_t max, std::string name)
 {
+  NS_LOG_FUNCTION (min << max << name);
   struct IntegerChecker : public AttributeChecker
   {
     IntegerChecker (int64_t minValue, int64_t maxValue, std::string name)
@@ -37,6 +41,7 @@
         m_maxValue (maxValue),
         m_name (name) {}
     virtual bool Check (const AttributeValue &value) const {
+      NS_LOG_FUNCTION (&value);
       const IntegerValue *v = dynamic_cast<const IntegerValue *> (&value);
       if (v == 0)
         {
@@ -45,20 +50,25 @@
       return v->Get () >= m_minValue && v->Get () <= m_maxValue;
     }
     virtual std::string GetValueTypeName (void) const {
+      NS_LOG_FUNCTION_NOARGS ();
       return "ns3::IntegerValue";
     }
     virtual bool HasUnderlyingTypeInformation (void) const {
+      NS_LOG_FUNCTION_NOARGS ();
       return true;
     }
     virtual std::string GetUnderlyingTypeInformation (void) const {
+      NS_LOG_FUNCTION_NOARGS ();
       std::ostringstream oss;
       oss << m_name << " " << m_minValue << ":" << m_maxValue;
       return oss.str ();
     }
     virtual Ptr<AttributeValue> Create (void) const {
+      NS_LOG_FUNCTION_NOARGS ();
       return ns3::Create<IntegerValue> ();
     }
     virtual bool Copy (const AttributeValue &src, AttributeValue &dst) const {
+      NS_LOG_FUNCTION (&src << &dst);
       const IntegerValue *source = dynamic_cast<const IntegerValue *> (&src);
       IntegerValue *destination = dynamic_cast<IntegerValue *> (&dst);
       if (source == 0 || destination == 0)
--- a/src/core/model/list-scheduler.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/list-scheduler.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -20,10 +20,13 @@
 
 #include "list-scheduler.h"
 #include "event-impl.h"
+#include "log.h"
 #include <utility>
 #include <string>
 #include "assert.h"
 
+NS_LOG_COMPONENT_DEFINE ("ListScheduler");
+
 namespace ns3 {
 
 
@@ -32,6 +35,7 @@
 TypeId
 ListScheduler::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::ListScheduler")
     .SetParent<Scheduler> ()
     .AddConstructor<ListScheduler> ()
@@ -41,6 +45,7 @@
 
 ListScheduler::ListScheduler ()
 {
+  NS_LOG_FUNCTION (this);
 }
 ListScheduler::~ListScheduler ()
 {
@@ -49,6 +54,7 @@
 void
 ListScheduler::Insert (const Event &ev)
 {
+  NS_LOG_FUNCTION (this << &ev);
   for (EventsI i = m_events.begin (); i != m_events.end (); i++)
     {
       if (ev.key < i->key)
@@ -62,17 +68,20 @@
 bool
 ListScheduler::IsEmpty (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_events.empty ();
 }
 Scheduler::Event
 ListScheduler::PeekNext (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_events.front ();
 }
 
 Scheduler::Event
 ListScheduler::RemoveNext (void)
 {
+  NS_LOG_FUNCTION (this);
   Event next = m_events.front ();
   m_events.pop_front ();
   return next;
@@ -81,6 +90,7 @@
 void
 ListScheduler::Remove (const Event &ev)
 {
+  NS_LOG_FUNCTION (this << &ev);
   for (EventsI i = m_events.begin (); i != m_events.end (); i++)
     {
       if (i->key.m_uid == ev.key.m_uid)
--- a/src/core/model/make-event.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/make-event.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -1,9 +1,13 @@
 #include "make-event.h"
+#include "log.h"
+
+NS_LOG_COMPONENT_DEFINE ("MakeEvent");
 
 namespace ns3 {
 
 EventImpl * MakeEvent (void (*f)(void))
 {
+  NS_LOG_FUNCTION (f);
   // zero arg version
   class EventFunctionImpl0 : public EventImpl
   {
--- a/src/core/model/map-scheduler.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/map-scheduler.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -34,6 +34,7 @@
 TypeId
 MapScheduler::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::MapScheduler")
     .SetParent<Scheduler> ()
     .AddConstructor<MapScheduler> ()
@@ -43,9 +44,11 @@
 
 MapScheduler::MapScheduler ()
 {
+  NS_LOG_FUNCTION (this);
 }
 MapScheduler::~MapScheduler ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 void
@@ -60,6 +63,7 @@
 bool
 MapScheduler::IsEmpty (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_list.empty ();
 }
 
--- a/src/core/model/names.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/names.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -51,6 +51,7 @@
 
 NameNode::NameNode (const NameNode &nameNode)
 {
+  NS_LOG_FUNCTION (this << &nameNode);
   m_parent = nameNode.m_parent;
   m_name = nameNode.m_name;
   m_object = nameNode.m_object;
@@ -60,6 +61,7 @@
 NameNode &
 NameNode::operator = (const NameNode &rhs)
 {
+  NS_LOG_FUNCTION (this << &rhs);
   m_parent = rhs.m_parent;
   m_name = rhs.m_name;
   m_object = rhs.m_object;
@@ -70,10 +72,12 @@
 NameNode::NameNode (NameNode *parent, std::string name, Ptr<Object> object)
   : m_parent (parent), m_name (name), m_object (object)
 {
+  NS_LOG_FUNCTION (this << parent << name << object);
 }
 
 NameNode::~NameNode ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 class NamesPriv 
@@ -113,13 +117,14 @@
 NamesPriv *
 NamesPriv::Get (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static NamesPriv namesPriv;
   return &namesPriv;
 }
 
 NamesPriv::NamesPriv ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
 
   m_root.m_parent = 0;
   m_root.m_name = "Names";
@@ -128,7 +133,7 @@
 
 NamesPriv::~NamesPriv ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   Clear ();
   m_root.m_name = "";
 }
@@ -136,6 +141,7 @@
 void
 NamesPriv::Clear (void)
 {
+  NS_LOG_FUNCTION (this);
   //
   // Every name is associated with an object in the object map, so freeing the
   // NameNodes in this map will free all of the memory allocated for the NameNodes
@@ -157,7 +163,7 @@
 bool
 NamesPriv::Add (std::string name, Ptr<Object> object)
 {
-  NS_LOG_FUNCTION (name << object);
+  NS_LOG_FUNCTION (this << name << object);
   //
   // This is the simple, easy to use version of Add, so we want it to be flexible.
   // We don't want to force a user to always type the fully qualified namespace 
@@ -219,6 +225,7 @@
 bool
 NamesPriv::Add (std::string path, std::string name, Ptr<Object> object)
 {
+  NS_LOG_FUNCTION (this << path << name << object);
   if (path == "/Names")
     {
       return Add (Ptr<Object> (0, false), name, object);
@@ -229,7 +236,7 @@
 bool
 NamesPriv::Add (Ptr<Object> context, std::string name, Ptr<Object> object)
 {
-  NS_LOG_FUNCTION (context << name << object);
+  NS_LOG_FUNCTION (this << context << name << object);
 
   if (IsNamed (object))
     {
@@ -264,7 +271,7 @@
 bool
 NamesPriv::Rename (std::string oldpath, std::string newname)
 {
-  NS_LOG_FUNCTION (oldpath << newname);
+  NS_LOG_FUNCTION (this << oldpath << newname);
   //
   // This is the simple, easy to use version of Rename, so we want it to be 
   // flexible.   We don't want to force a user to always type the fully 
@@ -328,6 +335,7 @@
 bool
 NamesPriv::Rename (std::string path, std::string oldname, std::string newname)
 {
+  NS_LOG_FUNCTION (this << path << oldname << newname);
   if (path == "/Names")
     {
       return Rename (Ptr<Object> (0, false), oldname, newname);
@@ -338,7 +346,7 @@
 bool
 NamesPriv::Rename (Ptr<Object> context, std::string oldname, std::string newname)
 {
-  NS_LOG_FUNCTION (context << oldname << newname);
+  NS_LOG_FUNCTION (this << context << oldname << newname);
 
   NameNode *node = 0;
   if (context)
@@ -385,7 +393,7 @@
 std::string
 NamesPriv::FindName (Ptr<Object> object)
 {
-  NS_LOG_FUNCTION (object);
+  NS_LOG_FUNCTION (this << object);
 
   std::map<Ptr<Object>, NameNode *>::iterator i = m_objectMap.find (object);
   if (i == m_objectMap.end ())
@@ -403,7 +411,7 @@
 std::string
 NamesPriv::FindPath (Ptr<Object> object)
 {
-  NS_LOG_FUNCTION (object);
+  NS_LOG_FUNCTION (this << object);
 
   std::map<Ptr<Object>, NameNode *>::iterator i = m_objectMap.find (object);
   if (i == m_objectMap.end ())
@@ -445,6 +453,8 @@
   // just remove that prefix and treat the rest of the string as starting with a 
   // name in the root namespace.
   //
+
+  NS_LOG_FUNCTION (this << path);
   std::string namespaceName = "/Names/";
   std::string remaining;
 
@@ -523,7 +533,7 @@
 Ptr<Object>
 NamesPriv::Find (std::string path, std::string name)
 {
-  NS_LOG_FUNCTION (path << name);
+  NS_LOG_FUNCTION (this << path << name);
 
   if (path == "/Names")
     {
@@ -535,7 +545,7 @@
 Ptr<Object>
 NamesPriv::Find (Ptr<Object> context, std::string name)
 {
-  NS_LOG_FUNCTION (context << name);
+  NS_LOG_FUNCTION (this << context << name);
 
   NameNode *node = 0;
 
@@ -570,7 +580,7 @@
 NameNode *
 NamesPriv::IsNamed (Ptr<Object> object)
 {
-  NS_LOG_FUNCTION (object);
+  NS_LOG_FUNCTION (this << object);
 
   std::map<Ptr<Object>, NameNode *>::iterator i = m_objectMap.find (object);
   if (i == m_objectMap.end ())
@@ -588,7 +598,7 @@
 bool
 NamesPriv::IsDuplicateName (NameNode *node, std::string name)
 {
-  NS_LOG_FUNCTION (node << name);
+  NS_LOG_FUNCTION (this << node << name);
 
   std::map<std::string, NameNode *>::iterator i = node->m_nameMap.find (name);
   if (i == node->m_nameMap.end ())
@@ -606,6 +616,7 @@
 void
 Names::Add (std::string name, Ptr<Object> object)
 {
+  NS_LOG_FUNCTION (name << object);
   bool result = NamesPriv::Get ()->Add (name, object);
   NS_ABORT_MSG_UNLESS (result, "Names::Add(): Error adding name " << name);
 }
@@ -613,6 +624,7 @@
 void
 Names::Rename (std::string oldpath, std::string newname)
 {
+  NS_LOG_FUNCTION (oldpath << newname);
   bool result = NamesPriv::Get ()->Rename (oldpath, newname);
   NS_ABORT_MSG_UNLESS (result, "Names::Rename(): Error renaming " << oldpath << " to " << newname);
 }
@@ -620,6 +632,7 @@
 void
 Names::Add (std::string path, std::string name, Ptr<Object> object)
 {
+  NS_LOG_FUNCTION (path << name << object);
   bool result = NamesPriv::Get ()->Add (path, name, object);
   NS_ABORT_MSG_UNLESS (result, "Names::Add(): Error adding " << path << " " << name);
 }
@@ -627,6 +640,7 @@
 void
 Names::Rename (std::string path, std::string oldname, std::string newname)
 {
+  NS_LOG_FUNCTION (path << oldname << newname);
   bool result = NamesPriv::Get ()->Rename (path, oldname, newname);
   NS_ABORT_MSG_UNLESS (result, "Names::Rename (): Error renaming " << path << " " << oldname << " to " << newname);
 }
@@ -634,6 +648,7 @@
 void
 Names::Add (Ptr<Object> context, std::string name, Ptr<Object> object)
 {
+  NS_LOG_FUNCTION (context << name << object);
   bool result = NamesPriv::Get ()->Add (context, name, object);
   NS_ABORT_MSG_UNLESS (result, "Names::Add(): Error adding name " << name << " under context " << &context);
 }
@@ -641,6 +656,7 @@
 void
 Names::Rename (Ptr<Object> context, std::string oldname, std::string newname)
 {
+  NS_LOG_FUNCTION (context << oldname << newname);
   bool result = NamesPriv::Get ()->Rename (context, oldname, newname);
   NS_ABORT_MSG_UNLESS (result, "Names::Rename (): Error renaming " << oldname << " to " << newname << " under context " <<
                        &context);
@@ -649,36 +665,42 @@
 std::string
 Names::FindName (Ptr<Object> object)
 {
+  NS_LOG_FUNCTION (object);
   return NamesPriv::Get ()->FindName (object);
 }
 
 std::string
 Names::FindPath (Ptr<Object> object)
 {
+  NS_LOG_FUNCTION (object);
   return NamesPriv::Get ()->FindPath (object);
 }
 
 void
 Names::Clear (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   return NamesPriv::Get ()->Clear ();
 }
 
 Ptr<Object>
 Names::FindInternal (std::string name)
 {
+  NS_LOG_FUNCTION (name);
   return NamesPriv::Get ()->Find (name);
 }
 
 Ptr<Object>
 Names::FindInternal (std::string path, std::string name)
 {
+  NS_LOG_FUNCTION (path << name);
   return NamesPriv::Get ()->Find (path, name);
 }
 
 Ptr<Object>
 Names::FindInternal (Ptr<Object> context, std::string name)
 {
+  NS_LOG_FUNCTION (context << name);
   return NamesPriv::Get ()->Find (context, name);
 }
 
--- a/src/core/model/object-base.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/object-base.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -36,6 +36,7 @@
 static TypeId
 GetObjectIid (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   TypeId tid = TypeId ("ns3::ObjectBase");
   tid.SetParent (tid);
   return tid;
@@ -44,22 +45,27 @@
 TypeId 
 ObjectBase::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = GetObjectIid ();
   return tid;
 }
 
 ObjectBase::~ObjectBase () 
 {
+  NS_LOG_FUNCTION (this);
 }
 
 void
 ObjectBase::NotifyConstructionCompleted (void)
-{}
+{
+  NS_LOG_FUNCTION (this);
+}
 
 void
 ObjectBase::ConstructSelf (const AttributeConstructionList &attributes)
 {
   // loop over the inheritance tree back to the Object base class.
+  NS_LOG_FUNCTION (this << &attributes);
   TypeId tid = GetInstanceTypeId ();
   do {
       // loop over all attributes in object type
@@ -140,6 +146,7 @@
                    Ptr<const AttributeChecker> checker,
                    const AttributeValue &value)
 {
+  NS_LOG_FUNCTION (this << accessor << checker << &value);
   Ptr<AttributeValue> v = checker->CreateValidValue (value);
   if (v == 0)
     {
@@ -148,9 +155,11 @@
   bool ok = accessor->Set (this, *v);
   return ok;
 }
+
 void
 ObjectBase::SetAttribute (std::string name, const AttributeValue &value)
 {
+  NS_LOG_FUNCTION (this << name << &value);
   struct TypeId::AttributeInformation info;
   TypeId tid = GetInstanceTypeId ();
   if (!tid.LookupAttributeByName (name, &info))
@@ -170,6 +179,7 @@
 bool 
 ObjectBase::SetAttributeFailSafe (std::string name, const AttributeValue &value)
 {
+  NS_LOG_FUNCTION (this << name << &value);
   struct TypeId::AttributeInformation info;
   TypeId tid = GetInstanceTypeId ();
   if (!tid.LookupAttributeByName (name, &info))
@@ -187,6 +197,7 @@
 void
 ObjectBase::GetAttribute (std::string name, AttributeValue &value) const
 {
+  NS_LOG_FUNCTION (this << name << &value);
   struct TypeId::AttributeInformation info;
   TypeId tid = GetInstanceTypeId ();
   if (!tid.LookupAttributeByName (name, &info))
@@ -221,6 +232,7 @@
 bool
 ObjectBase::GetAttributeFailSafe (std::string name, AttributeValue &value) const
 {
+  NS_LOG_FUNCTION (this << name << &value);
   struct TypeId::AttributeInformation info;
   TypeId tid = GetInstanceTypeId ();
   if (!tid.LookupAttributeByName (name, &info))
@@ -255,6 +267,7 @@
 bool 
 ObjectBase::TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 {
+  NS_LOG_FUNCTION (this << name << &cb);
   TypeId tid = GetInstanceTypeId ();
   Ptr<const TraceSourceAccessor> accessor = tid.LookupTraceSourceByName (name);
   if (accessor == 0)
@@ -267,6 +280,7 @@
 bool 
 ObjectBase::TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 {
+  NS_LOG_FUNCTION (this << name << context << &cb);
   TypeId tid = GetInstanceTypeId ();
   Ptr<const TraceSourceAccessor> accessor = tid.LookupTraceSourceByName (name);
   if (accessor == 0)
@@ -279,6 +293,7 @@
 bool 
 ObjectBase::TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 {
+  NS_LOG_FUNCTION (this << name << &cb);
   TypeId tid = GetInstanceTypeId ();
   Ptr<const TraceSourceAccessor> accessor = tid.LookupTraceSourceByName (name);
   if (accessor == 0)
@@ -291,6 +306,7 @@
 bool 
 ObjectBase::TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 {
+  NS_LOG_FUNCTION (this << name << context << &cb);
   TypeId tid = GetInstanceTypeId ();
   Ptr<const TraceSourceAccessor> accessor = tid.LookupTraceSourceByName (name);
   if (accessor == 0)
--- a/src/core/model/object-factory.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/object-factory.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -27,31 +27,37 @@
 
 ObjectFactory::ObjectFactory ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 ObjectFactory::ObjectFactory (std::string typeId)
 {
+  NS_LOG_FUNCTION (this << typeId);
   SetTypeId (typeId);
 }
 
 void
 ObjectFactory::SetTypeId (TypeId tid)
 {
+  NS_LOG_FUNCTION (this << tid.GetName ());
   m_tid = tid;
 }
 void
 ObjectFactory::SetTypeId (std::string tid)
 {
+  NS_LOG_FUNCTION (this << tid);
   m_tid = TypeId::LookupByName (tid);
 }
 void
 ObjectFactory::SetTypeId (const char *tid)
 {
+  NS_LOG_FUNCTION (this << tid);
   m_tid = TypeId::LookupByName (tid);
 }
 void
 ObjectFactory::Set (std::string name, const AttributeValue &value)
 {
+  NS_LOG_FUNCTION (this << name << &value);
   if (name == "")
     {
       return;
@@ -75,12 +81,14 @@
 TypeId 
 ObjectFactory::GetTypeId (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_tid;
 }
 
 Ptr<Object> 
 ObjectFactory::Create (void) const
 {
+  NS_LOG_FUNCTION (this);
   Callback<ObjectBase *> cb = m_tid.GetConstructor ();
   ObjectBase *base = cb ();
   Object *derived = dynamic_cast<Object *> (base);
@@ -92,6 +100,7 @@
 
 std::ostream & operator << (std::ostream &os, const ObjectFactory &factory)
 {
+  NS_LOG_FUNCTION (&os << &factory);
   os << factory.m_tid.GetName () << "[";
   bool first = true;
   for (AttributeConstructionList::CIterator i = factory.m_parameters.Begin (); i != factory.m_parameters.End (); ++i)
@@ -107,6 +116,7 @@
 }
 std::istream & operator >> (std::istream &is, ObjectFactory &factory)
 {
+  NS_LOG_FUNCTION (&is << &factory);
   std::string v;
   is >> v;
   std::string::size_type lbracket, rbracket;
--- a/src/core/model/object-ptr-container.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/object-ptr-container.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -18,31 +18,39 @@
  * Authors: Mathieu Lacage <mathieu.lacage@gmail.com>
  */
 #include "object-ptr-container.h"
+#include "log.h"
+
+NS_LOG_COMPONENT_DEFINE ("ObjectPtrContainer");
 
 namespace ns3 {
 
 ObjectPtrContainerValue::ObjectPtrContainerValue ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 ObjectPtrContainerValue::Iterator
 ObjectPtrContainerValue::Begin (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_objects.begin ();
 }
 ObjectPtrContainerValue::Iterator
 ObjectPtrContainerValue::End (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_objects.end ();
 }
 uint32_t
 ObjectPtrContainerValue::GetN (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_objects.size ();
 }
 Ptr<Object>
 ObjectPtrContainerValue::Get (uint32_t i) const
 {
+  NS_LOG_FUNCTION (this << i);
   Iterator it = m_objects.find (i); 
   Ptr<Object> value = 0;
   if ( it != m_objects.end () )
@@ -55,11 +63,13 @@
 Ptr<AttributeValue>
 ObjectPtrContainerValue::Copy (void) const
 {
+  NS_LOG_FUNCTION (this);
   return ns3::Create<ObjectPtrContainerValue> (*this);
 }
 std::string 
 ObjectPtrContainerValue::SerializeToString (Ptr<const AttributeChecker> checker) const
 {
+  NS_LOG_FUNCTION (this << checker);
   std::ostringstream oss;
   Iterator it;
   for (it = Begin (); it != End (); ++it)
@@ -75,6 +85,7 @@
 bool 
 ObjectPtrContainerValue::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker)
 {
+  NS_LOG_FUNCTION (this << value << checker);
   NS_FATAL_ERROR ("cannot deserialize a set of object pointers.");
   return true;
 }
@@ -83,11 +94,13 @@
 ObjectPtrContainerAccessor::Set (ObjectBase * object, const AttributeValue & value) const
 {
   // not allowed.
+  NS_LOG_FUNCTION (this << object << &value);
   return false;
 }
 bool 
 ObjectPtrContainerAccessor::Get (const ObjectBase * object, AttributeValue &value) const
 {
+  NS_LOG_FUNCTION (this << object << &value);
   ObjectPtrContainerValue *v = dynamic_cast<ObjectPtrContainerValue *> (&value);
   if (v == 0)
     {
@@ -111,11 +124,13 @@
 bool 
 ObjectPtrContainerAccessor::HasGetter (void) const
 {
+  NS_LOG_FUNCTION (this);
   return true;
 }
 bool 
 ObjectPtrContainerAccessor::HasSetter (void) const
 {
+  NS_LOG_FUNCTION (this);
   return false;
 }
 
--- a/src/core/model/object.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/object.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -47,16 +47,19 @@
   : m_object (0),
     m_current (0)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 bool
 Object::AggregateIterator::HasNext (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_current < m_object->m_aggregates->n;
 }
 Ptr<const Object>
 Object::AggregateIterator::Next (void)
 {
+  NS_LOG_FUNCTION (this);
   Object *object = m_object->m_aggregates->buffer[m_current];
   m_current++;
   return object;
@@ -65,18 +68,21 @@
   : m_object (object),
     m_current (0)
 {
+  NS_LOG_FUNCTION (this << object);
 }
 
 
 TypeId
 Object::GetInstanceTypeId (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_tid;
 }
 
 TypeId
 Object::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::Object")
     .SetParent<ObjectBase> ()
   ;
@@ -91,12 +97,14 @@
     m_aggregates ((struct Aggregates *) std::malloc (sizeof (struct Aggregates))),
     m_getObjectCount (0)
 {
+  NS_LOG_FUNCTION (this);
   m_aggregates->n = 1;
   m_aggregates->buffer[0] = this;
 }
 Object::~Object () 
 {
   // remove this object from the aggregate list
+  NS_LOG_FUNCTION (this);
   uint32_t n = m_aggregates->n;
   for (uint32_t i = 0; i < n; i++)
     {
@@ -124,18 +132,21 @@
     m_aggregates ((struct Aggregates *) std::malloc (sizeof (struct Aggregates))),
     m_getObjectCount (0)
 {
+  NS_LOG_FUNCTION (&o);
   m_aggregates->n = 1;
   m_aggregates->buffer[0] = this;
 }
 void
 Object::Construct (const AttributeConstructionList &attributes)
 {
+  NS_LOG_FUNCTION (this << &attributes);
   ConstructSelf (attributes);
 }
 
 Ptr<Object>
 Object::DoGetObject (TypeId tid) const
 {
+  NS_LOG_FUNCTION (this << tid);
   NS_ASSERT (CheckLoose ());
 
   uint32_t n = m_aggregates->n;
@@ -177,6 +188,7 @@
    * object at the end of the array. To be safe, we restart iteration over the 
    * array whenever we call some user code, just in case.
    */
+  NS_LOG_FUNCTION (this);
 restart:
   uint32_t n = m_aggregates->n;
   for (uint32_t i = 0; i < n; i++)
@@ -201,6 +213,7 @@
    * So, to be safe, we restart the iteration over the array whenever we call some
    * user code.
    */
+  NS_LOG_FUNCTION (this);
 restart:
   uint32_t n = m_aggregates->n;
   for (uint32_t i = 0; i < n; i++)
@@ -217,6 +230,7 @@
 void
 Object::UpdateSortedArray (struct Aggregates *aggregates, uint32_t j) const
 {
+  NS_LOG_FUNCTION (this << aggregates << j);
   while (j > 0 && 
          aggregates->buffer[j]->m_getObjectCount > aggregates->buffer[j-1]->m_getObjectCount)
     {
@@ -229,6 +243,7 @@
 void 
 Object::AggregateObject (Ptr<Object> o)
 {
+  NS_LOG_FUNCTION (this << o);
   NS_ASSERT (!m_disposed);
   NS_ASSERT (!o->m_disposed);
   NS_ASSERT (CheckLoose ());
@@ -300,18 +315,20 @@
 void
 Object::NotifyNewAggregate ()
 {
-
+  NS_LOG_FUNCTION (this);
 }
 
 Object::AggregateIterator 
 Object::GetAggregateIterator (void) const
 {
+  NS_LOG_FUNCTION (this);
   return AggregateIterator (this);
 }
 
 void 
 Object::SetTypeId (TypeId tid)
 {
+  NS_LOG_FUNCTION (this << tid);
   NS_ASSERT (Check ());
   m_tid = tid;
 }
@@ -319,18 +336,21 @@
 void
 Object::DoDispose (void)
 {
+  NS_LOG_FUNCTION (this);
   NS_ASSERT (!m_disposed);
 }
 
 void
 Object::DoStart (void)
 {
+  NS_LOG_FUNCTION (this);
   NS_ASSERT (!m_started);
 }
 
 bool 
 Object::Check (void) const
 {
+  NS_LOG_FUNCTION (this);
   return (GetReferenceCount () > 0);
 }
 
@@ -344,6 +364,7 @@
 bool 
 Object::CheckLoose (void) const
 {
+  NS_LOG_FUNCTION (this);
   uint32_t refcount = 0;
   uint32_t n = m_aggregates->n;
   for (uint32_t i = 0; i < n; i++)
@@ -357,6 +378,7 @@
 Object::DoDelete (void)
 {
   // check if we really need to die
+  NS_LOG_FUNCTION (this);
   for (uint32_t i = 0; i < m_aggregates->n; i++)
     {
       Object *current = m_aggregates->buffer[i];
--- a/src/core/model/pointer.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/pointer.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -19,40 +19,49 @@
  */
 #include "pointer.h"
 #include "object-factory.h"
+#include "log.h"
 #include <sstream>
 
+NS_LOG_COMPONENT_DEFINE ("Pointer");
+
 namespace ns3 {
 
 PointerValue::PointerValue ()
   : m_value ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 PointerValue::PointerValue (Ptr<Object> object)
   : m_value (object)
 {
+  NS_LOG_FUNCTION (object);
 }
 
 void
 PointerValue::SetObject (Ptr<Object> object)
 {
+  NS_LOG_FUNCTION (object);
   m_value = object;
 }
 
 Ptr<Object>
 PointerValue::GetObject (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_value;
 }
 
 Ptr<AttributeValue>
 PointerValue::Copy (void) const
 {
+  NS_LOG_FUNCTION (this);
   return Create<PointerValue> (*this);
 }
 std::string
 PointerValue::SerializeToString (Ptr<const AttributeChecker> checker) const
 {
+  NS_LOG_FUNCTION (this << checker);
   std::ostringstream oss;
   oss << m_value;
   return oss.str ();
@@ -64,6 +73,7 @@
   // We assume that the string you want to deserialize contains
   // a description for an ObjectFactory to create an object and then assign it to the
   // member variable.
+  NS_LOG_FUNCTION (this << value << checker);
   ObjectFactory factory;
   std::istringstream iss;
   iss.str(value);
--- a/src/core/model/random-variable-stream-helper.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/random-variable-stream-helper.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -29,6 +29,7 @@
 
 int64_t RandomVariableStreamHelper::AssignStreams (std::string path, int64_t stream)
 {
+  NS_LOG_FUNCTION (this << path << stream);
   NS_ASSERT (stream >= 0);
   Config::MatchContainer mc = Config::LookupMatches (path);
   int64_t i = 0;
--- a/src/core/model/random-variable-stream.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/random-variable-stream.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -45,6 +45,7 @@
 TypeId 
 RandomVariableStream::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::RandomVariableStream")
     .SetParent<Object> ()
     .AddAttribute("Stream",
@@ -66,20 +67,25 @@
 
 RandomVariableStream::RandomVariableStream()
   : m_rng (0)
-{}
+{
+  NS_LOG_FUNCTION (this);
+}
 RandomVariableStream::~RandomVariableStream()
 {
+  NS_LOG_FUNCTION (this);
   delete m_rng;
 }
 
 void
 RandomVariableStream::SetAntithetic(bool isAntithetic)
 {
+  NS_LOG_FUNCTION (this << isAntithetic);
   m_isAntithetic = isAntithetic;
 }
 bool
 RandomVariableStream::IsAntithetic(void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_isAntithetic;
 }
 void
@@ -114,12 +120,14 @@
 int64_t
 RandomVariableStream::GetStream(void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_stream;
 }
 
 RngStream *
 RandomVariableStream::Peek(void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_rng;
 }
 
@@ -128,6 +136,7 @@
 TypeId 
 UniformRandomVariable::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::UniformRandomVariable")
     .SetParent<RandomVariableStream>()
     .AddConstructor<UniformRandomVariable> ()
@@ -145,22 +154,26 @@
 UniformRandomVariable::UniformRandomVariable ()
 {
   // m_min and m_max are initialized after constructor by attributes
+  NS_LOG_FUNCTION (this);
 }
 
 double 
 UniformRandomVariable::GetMin (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_min;
 }
 double 
 UniformRandomVariable::GetMax (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_max;
 }
 
 double 
 UniformRandomVariable::GetValue (double min, double max)
 {
+  NS_LOG_FUNCTION (this << min << max);
   double v = min + Peek ()->RandU01 () * (max - min);
   if (IsAntithetic ())
     {
@@ -171,6 +184,7 @@
 uint32_t 
 UniformRandomVariable::GetInteger (uint32_t min, uint32_t max)
 {
+  NS_LOG_FUNCTION (this << min << max);
   NS_ASSERT (min <= max);
   return static_cast<uint32_t> ( GetValue (min, max + 1) );
 }
@@ -178,11 +192,13 @@
 double 
 UniformRandomVariable::GetValue (void)
 {
+  NS_LOG_FUNCTION (this);
   return GetValue (m_min, m_max);
 }
 uint32_t 
 UniformRandomVariable::GetInteger (void)
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)GetValue (m_min, m_max + 1);
 }
 
@@ -191,6 +207,7 @@
 TypeId 
 ConstantRandomVariable::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::ConstantRandomVariable")
     .SetParent<RandomVariableStream>()
     .AddConstructor<ConstantRandomVariable> ()
@@ -204,33 +221,39 @@
 ConstantRandomVariable::ConstantRandomVariable ()
 {
   // m_constant is initialized after constructor by attributes
+  NS_LOG_FUNCTION (this);
 }
 
 double 
 ConstantRandomVariable::GetConstant (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_constant;
 }
 
 double 
 ConstantRandomVariable::GetValue (double constant)
 {
+  NS_LOG_FUNCTION (this << constant);
   return constant;
 }
 uint32_t 
 ConstantRandomVariable::GetInteger (uint32_t constant)
 {
+  NS_LOG_FUNCTION (this << constant);
   return constant;
 }
 
 double 
 ConstantRandomVariable::GetValue (void)
 {
+  NS_LOG_FUNCTION (this);
   return GetValue (m_constant);
 }
 uint32_t 
 ConstantRandomVariable::GetInteger (void)
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)GetValue (m_constant);
 }
 
@@ -239,6 +262,7 @@
 TypeId 
 SequentialRandomVariable::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::SequentialRandomVariable")
     .SetParent<RandomVariableStream>()
     .AddConstructor<SequentialRandomVariable> ()
@@ -269,29 +293,34 @@
 {
   // m_min, m_max, m_increment, and m_consecutive are initialized
   // after constructor by attributes.
+  NS_LOG_FUNCTION (this);
 }
 
 double 
 SequentialRandomVariable::GetMin (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_min;
 }
 
 double 
 SequentialRandomVariable::GetMax (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_max;
 }
 
 Ptr<RandomVariableStream> 
 SequentialRandomVariable::GetIncrement (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_increment;
 }
 
 uint32_t 
 SequentialRandomVariable::GetConsecutive (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_consecutive;
 }
 
@@ -299,6 +328,7 @@
 SequentialRandomVariable::GetValue (void)
 {
   // Set the current sequence value if it hasn't been set.
+  NS_LOG_FUNCTION (this);
   if (!m_isCurrentSet)
     {
       // Start the sequence at its minimium value.
@@ -323,6 +353,7 @@
 uint32_t 
 SequentialRandomVariable::GetInteger (void)
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)GetValue ();
 }
 
@@ -331,6 +362,7 @@
 TypeId 
 ExponentialRandomVariable::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::ExponentialRandomVariable")
     .SetParent<RandomVariableStream>()
     .AddConstructor<ExponentialRandomVariable> ()
@@ -348,22 +380,26 @@
 ExponentialRandomVariable::ExponentialRandomVariable ()
 {
   // m_mean and m_bound are initialized after constructor by attributes
+  NS_LOG_FUNCTION (this);
 }
 
 double 
 ExponentialRandomVariable::GetMean (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_mean;
 }
 double 
 ExponentialRandomVariable::GetBound (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_bound;
 }
 
 double 
 ExponentialRandomVariable::GetValue (double mean, double bound)
 {
+  NS_LOG_FUNCTION (this << mean << bound);
   while (1)
     {
       // Get a uniform random variable in [0,1].
@@ -386,17 +422,20 @@
 uint32_t 
 ExponentialRandomVariable::GetInteger (uint32_t mean, uint32_t bound)
 {
+  NS_LOG_FUNCTION (this << mean << bound);
   return static_cast<uint32_t> ( GetValue (mean, bound) );
 }
 
 double 
 ExponentialRandomVariable::GetValue (void)
 {
+  NS_LOG_FUNCTION (this);
   return GetValue (m_mean, m_bound);
 }
 uint32_t 
 ExponentialRandomVariable::GetInteger (void)
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)GetValue (m_mean, m_bound);
 }
 
@@ -405,6 +444,7 @@
 TypeId 
 ParetoRandomVariable::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::ParetoRandomVariable")
     .SetParent<RandomVariableStream>()
     .AddConstructor<ParetoRandomVariable> ()
@@ -427,21 +467,25 @@
 {
   // m_mean, m_shape, and m_bound are initialized after constructor
   // by attributes
+  NS_LOG_FUNCTION (this);
 }
 
 double 
 ParetoRandomVariable::GetMean (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_mean;
 }
 double 
 ParetoRandomVariable::GetShape (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_shape;
 }
 double 
 ParetoRandomVariable::GetBound (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_bound;
 }
 
@@ -449,6 +493,7 @@
 ParetoRandomVariable::GetValue (double mean, double shape, double bound)
 {
   // Calculate the scale parameter.
+  NS_LOG_FUNCTION (this << mean << shape << bound);
   double scale = mean * (shape - 1.0) / shape;
 
   while (1)
@@ -473,17 +518,20 @@
 uint32_t 
 ParetoRandomVariable::GetInteger (uint32_t mean, uint32_t shape, uint32_t bound)
 {
+  NS_LOG_FUNCTION (this << mean << shape << bound);
   return static_cast<uint32_t> ( GetValue (mean, shape, bound) );
 }
 
 double 
 ParetoRandomVariable::GetValue (void)
 {
+  NS_LOG_FUNCTION (this);
   return GetValue (m_mean, m_shape, m_bound);
 }
 uint32_t 
 ParetoRandomVariable::GetInteger (void)
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)GetValue (m_mean, m_shape, m_bound);
 }
 
@@ -492,6 +540,7 @@
 TypeId 
 WeibullRandomVariable::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::WeibullRandomVariable")
     .SetParent<RandomVariableStream>()
     .AddConstructor<WeibullRandomVariable> ()
@@ -514,27 +563,32 @@
 {
   // m_scale, m_shape, and m_bound are initialized after constructor
   // by attributes
+  NS_LOG_FUNCTION (this);
 }
 
 double 
 WeibullRandomVariable::GetScale (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_scale;
 }
 double 
 WeibullRandomVariable::GetShape (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_shape;
 }
 double 
 WeibullRandomVariable::GetBound (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_bound;
 }
 
 double 
 WeibullRandomVariable::GetValue (double scale, double shape, double bound)
 {
+  NS_LOG_FUNCTION (this << scale << shape << bound);
   double exponent = 1.0 / shape;
   while (1)
     {
@@ -558,17 +612,20 @@
 uint32_t 
 WeibullRandomVariable::GetInteger (uint32_t scale, uint32_t shape, uint32_t bound)
 {
+  NS_LOG_FUNCTION (this << scale << shape << bound);
   return static_cast<uint32_t> ( GetValue (scale, shape, bound) );
 }
 
 double 
 WeibullRandomVariable::GetValue (void)
 {
+  NS_LOG_FUNCTION (this);
   return GetValue (m_scale, m_shape, m_bound);
 }
 uint32_t 
 WeibullRandomVariable::GetInteger (void)
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)GetValue (m_scale, m_shape, m_bound);
 }
 
@@ -579,6 +636,7 @@
 TypeId 
 NormalRandomVariable::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::NormalRandomVariable")
     .SetParent<RandomVariableStream>()
     .AddConstructor<NormalRandomVariable> ()
@@ -603,27 +661,32 @@
 {
   // m_mean, m_variance, and m_bound are initialized after constructor
   // by attributes
+  NS_LOG_FUNCTION (this);
 }
 
 double 
 NormalRandomVariable::GetMean (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_mean;
 }
 double 
 NormalRandomVariable::GetVariance (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_variance;
 }
 double 
 NormalRandomVariable::GetBound (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_bound;
 }
 
 double 
 NormalRandomVariable::GetValue (double mean, double variance, double bound)
 {
+  NS_LOG_FUNCTION (this << mean << variance << bound);
   if (m_nextValid)
     { // use previously generated
       m_nextValid = false;
@@ -669,17 +732,20 @@
 uint32_t 
 NormalRandomVariable::GetInteger (uint32_t mean, uint32_t variance, uint32_t bound)
 {
+  NS_LOG_FUNCTION (this << mean << variance << bound);
   return static_cast<uint32_t> ( GetValue (mean, variance, bound) );
 }
 
 double 
 NormalRandomVariable::GetValue (void)
 {
+  NS_LOG_FUNCTION (this);
   return GetValue (m_mean, m_variance, m_bound);
 }
 uint32_t 
 NormalRandomVariable::GetInteger (void)
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)GetValue (m_mean, m_variance, m_bound);
 }
 
@@ -688,6 +754,7 @@
 TypeId 
 LogNormalRandomVariable::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::LogNormalRandomVariable")
     .SetParent<RandomVariableStream>()
     .AddConstructor<LogNormalRandomVariable> ()
@@ -706,16 +773,19 @@
 {
   // m_mu and m_sigma are initialized after constructor by
   // attributes
+  NS_LOG_FUNCTION (this);
 }
 
 double 
 LogNormalRandomVariable::GetMu (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_mu;
 }
 double 
 LogNormalRandomVariable::GetSigma (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_sigma;
 }
 
@@ -750,6 +820,8 @@
 {
   double v1, v2, r2, normal, x;
 
+  NS_LOG_FUNCTION (this << mu << sigma);
+
   do
     {
       /* choose x,y in uniform square (-1,-1) to (+1,+1) */
@@ -780,17 +852,20 @@
 uint32_t 
 LogNormalRandomVariable::GetInteger (uint32_t mu, uint32_t sigma)
 {
+  NS_LOG_FUNCTION (this << mu << sigma);
   return static_cast<uint32_t> ( GetValue (mu, sigma));
 }
 
 double 
 LogNormalRandomVariable::GetValue (void)
 {
+  NS_LOG_FUNCTION (this);
   return GetValue (m_mu, m_sigma);
 }
 uint32_t 
 LogNormalRandomVariable::GetInteger (void)
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)GetValue (m_mu, m_sigma);
 }
 
@@ -799,6 +874,7 @@
 TypeId 
 GammaRandomVariable::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::GammaRandomVariable")
     .SetParent<RandomVariableStream>()
     .AddConstructor<GammaRandomVariable> ()
@@ -819,16 +895,19 @@
 {
   // m_alpha and m_beta are initialized after constructor by
   // attributes
+  NS_LOG_FUNCTION (this);
 }
 
 double 
 GammaRandomVariable::GetAlpha (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_alpha;
 }
 double 
 GammaRandomVariable::GetBeta (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_beta;
 }
 
@@ -851,6 +930,7 @@
 double 
 GammaRandomVariable::GetValue (double alpha, double beta)
 {
+  NS_LOG_FUNCTION (this << alpha << beta);
   if (alpha < 1)
     {
       double u = Peek ()->RandU01 ();
@@ -902,23 +982,27 @@
 uint32_t 
 GammaRandomVariable::GetInteger (uint32_t alpha, uint32_t beta)
 {
+  NS_LOG_FUNCTION (this << alpha << beta);
   return static_cast<uint32_t> ( GetValue (alpha, beta));
 }
 
 double 
 GammaRandomVariable::GetValue (void)
 {
+  NS_LOG_FUNCTION (this);
   return GetValue (m_alpha, m_beta);
 }
 uint32_t 
 GammaRandomVariable::GetInteger (void)
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)GetValue (m_alpha, m_beta);
 }
 
 double 
 GammaRandomVariable::GetNormalValue (double mean, double variance, double bound)
 {
+  NS_LOG_FUNCTION (this << mean << variance << bound);
   if (m_nextValid)
     { // use previously generated
       m_nextValid = false;
@@ -966,6 +1050,7 @@
 TypeId 
 ErlangRandomVariable::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::ErlangRandomVariable")
     .SetParent<RandomVariableStream>()
     .AddConstructor<ErlangRandomVariable> ()
@@ -983,16 +1068,19 @@
 ErlangRandomVariable::ErlangRandomVariable ()
 {
   // m_k and m_lambda are initialized after constructor by attributes
+  NS_LOG_FUNCTION (this);
 }
 
 uint32_t 
 ErlangRandomVariable::GetK (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_k;
 }
 double 
 ErlangRandomVariable::GetLambda (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_lambda;
 }
 
@@ -1011,6 +1099,7 @@
 double 
 ErlangRandomVariable::GetValue (uint32_t k, double lambda)
 {
+  NS_LOG_FUNCTION (this << k << lambda);
   double mean = lambda;
   double bound = 0.0;
 
@@ -1027,23 +1116,27 @@
 uint32_t 
 ErlangRandomVariable::GetInteger (uint32_t k, uint32_t lambda)
 {
+  NS_LOG_FUNCTION (this << k << lambda);
   return static_cast<uint32_t> ( GetValue (k, lambda));
 }
 
 double 
 ErlangRandomVariable::GetValue (void)
 {
+  NS_LOG_FUNCTION (this);
   return GetValue (m_k, m_lambda);
 }
 uint32_t 
 ErlangRandomVariable::GetInteger (void)
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)GetValue (m_k, m_lambda);
 }
 
 double 
 ErlangRandomVariable::GetExponentialValue (double mean, double bound)
 {
+  NS_LOG_FUNCTION (this << mean << bound);
   while (1)
     {
       // Get a uniform random variable in [0,1].
@@ -1069,6 +1162,7 @@
 TypeId 
 TriangularRandomVariable::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::TriangularRandomVariable")
     .SetParent<RandomVariableStream>()
     .AddConstructor<TriangularRandomVariable> ()
@@ -1093,21 +1187,25 @@
 {
   // m_mean, m_min, and m_max are initialized after constructor by
   // attributes
+  NS_LOG_FUNCTION (this);
 }
 
 double 
 TriangularRandomVariable::GetMean (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_mean;
 }
 double 
 TriangularRandomVariable::GetMin (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_min;
 }
 double 
 TriangularRandomVariable::GetMax (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_max;
 }
 
@@ -1115,6 +1213,7 @@
 TriangularRandomVariable::GetValue (double mean, double min, double max)
 {
   // Calculate the mode.
+  NS_LOG_FUNCTION (this << mean << min << max);
   double mode = 3.0 * mean - min - max;
 
   // Get a uniform random variable in [0,1].
@@ -1138,17 +1237,20 @@
 uint32_t 
 TriangularRandomVariable::GetInteger (uint32_t mean, uint32_t min, uint32_t max)
 {
+  NS_LOG_FUNCTION (this << mean << min << max);
   return static_cast<uint32_t> ( GetValue (mean, min, max) );
 }
 
 double 
 TriangularRandomVariable::GetValue (void)
 {
+  NS_LOG_FUNCTION (this);
   return GetValue (m_mean, m_min, m_max);
 }
 uint32_t 
 TriangularRandomVariable::GetInteger (void)
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)GetValue (m_mean, m_min, m_max);
 }
 
@@ -1157,6 +1259,7 @@
 TypeId 
 ZipfRandomVariable::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::ZipfRandomVariable")
     .SetParent<RandomVariableStream>()
     .AddConstructor<ZipfRandomVariable> ()
@@ -1174,22 +1277,26 @@
 ZipfRandomVariable::ZipfRandomVariable ()
 {
   // m_n and m_alpha are initialized after constructor by attributes
+  NS_LOG_FUNCTION (this);
 }
 
 uint32_t 
 ZipfRandomVariable::GetN (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_n;
 }
 double 
 ZipfRandomVariable::GetAlpha (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_alpha;
 }
 
 double 
 ZipfRandomVariable::GetValue (uint32_t n, double alpha)
 {
+  NS_LOG_FUNCTION (this << n << alpha);
   // Calculate the normalization constant c.
   m_c = 0.0;
   for (uint32_t i = 1; i <= n; i++)
@@ -1221,17 +1328,20 @@
 uint32_t 
 ZipfRandomVariable::GetInteger (uint32_t n, uint32_t alpha)
 {
+  NS_LOG_FUNCTION (this << n << alpha);
   return static_cast<uint32_t> ( GetValue (n, alpha));
 }
 
 double 
 ZipfRandomVariable::GetValue (void)
 {
+  NS_LOG_FUNCTION (this);
   return GetValue (m_n, m_alpha);
 }
 uint32_t 
 ZipfRandomVariable::GetInteger (void)
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)GetValue (m_n, m_alpha);
 }
 
@@ -1240,6 +1350,7 @@
 TypeId 
 ZetaRandomVariable::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::ZetaRandomVariable")
     .SetParent<RandomVariableStream>()
     .AddConstructor<ZetaRandomVariable> ()
@@ -1253,17 +1364,20 @@
 ZetaRandomVariable::ZetaRandomVariable ()
 {
   // m_alpha is initialized after constructor by attributes
+  NS_LOG_FUNCTION (this);
 }
 
 double 
 ZetaRandomVariable::GetAlpha (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_alpha;
 }
 
 double 
 ZetaRandomVariable::GetValue (double alpha)
 {
+  NS_LOG_FUNCTION (this << alpha);
   m_b = std::pow (2.0, alpha - 1.0);
 
   double u, v;
@@ -1298,17 +1412,20 @@
 uint32_t 
 ZetaRandomVariable::GetInteger (uint32_t alpha)
 {
+  NS_LOG_FUNCTION (this << alpha);
   return static_cast<uint32_t> ( GetValue (alpha));
 }
 
 double 
 ZetaRandomVariable::GetValue (void)
 {
+  NS_LOG_FUNCTION (this);
   return GetValue (m_alpha);
 }
 uint32_t 
 ZetaRandomVariable::GetInteger (void)
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)GetValue (m_alpha);
 }
 
@@ -1317,6 +1434,7 @@
 TypeId 
 DeterministicRandomVariable::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::DeterministicRandomVariable")
     .SetParent<RandomVariableStream>()
     .AddConstructor<DeterministicRandomVariable> ()
@@ -1329,10 +1447,12 @@
   m_next (0),
   m_data (0)
 {
+  NS_LOG_FUNCTION (this);
 }
 DeterministicRandomVariable::~DeterministicRandomVariable ()
 {
   // Delete any values currently set.
+  NS_LOG_FUNCTION (this);
   if (m_data != 0)
   {
     delete[] m_data;
@@ -1342,6 +1462,7 @@
 void
 DeterministicRandomVariable::SetValueArray (double* values, uint64_t length)
 {
+  NS_LOG_FUNCTION (this << values << length);
   // Delete any values currently set.
   if (m_data != 0)
   {
@@ -1363,6 +1484,7 @@
 double 
 DeterministicRandomVariable::GetValue (void)
 {
+  NS_LOG_FUNCTION (this);
   // Make sure the array has been set.
   NS_ASSERT (m_count > 0);
 
@@ -1376,6 +1498,7 @@
 uint32_t 
 DeterministicRandomVariable::GetInteger (void)
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)GetValue ();
 }
 
@@ -1386,21 +1509,25 @@
   : value (0.0),
     cdf (0.0)
 {
+  NS_LOG_FUNCTION (this);
 }
 EmpiricalRandomVariable::ValueCDF::ValueCDF (double v, double c)
   : value (v),
     cdf (c)
 {
+  NS_LOG_FUNCTION (this << v << c);
 }
 EmpiricalRandomVariable::ValueCDF::ValueCDF (const ValueCDF& c)
   : value (c.value),
     cdf (c.cdf)
 {
+  NS_LOG_FUNCTION (this << &c);
 }
 
 TypeId 
 EmpiricalRandomVariable::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::EmpiricalRandomVariable")
     .SetParent<RandomVariableStream>()
     .AddConstructor<EmpiricalRandomVariable> ()
@@ -1411,11 +1538,13 @@
   :
   validated (false)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 double 
 EmpiricalRandomVariable::GetValue (void)
 {
+  NS_LOG_FUNCTION (this);
   // Return a value from the empirical distribution
   // This code based (loosely) on code by Bruce Mah (Thanks Bruce!)
   if (emp.size () == 0)
@@ -1469,17 +1598,20 @@
 uint32_t 
 EmpiricalRandomVariable::GetInteger (void)
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)GetValue ();
 }
 
 void EmpiricalRandomVariable::CDF (double v, double c)
 { // Add a new empirical datapoint to the empirical cdf
   // NOTE.   These MUST be inserted in non-decreasing order
+  NS_LOG_FUNCTION (this << v << c);
   emp.push_back (ValueCDF (v, c));
 }
 
 void EmpiricalRandomVariable::Validate ()
 {
+  NS_LOG_FUNCTION (this);
   ValueCDF prior;
   for (std::vector<ValueCDF>::size_type i = 0; i < emp.size (); ++i)
     {
@@ -1501,6 +1633,7 @@
 double EmpiricalRandomVariable::Interpolate (double c1, double c2,
                                            double v1, double v2, double r)
 { // Interpolate random value in range [v1..v2) based on [c1 .. r .. c2)
+  NS_LOG_FUNCTION (this << c1 << c2 << v1 << v2 << r);
   return (v1 + ((v2 - v1) / (c2 - c1)) * (r - c1));
 }
 
--- a/src/core/model/random-variable.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/random-variable.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -36,7 +36,7 @@
 #include "rng-seed-manager.h"
 #include "rng-stream.h"
 #include "fatal-error.h"
-
+#include "log.h"
 
 namespace ns3 {
 
@@ -44,6 +44,7 @@
 // -----------------------------------------------------------------------------
 // RandomVariableBase methods
 
+NS_LOG_COMPONENT_DEFINE ("RandomVariable");
 
 class RandomVariableBase
 {
@@ -62,11 +63,13 @@
 RandomVariableBase::RandomVariableBase ()
   : m_generator (0)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 RandomVariableBase::RandomVariableBase (const RandomVariableBase& r)
   : m_generator (0)
 {
+  NS_LOG_FUNCTION (this << &r);
   if (r.m_generator != 0)
     {
       m_generator = new RngStream (RngSeedManager::GetSeed (),
@@ -77,17 +80,20 @@
 
 RandomVariableBase::~RandomVariableBase ()
 {
+  NS_LOG_FUNCTION (this);
   delete m_generator;
 }
 
 uint32_t RandomVariableBase::GetInteger ()
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)GetValue ();
 }
 
 RngStream *
 RandomVariableBase::GetStream (void)
 {
+  NS_LOG_FUNCTION (this);
   if (m_generator == 0)
     {
       m_generator = new RngStream (RngSeedManager::GetSeed (),
@@ -102,18 +108,22 @@
 RandomVariable::RandomVariable ()
   : m_variable (0)
 {
+  NS_LOG_FUNCTION (this);
 }
 RandomVariable::RandomVariable (const RandomVariable&o)
   : m_variable (o.m_variable->Copy ())
 {
+  NS_LOG_FUNCTION (this << o);
 }
 RandomVariable::RandomVariable (const RandomVariableBase &variable)
   : m_variable (variable.Copy ())
 {
+  NS_LOG_FUNCTION (&variable);
 }
 RandomVariable &
 RandomVariable::operator = (const RandomVariable &o)
 {
+  NS_LOG_FUNCTION (this << o);
   if (&o == this)
     {
       return *this;
@@ -124,23 +134,27 @@
 }
 RandomVariable::~RandomVariable ()
 {
+  NS_LOG_FUNCTION (this);
   delete m_variable;
 }
 double
 RandomVariable::GetValue (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_variable->GetValue ();
 }
 
 uint32_t
 RandomVariable::GetInteger (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_variable->GetInteger ();
 }
 
 RandomVariableBase *
 RandomVariable::Peek (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_variable;
 }
 
@@ -194,12 +208,14 @@
   : m_min (0),
     m_max (1.0)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 UniformVariableImpl::UniformVariableImpl (double s, double l)
   : m_min (s),
     m_max (l)
 {
+  NS_LOG_FUNCTION (this << s << l);
 }
 
 UniformVariableImpl::UniformVariableImpl (const UniformVariableImpl& c)
@@ -207,58 +223,69 @@
     m_min (c.m_min),
     m_max (c.m_max)
 {
+  NS_LOG_FUNCTION (this << &c);
 }
 
 double
 UniformVariableImpl::GetMin (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_min;
 }
 double
 UniformVariableImpl::GetMax (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_max;
 }
 
 
 double UniformVariableImpl::GetValue ()
 {
+  NS_LOG_FUNCTION (this);
   RngStream *generator = GetStream ();
   return m_min + generator->RandU01 () * (m_max - m_min);
 }
 
 double UniformVariableImpl::GetValue (double s, double l)
 {
+  NS_LOG_FUNCTION (this << s << l);
   RngStream *generator = GetStream ();
   return s + generator->RandU01 () * (l - s);
 }
 
 RandomVariableBase* UniformVariableImpl::Copy () const
 {
+  NS_LOG_FUNCTION (this);
   return new UniformVariableImpl (*this);
 }
 
 UniformVariable::UniformVariable ()
   : RandomVariable (UniformVariableImpl ())
 {
+  NS_LOG_FUNCTION (this);
 }
 UniformVariable::UniformVariable (double s, double l)
   : RandomVariable (UniformVariableImpl (s, l))
 {
+  NS_LOG_FUNCTION (this << s << l);
 }
 
 double UniformVariable::GetValue (void) const
 {
+  NS_LOG_FUNCTION (this);
   return this->RandomVariable::GetValue ();
 }
 
 double UniformVariable::GetValue (double s, double l)
 {
+  NS_LOG_FUNCTION (this << s << l);
   return ((UniformVariableImpl*)Peek ())->GetValue (s,l);
 }
 
 uint32_t UniformVariable::GetInteger (uint32_t s, uint32_t l)
 {
+  NS_LOG_FUNCTION (this << s << l);
   NS_ASSERT (s <= l);
   return static_cast<uint32_t> ( GetValue (s, l + 1) );
 }
@@ -305,50 +332,60 @@
 ConstantVariableImpl::ConstantVariableImpl ()
   : m_const (0)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 ConstantVariableImpl::ConstantVariableImpl (double c)
   : m_const (c)
 {
+  NS_LOG_FUNCTION (this << c);
 }
 
 ConstantVariableImpl::ConstantVariableImpl (const ConstantVariableImpl& c)
   : RandomVariableBase (c),
     m_const (c.m_const)
 {
+  NS_LOG_FUNCTION (this << &c);
 }
 
 void ConstantVariableImpl::NewConstant (double c)
 {
+  NS_LOG_FUNCTION (this << c);
   m_const = c;
 }
 
 double ConstantVariableImpl::GetValue ()
 {
+  NS_LOG_FUNCTION (this);
   return m_const;
 }
 
 uint32_t ConstantVariableImpl::GetInteger ()
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)m_const;
 }
 
 RandomVariableBase* ConstantVariableImpl::Copy () const
 {
+  NS_LOG_FUNCTION (this);
   return new ConstantVariableImpl (*this);
 }
 
 ConstantVariable::ConstantVariable ()
   : RandomVariable (ConstantVariableImpl ())
 {
+  NS_LOG_FUNCTION (this);
 }
 ConstantVariable::ConstantVariable (double c)
   : RandomVariable (ConstantVariableImpl (c))
 {
+  NS_LOG_FUNCTION (this << c);
 }
 void
 ConstantVariable::SetConstant (double c)
 {
+  NS_LOG_FUNCTION (this << c);
   *this = ConstantVariable (c);
 }
 
@@ -411,6 +448,7 @@
     m_current (f),
     m_currentConsecutive (0)
 {
+  NS_LOG_FUNCTION (this << f << l << i << c);
 }
 
 SequentialVariableImpl::SequentialVariableImpl (double f, double l, const RandomVariable& i, uint32_t c)
@@ -421,6 +459,7 @@
     m_current (f),
     m_currentConsecutive (0)
 {
+  NS_LOG_FUNCTION (this << f << l << i << c);
 }
 
 SequentialVariableImpl::SequentialVariableImpl (const SequentialVariableImpl& c)
@@ -432,14 +471,17 @@
     m_current (c.m_current),
     m_currentConsecutive (c.m_currentConsecutive)
 {
+  NS_LOG_FUNCTION (this << &c);
 }
 
 SequentialVariableImpl::~SequentialVariableImpl ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 double SequentialVariableImpl::GetValue ()
 { // Return a sequential series of values
+  NS_LOG_FUNCTION (this);
   double r = m_current;
   if (++m_currentConsecutive == m_consecutive)
     { // Time to advance to next
@@ -455,16 +497,19 @@
 
 RandomVariableBase* SequentialVariableImpl::Copy () const
 {
+  NS_LOG_FUNCTION (this);
   return new SequentialVariableImpl (*this);
 }
 
 SequentialVariable::SequentialVariable (double f, double l, double i, uint32_t c)
   : RandomVariable (SequentialVariableImpl (f, l, i, c))
 {
+  NS_LOG_FUNCTION (this << f << l << i << c);
 }
 SequentialVariable::SequentialVariable (double f, double l, const RandomVariable& i, uint32_t c)
   : RandomVariable (SequentialVariableImpl (f, l, i, c))
 {
+  NS_LOG_FUNCTION (this << f << l << i << c);
 }
 
 // -----------------------------------------------------------------------------
@@ -517,18 +562,21 @@
   : m_mean (1.0),
     m_bound (0)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 ExponentialVariableImpl::ExponentialVariableImpl (double m)
   : m_mean (m),
     m_bound (0)
 {
+  NS_LOG_FUNCTION (this << m);
 }
 
 ExponentialVariableImpl::ExponentialVariableImpl (double m, double b)
   : m_mean (m),
     m_bound (b)
 {
+  NS_LOG_FUNCTION (this << m << b);
 }
 
 ExponentialVariableImpl::ExponentialVariableImpl (const ExponentialVariableImpl& c)
@@ -536,10 +584,12 @@
     m_mean (c.m_mean),
     m_bound (c.m_bound)
 {
+  NS_LOG_FUNCTION (this << &c);
 }
 
 double ExponentialVariableImpl::GetValue ()
 {
+  NS_LOG_FUNCTION (this);
   RngStream *generator = GetStream ();
   while (1)
     {
@@ -554,20 +604,24 @@
 
 RandomVariableBase* ExponentialVariableImpl::Copy () const
 {
+  NS_LOG_FUNCTION (this);
   return new ExponentialVariableImpl (*this);
 }
 
 ExponentialVariable::ExponentialVariable ()
   : RandomVariable (ExponentialVariableImpl ())
 {
+  NS_LOG_FUNCTION (this);
 }
 ExponentialVariable::ExponentialVariable (double m)
   : RandomVariable (ExponentialVariableImpl (m))
 {
+  NS_LOG_FUNCTION (this << m);
 }
 ExponentialVariable::ExponentialVariable (double m, double b)
   : RandomVariable (ExponentialVariableImpl (m, b))
 {
+  NS_LOG_FUNCTION (this << m << b);
 }
 
 // -----------------------------------------------------------------------------
@@ -654,6 +708,7 @@
     m_shape (1.5),
     m_bound (0)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 ParetoVariableImpl::ParetoVariableImpl (double m)
@@ -661,6 +716,7 @@
     m_shape (1.5),
     m_bound (0)
 {
+  NS_LOG_FUNCTION (this << m);
 }
 
 ParetoVariableImpl::ParetoVariableImpl (double m, double s)
@@ -668,6 +724,7 @@
     m_shape (s),
     m_bound (0)
 {
+  NS_LOG_FUNCTION (this << m << s);
 }
 
 ParetoVariableImpl::ParetoVariableImpl (double m, double s, double b)
@@ -675,6 +732,7 @@
     m_shape (s),
     m_bound (b)
 {
+  NS_LOG_FUNCTION (this << m << s << b);
 }
 
 ParetoVariableImpl::ParetoVariableImpl (std::pair<double, double> params)
@@ -682,6 +740,7 @@
     m_shape (params.second),
     m_bound (0)
 {
+  NS_LOG_FUNCTION (this << &params);
 }
 
 ParetoVariableImpl::ParetoVariableImpl (std::pair<double, double> params, double b)
@@ -689,6 +748,7 @@
     m_shape (params.second),
     m_bound (b)
 {
+  NS_LOG_FUNCTION (this << &params << b);
 }
 
 ParetoVariableImpl::ParetoVariableImpl (const ParetoVariableImpl& c)
@@ -697,10 +757,12 @@
     m_shape (c.m_shape),
     m_bound (c.m_bound)
 {
+  NS_LOG_FUNCTION (this << &c);
 }
 
 double ParetoVariableImpl::GetValue ()
 {
+  NS_LOG_FUNCTION (this);
   RngStream *generator = GetStream ();
   while (1)
     {
@@ -715,32 +777,39 @@
 
 RandomVariableBase* ParetoVariableImpl::Copy () const
 {
+  NS_LOG_FUNCTION (this);
   return new ParetoVariableImpl (*this);
 }
 
 ParetoVariable::ParetoVariable ()
   : RandomVariable (ParetoVariableImpl ())
 {
+  NS_LOG_FUNCTION (this);
 }
 ParetoVariable::ParetoVariable (double m)
   : RandomVariable (ParetoVariableImpl (m))
 {
+  NS_LOG_FUNCTION (this << m);
 }
 ParetoVariable::ParetoVariable (double m, double s)
   : RandomVariable (ParetoVariableImpl (m, s))
 {
+  NS_LOG_FUNCTION (this << m << s);
 }
 ParetoVariable::ParetoVariable (double m, double s, double b)
   : RandomVariable (ParetoVariableImpl (m, s, b))
 {
+  NS_LOG_FUNCTION (this << m << s << b);
 }
 ParetoVariable::ParetoVariable (std::pair<double, double> params)
   : RandomVariable (ParetoVariableImpl (params))
 {
+  NS_LOG_FUNCTION (this << &params);
 }
 ParetoVariable::ParetoVariable (std::pair<double, double> params, double b)
   : RandomVariable (ParetoVariableImpl (params, b))
 {
+  NS_LOG_FUNCTION (this << &params << b);
 }
 
 // -----------------------------------------------------------------------------
@@ -803,24 +872,28 @@
                                               m_alpha (1),
                                               m_bound (0)
 {
+  NS_LOG_FUNCTION (this);
 }
 WeibullVariableImpl::WeibullVariableImpl (double m)
   : m_mean (m),
     m_alpha (1),
     m_bound (0)
 {
+  NS_LOG_FUNCTION (this << m);
 }
 WeibullVariableImpl::WeibullVariableImpl (double m, double s)
   : m_mean (m),
     m_alpha (s),
     m_bound (0)
 {
+  NS_LOG_FUNCTION (this << m << s);
 }
 WeibullVariableImpl::WeibullVariableImpl (double m, double s, double b)
   : m_mean (m),
     m_alpha (s),
     m_bound (b)
 {
+  NS_LOG_FUNCTION (this << m << s << b);
 }
 WeibullVariableImpl::WeibullVariableImpl (const WeibullVariableImpl& c)
   : RandomVariableBase (c),
@@ -828,10 +901,12 @@
     m_alpha (c.m_alpha),
     m_bound (c.m_bound)
 {
+  NS_LOG_FUNCTION (this << &c);
 }
 
 double WeibullVariableImpl::GetValue ()
 {
+  NS_LOG_FUNCTION (this);
   RngStream *generator = GetStream ();
   double exponent = 1.0 / m_alpha;
   while (1)
@@ -847,24 +922,29 @@
 
 RandomVariableBase* WeibullVariableImpl::Copy () const
 {
+  NS_LOG_FUNCTION (this);
   return new WeibullVariableImpl (*this);
 }
 
 WeibullVariable::WeibullVariable ()
   : RandomVariable (WeibullVariableImpl ())
 {
+  NS_LOG_FUNCTION (this);
 }
 WeibullVariable::WeibullVariable (double m)
   : RandomVariable (WeibullVariableImpl (m))
 {
+  NS_LOG_FUNCTION (this << m);
 }
 WeibullVariable::WeibullVariable (double m, double s)
   : RandomVariable (WeibullVariableImpl (m, s))
 {
+  NS_LOG_FUNCTION (this << m << s);
 }
 WeibullVariable::WeibullVariable (double m, double s, double b)
   : RandomVariable (WeibullVariableImpl (m, s, b))
 {
+  NS_LOG_FUNCTION (this << m << s << b);
 }
 
 // -----------------------------------------------------------------------------
@@ -918,6 +998,7 @@
     m_bound (INFINITE_VALUE),
     m_nextValid (false)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 NormalVariableImpl::NormalVariableImpl (double m, double v, double b)
@@ -926,6 +1007,7 @@
     m_bound (b),
     m_nextValid (false)
 {
+  NS_LOG_FUNCTION (this << m << v << b);
 }
 
 NormalVariableImpl::NormalVariableImpl (const NormalVariableImpl& c)
@@ -935,10 +1017,12 @@
     m_bound (c.m_bound),
     m_nextValid (false)
 {
+  NS_LOG_FUNCTION (this << &c);
 }
 
 double NormalVariableImpl::GetValue ()
 {
+  NS_LOG_FUNCTION (this);
   RngStream *generator = GetStream ();
   if (m_nextValid)
     { // use previously generated
@@ -979,38 +1063,45 @@
 
 RandomVariableBase* NormalVariableImpl::Copy () const
 {
+  NS_LOG_FUNCTION (this);
   return new NormalVariableImpl (*this);
 }
 
 double
 NormalVariableImpl::GetMean (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_mean;
 }
 
 double
 NormalVariableImpl::GetVariance (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_variance;
 }
 
 double
 NormalVariableImpl::GetBound (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_bound;
 }
 
 NormalVariable::NormalVariable ()
   : RandomVariable (NormalVariableImpl ())
 {
+  NS_LOG_FUNCTION (this);
 }
 NormalVariable::NormalVariable (double m, double v)
   : RandomVariable (NormalVariableImpl (m, v))
 {
+  NS_LOG_FUNCTION (this << m << v);
 }
 NormalVariable::NormalVariable (double m, double v, double b)
   : RandomVariable (NormalVariableImpl (m, v, b))
 {
+  NS_LOG_FUNCTION (this << m << v << b);
 }
 
 // -----------------------------------------------------------------------------
@@ -1059,16 +1150,19 @@
   : value (0.0),
     cdf (0.0)
 {
+  NS_LOG_FUNCTION (this);
 }
 EmpiricalVariableImpl::ValueCDF::ValueCDF (double v, double c)
   : value (v),
     cdf (c)
 {
+  NS_LOG_FUNCTION (this << v << c);
 }
 EmpiricalVariableImpl::ValueCDF::ValueCDF (const ValueCDF& c)
   : value (c.value),
     cdf (c.cdf)
 {
+  NS_LOG_FUNCTION (this << &c);
 }
 
 // -----------------------------------------------------------------------------
@@ -1077,6 +1171,7 @@
 EmpiricalVariableImpl::EmpiricalVariableImpl ()
   : validated (false)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 EmpiricalVariableImpl::EmpiricalVariableImpl (const EmpiricalVariableImpl& c)
@@ -1084,15 +1179,18 @@
     validated (c.validated),
     emp (c.emp)
 {
+  NS_LOG_FUNCTION (this << &c);
 }
 
 EmpiricalVariableImpl::~EmpiricalVariableImpl ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 double EmpiricalVariableImpl::GetValue ()
 { // Return a value from the empirical distribution
   // This code based (loosely) on code by Bruce Mah (Thanks Bruce!)
+  NS_LOG_FUNCTION (this);
   RngStream *generator = GetStream ();
   if (emp.size () == 0)
     {
@@ -1137,17 +1235,20 @@
 
 RandomVariableBase* EmpiricalVariableImpl::Copy () const
 {
+  NS_LOG_FUNCTION (this);
   return new EmpiricalVariableImpl (*this);
 }
 
 void EmpiricalVariableImpl::CDF (double v, double c)
 { // Add a new empirical datapoint to the empirical cdf
   // NOTE.   These MUST be inserted in non-decreasing order
+  NS_LOG_FUNCTION (this << v << c);
   emp.push_back (ValueCDF (v, c));
 }
 
 void EmpiricalVariableImpl::Validate ()
 {
+  NS_LOG_FUNCTION (this);
   ValueCDF prior;
   for (std::vector<ValueCDF>::size_type i = 0; i < emp.size (); ++i)
     {
@@ -1169,20 +1270,24 @@
 double EmpiricalVariableImpl::Interpolate (double c1, double c2,
                                            double v1, double v2, double r)
 { // Interpolate random value in range [v1..v2) based on [c1 .. r .. c2)
+  NS_LOG_FUNCTION (this << c1 << c2 << v1 << v2 << r);
   return (v1 + ((v2 - v1) / (c2 - c1)) * (r - c1));
 }
 
 EmpiricalVariable::EmpiricalVariable ()
   : RandomVariable (EmpiricalVariableImpl ())
 {
+  NS_LOG_FUNCTION (this);
 }
 EmpiricalVariable::EmpiricalVariable (const RandomVariableBase &variable)
   : RandomVariable (variable)
 {
+  NS_LOG_FUNCTION (this << &variable);
 }
 void
 EmpiricalVariable::CDF (double v, double c)
 {
+  NS_LOG_FUNCTION (this << v << c);
   EmpiricalVariableImpl *impl = dynamic_cast<EmpiricalVariableImpl *> (Peek ());
   NS_ASSERT (impl);
   impl->CDF (v, c);
@@ -1209,27 +1314,32 @@
 
 IntEmpiricalVariableImpl::IntEmpiricalVariableImpl ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 uint32_t IntEmpiricalVariableImpl::GetInteger ()
 {
+  NS_LOG_FUNCTION (this);
   return (uint32_t)GetValue ();
 }
 
 RandomVariableBase* IntEmpiricalVariableImpl::Copy () const
 {
+  NS_LOG_FUNCTION (this);
   return new IntEmpiricalVariableImpl (*this);
 }
 
 double IntEmpiricalVariableImpl::Interpolate (double c1, double c2,
                                               double v1, double v2, double r)
 { // Interpolate random value in range [v1..v2) based on [c1 .. r .. c2)
+  NS_LOG_FUNCTION (this << c1 << c2 << v1 << v2 << r);
   return std::ceil (v1 + ((v2 - v1) / (c2 - c1)) * (r - c1));
 }
 
 IntEmpiricalVariable::IntEmpiricalVariable ()
   : EmpiricalVariable (IntEmpiricalVariableImpl ())
 {
+  NS_LOG_FUNCTION (this);
 }
 
 // -----------------------------------------------------------------------------
@@ -1269,14 +1379,17 @@
     next (c),
     data (d)
 { // Nothing else needed
+  NS_LOG_FUNCTION (this << d << c);
 }
 
 DeterministicVariableImpl::~DeterministicVariableImpl ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 double DeterministicVariableImpl::GetValue ()
 {
+  NS_LOG_FUNCTION (this);
   if (next == count)
     {
       next = 0;
@@ -1286,12 +1399,14 @@
 
 RandomVariableBase* DeterministicVariableImpl::Copy () const
 {
+  NS_LOG_FUNCTION (this);
   return new DeterministicVariableImpl (*this);
 }
 
 DeterministicVariable::DeterministicVariable (double* d, uint32_t c)
   : RandomVariable (DeterministicVariableImpl (d, c))
 {
+  NS_LOG_FUNCTION (this << d << c);
 }
 
 // -----------------------------------------------------------------------------
@@ -1320,6 +1435,7 @@
 
 RandomVariableBase* LogNormalVariableImpl::Copy () const
 {
+  NS_LOG_FUNCTION (this);
   return new LogNormalVariableImpl (*this);
 }
 
@@ -1327,6 +1443,7 @@
   : m_mu (mu),
     m_sigma (sigma)
 {
+  NS_LOG_FUNCTION (this << mu << sigma);
 }
 
 // The code from this function was adapted from the GNU Scientific
@@ -1358,6 +1475,7 @@
 double
 LogNormalVariableImpl::GetValue ()
 {
+  NS_LOG_FUNCTION (this);
   RngStream *generator = GetStream ();
   double u, v, r2, normal, z;
 
@@ -1383,6 +1501,7 @@
 LogNormalVariable::LogNormalVariable (double mu, double sigma)
   : RandomVariable (LogNormalVariableImpl (mu, sigma))
 {
+  NS_LOG_FUNCTION (this << mu << sigma);
 }
 
 // -----------------------------------------------------------------------------
@@ -1419,6 +1538,7 @@
 
 RandomVariableBase* GammaVariableImpl::Copy () const
 {
+  NS_LOG_FUNCTION (this);
   return new GammaVariableImpl (m_alpha, m_beta);
 }
 
@@ -1426,11 +1546,13 @@
   : m_alpha (alpha),
     m_beta (beta)
 {
+  NS_LOG_FUNCTION (this << alpha << beta);
 }
 
 double
 GammaVariableImpl::GetValue ()
 {
+  NS_LOG_FUNCTION (this);
   return GetValue (m_alpha, m_beta);
 }
 
@@ -1453,6 +1575,7 @@
 double
 GammaVariableImpl::GetValue (double alpha, double beta)
 {
+  NS_LOG_FUNCTION (this << alpha << beta);
   RngStream *generator = GetStream ();
 
   if (alpha < 1)
@@ -1492,20 +1615,24 @@
 GammaVariable::GammaVariable ()
   : RandomVariable (GammaVariableImpl (1.0, 1.0))
 {
+  NS_LOG_FUNCTION (this);
 }
 
 GammaVariable::GammaVariable (double alpha, double beta)
   : RandomVariable (GammaVariableImpl (alpha, beta))
 {
+  NS_LOG_FUNCTION (this << alpha << beta);
 }
 
 double GammaVariable::GetValue (void) const
 {
+  NS_LOG_FUNCTION (this);
   return this->RandomVariable::GetValue ();
 }
 
 double GammaVariable::GetValue (double alpha, double beta) const
 {
+  NS_LOG_FUNCTION (this << alpha << beta);
   return ((GammaVariableImpl*)Peek ())->GetValue (alpha, beta);
 }
 
@@ -1543,6 +1670,7 @@
 
 RandomVariableBase* ErlangVariableImpl::Copy () const
 {
+  NS_LOG_FUNCTION (this);
   return new ErlangVariableImpl (m_k, m_lambda);
 }
 
@@ -1550,11 +1678,13 @@
   : m_k (k),
     m_lambda (lambda)
 {
+  NS_LOG_FUNCTION (this << k << lambda);
 }
 
 double
 ErlangVariableImpl::GetValue ()
 {
+  NS_LOG_FUNCTION (this);
   return GetValue (m_k, m_lambda);
 }
 
@@ -1575,6 +1705,7 @@
 {
   // XXX: Fixme: do not create a new 
   // RNG stream every time the function is called !
+  NS_LOG_FUNCTION (this << k << lambda);
   ExponentialVariable exponential (lambda);
 
   double result = 0;
@@ -1589,20 +1720,24 @@
 ErlangVariable::ErlangVariable ()
   : RandomVariable (ErlangVariableImpl (1, 1.0))
 {
+  NS_LOG_FUNCTION (this);
 }
 
 ErlangVariable::ErlangVariable (unsigned int k, double lambda)
   : RandomVariable (ErlangVariableImpl (k, lambda))
 {
+  NS_LOG_FUNCTION (this << k << lambda);
 }
 
 double ErlangVariable::GetValue (void) const
 {
+  NS_LOG_FUNCTION (this);
   return this->RandomVariable::GetValue ();
 }
 
 double ErlangVariable::GetValue (unsigned int k, double lambda) const
 {
+  NS_LOG_FUNCTION (this << k << lambda);
   return ((ErlangVariableImpl*)Peek ())->GetValue (k, lambda);
 }
 
@@ -1647,6 +1782,7 @@
     m_max (1),
     m_mode (0.5)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 TriangularVariableImpl::TriangularVariableImpl (double s, double l, double mean)
@@ -1654,6 +1790,7 @@
     m_max (l),
     m_mode (3.0 * mean - s - l)
 {
+  NS_LOG_FUNCTION (this << s << l << mean);
 }
 
 TriangularVariableImpl::TriangularVariableImpl (const TriangularVariableImpl& c)
@@ -1662,10 +1799,12 @@
     m_max (c.m_max),
     m_mode (c.m_mode)
 {
+  NS_LOG_FUNCTION (this << &c);
 }
 
 double TriangularVariableImpl::GetValue ()
 {
+  NS_LOG_FUNCTION (this);
   RngStream *generator = GetStream ();
   double u = generator->RandU01 ();
   if (u <= (m_mode - m_min) / (m_max - m_min) )
@@ -1680,16 +1819,19 @@
 
 RandomVariableBase* TriangularVariableImpl::Copy () const
 {
+  NS_LOG_FUNCTION (this);
   return new TriangularVariableImpl (*this);
 }
 
 TriangularVariable::TriangularVariable ()
   : RandomVariable (TriangularVariableImpl ())
 {
+  NS_LOG_FUNCTION (this);
 }
 TriangularVariable::TriangularVariable (double s, double l, double mean)
   : RandomVariable (TriangularVariableImpl (s,l,mean))
 {
+  NS_LOG_FUNCTION (this << s << l << mean);
 }
 
 // -----------------------------------------------------------------------------
@@ -1724,6 +1866,7 @@
 
 RandomVariableBase* ZipfVariableImpl::Copy () const
 {
+  NS_LOG_FUNCTION (this);
   return new ZipfVariableImpl (m_n, m_alpha);
 }
 
@@ -1732,6 +1875,7 @@
     m_alpha (0),
     m_c (1)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 
@@ -1741,6 +1885,7 @@
     m_c (0)
 {
   // calculate the normalization constant c
+  NS_LOG_FUNCTION (this << n << alpha);
   for (int i = 1; i <= n; i++)
     {
       m_c += (1.0 / std::pow ((double)i, alpha));
@@ -1751,6 +1896,7 @@
 double
 ZipfVariableImpl::GetValue ()
 {
+  NS_LOG_FUNCTION (this);
   RngStream *generator = GetStream ();
 
   double u = generator->RandU01 ();
@@ -1770,11 +1916,13 @@
 ZipfVariable::ZipfVariable ()
   : RandomVariable (ZipfVariableImpl ())
 {
+  NS_LOG_FUNCTION (this);
 }
 
 ZipfVariable::ZipfVariable (long n, double alpha)
   : RandomVariable (ZipfVariableImpl (n, alpha))
 {
+  NS_LOG_FUNCTION (this << n << alpha);
 }
 
 
@@ -1808,6 +1956,7 @@
 
 RandomVariableBase* ZetaVariableImpl::Copy () const
 {
+  NS_LOG_FUNCTION (this);
   return new ZetaVariableImpl (m_alpha);
 }
 
@@ -1815,6 +1964,7 @@
   : m_alpha (3.14),
     m_b (std::pow (2.0, 2.14))
 {
+  NS_LOG_FUNCTION (this);
 }
 
 
@@ -1822,6 +1972,7 @@
   : m_alpha (alpha),
     m_b (std::pow (2.0, alpha - 1.0))
 {
+  NS_LOG_FUNCTION (this << alpha);
 }
 
 /*
@@ -1832,6 +1983,7 @@
 double
 ZetaVariableImpl::GetValue ()
 {
+  NS_LOG_FUNCTION (this);
   RngStream *generator = GetStream ();
 
   double u, v;
@@ -1854,16 +2006,19 @@
 ZetaVariable::ZetaVariable ()
   : RandomVariable (ZetaVariableImpl ())
 {
+  NS_LOG_FUNCTION (this);
 }
 
 ZetaVariable::ZetaVariable (double alpha)
   : RandomVariable (ZetaVariableImpl (alpha))
 {
+  NS_LOG_FUNCTION (this << alpha);
 }
 
 
 std::ostream & operator << (std::ostream &os, const RandomVariable &var)
 {
+  NS_LOG_FUNCTION (&os << &var);
   RandomVariableBase *base = var.Peek ();
   ConstantVariableImpl *constant = dynamic_cast<ConstantVariableImpl *> (base);
   if (constant != 0)
@@ -1894,6 +2049,7 @@
 }
 std::istream & operator >> (std::istream &is, RandomVariable &var)
 {
+  NS_LOG_FUNCTION (&is << &var);
   std::string value;
   is >> value;
   std::string::size_type tmp;
--- a/src/core/model/realtime-simulator-impl.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/realtime-simulator-impl.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -65,7 +65,7 @@
 
 RealtimeSimulatorImpl::RealtimeSimulatorImpl ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
 
   m_stop = false;
   m_running = false;
@@ -89,12 +89,13 @@
 
 RealtimeSimulatorImpl::~RealtimeSimulatorImpl ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 void
 RealtimeSimulatorImpl::DoDispose (void)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   while (!m_events->IsEmpty ())
     {
       Scheduler::Event next = m_events->RemoveNext ();
@@ -108,7 +109,7 @@
 void
 RealtimeSimulatorImpl::Destroy ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
 
   //
   // This function is only called with the private version "disconnected" from
@@ -133,7 +134,7 @@
 void
 RealtimeSimulatorImpl::SetScheduler (ObjectFactory schedulerFactory)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this << schedulerFactory);
 
   Ptr<Scheduler> scheduler = schedulerFactory.Create<Scheduler> ();
 
@@ -155,7 +156,7 @@
 void
 RealtimeSimulatorImpl::ProcessOneEvent (void)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   //
   // The idea here is to wait until the next event comes due.  In the case of
   // a realtime simulation, we want real time to be consumed between events.
@@ -385,7 +386,7 @@
 bool 
 RealtimeSimulatorImpl::IsFinished (void) const
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   bool rc;
   {
     CriticalSection cs (m_mutex);
@@ -401,7 +402,7 @@
 uint64_t
 RealtimeSimulatorImpl::NextTs (void) const
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   NS_ASSERT_MSG (m_events->IsEmpty () == false, 
                  "RealtimeSimulatorImpl::NextTs(): event queue is empty");
   Scheduler::Event ev = m_events->PeekNext ();
@@ -411,7 +412,7 @@
 void
 RealtimeSimulatorImpl::Run (void)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
 
   NS_ASSERT_MSG (m_running == false, 
                  "RealtimeSimulatorImpl::Run(): Simulator already running");
@@ -473,27 +474,28 @@
 bool
 RealtimeSimulatorImpl::Running (void) const
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   return m_running;
 }
 
 bool
 RealtimeSimulatorImpl::Realtime (void) const
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   return m_synchronizer->Realtime ();
 }
 
 void 
 RealtimeSimulatorImpl::Stop (void)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   m_stop = true;
 }
 
 void 
 RealtimeSimulatorImpl::Stop (Time const &time)
 {
+  NS_LOG_FUNCTION (this << time);
   Simulator::Schedule (time, &Simulator::Stop);
 }
 
@@ -503,7 +505,7 @@
 EventId
 RealtimeSimulatorImpl::Schedule (Time const &time, EventImpl *impl)
 {
-  NS_LOG_FUNCTION (time << impl);
+  NS_LOG_FUNCTION (this << time << impl);
 
   Scheduler::Event ev;
   {
@@ -533,7 +535,7 @@
 void
 RealtimeSimulatorImpl::ScheduleWithContext (uint32_t context, Time const &time, EventImpl *impl)
 {
-  NS_LOG_FUNCTION (time << impl);
+  NS_LOG_FUNCTION (this << context << time << impl);
 
   {
     CriticalSection cs (m_mutex);
@@ -569,7 +571,7 @@
 EventId
 RealtimeSimulatorImpl::ScheduleNow (EventImpl *impl)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this << impl);
   Scheduler::Event ev;
   {
     CriticalSection cs (m_mutex);
@@ -590,6 +592,7 @@
 Time
 RealtimeSimulatorImpl::Now (void) const
 {
+  NS_LOG_FUNCTION (this);
   return TimeStep (m_currentTs);
 }
 
@@ -599,7 +602,7 @@
 void
 RealtimeSimulatorImpl::ScheduleRealtimeWithContext (uint32_t context, Time const &time, EventImpl *impl)
 {
-  NS_LOG_FUNCTION (context << time << impl);
+  NS_LOG_FUNCTION (this << context << time << impl);
 
   {
     CriticalSection cs (m_mutex);
@@ -620,14 +623,14 @@
 void
 RealtimeSimulatorImpl::ScheduleRealtime (Time const &time, EventImpl *impl)
 {
-  NS_LOG_FUNCTION (time << impl);
+  NS_LOG_FUNCTION (this << time << impl);
   ScheduleRealtimeWithContext (GetContext (), time, impl);
 }
 
 void
 RealtimeSimulatorImpl::ScheduleRealtimeNowWithContext (uint32_t context, EventImpl *impl)
 {
-  NS_LOG_FUNCTION (context << impl);
+  NS_LOG_FUNCTION (this << context << impl);
   {
     CriticalSection cs (m_mutex);
 
@@ -653,20 +656,21 @@
 void
 RealtimeSimulatorImpl::ScheduleRealtimeNow (EventImpl *impl)
 {
-  NS_LOG_FUNCTION (impl);
+  NS_LOG_FUNCTION (this << impl);
   ScheduleRealtimeNowWithContext (GetContext (), impl);
 }
 
 Time
 RealtimeSimulatorImpl::RealtimeNow (void) const
 {
+  NS_LOG_FUNCTION (this);
   return TimeStep (m_synchronizer->GetCurrentRealtime ());
 }
 
 EventId
 RealtimeSimulatorImpl::ScheduleDestroy (EventImpl *impl)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this << impl);
 
   EventId id;
   {
@@ -692,6 +696,7 @@
   // If the event has expired, there is no delay until it runs.  It is not the
   // case that there is a negative time until it runs.
   //
+  NS_LOG_FUNCTION (this << &id);
   if (IsExpired (id))
     {
       return TimeStep (0);
@@ -703,6 +708,7 @@
 void
 RealtimeSimulatorImpl::Remove (const EventId &id)
 {
+  NS_LOG_FUNCTION (this << &id);
   if (id.GetUid () == 2)
     {
       // destroy events.
@@ -742,6 +748,7 @@
 void
 RealtimeSimulatorImpl::Cancel (const EventId &id)
 {
+  NS_LOG_FUNCTION (this << &id);
   if (IsExpired (id) == false)
     {
       id.PeekEventImpl ()->Cancel ();
@@ -751,6 +758,7 @@
 bool
 RealtimeSimulatorImpl::IsExpired (const EventId &ev) const
 {
+  NS_LOG_FUNCTION (this << &ev);
   if (ev.GetUid () == 2)
     {
       if (ev.PeekEventImpl () == 0 ||
@@ -796,6 +804,7 @@
 {
   // XXX: I am fairly certain other compilers use other non-standard
   // post-fixes to indicate 64 bit constants.
+  NS_LOG_FUNCTION (this);
   return TimeStep (0x7fffffffffffffffLL);
 }
 
@@ -803,40 +812,42 @@
 uint32_t 
 RealtimeSimulatorImpl::GetSystemId (void) const
 {
+  NS_LOG_FUNCTION (this);
   return 0;
 }
 
 uint32_t
 RealtimeSimulatorImpl::GetContext (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_currentContext;
 }
 
 void 
 RealtimeSimulatorImpl::SetSynchronizationMode (enum SynchronizationMode mode)
 {
-  NS_LOG_FUNCTION (mode);
+  NS_LOG_FUNCTION (this << mode);
   m_synchronizationMode = mode;
 }
 
 RealtimeSimulatorImpl::SynchronizationMode
 RealtimeSimulatorImpl::GetSynchronizationMode (void) const
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   return m_synchronizationMode;
 }
 
 void 
 RealtimeSimulatorImpl::SetHardLimit (Time limit)
 {
-  NS_LOG_FUNCTION (limit);
+  NS_LOG_FUNCTION (this << limit);
   m_hardLimit = limit;
 }
 
 Time
 RealtimeSimulatorImpl::GetHardLimit (void) const
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   return m_hardLimit;
 }
 
--- a/src/core/model/ref-count-base.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/ref-count-base.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -1,9 +1,13 @@
 #include "ref-count-base.h"
+#include "log.h"
+
+NS_LOG_COMPONENT_DEFINE ("RefCountBase");
 
 namespace ns3 {
 
 RefCountBase::~RefCountBase ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 } // namespace ns3
--- a/src/core/model/rng-seed-manager.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/rng-seed-manager.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -3,6 +3,9 @@
 #include "attribute-helper.h"
 #include "integer.h"
 #include "config.h"
+#include "log.h"
+
+NS_LOG_COMPONENT_DEFINE ("RngSeedManager");
 
 namespace ns3 {
 
@@ -19,6 +22,7 @@
 
 uint32_t RngSeedManager::GetSeed (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   IntegerValue seedValue;
   g_rngSeed.GetValue (seedValue);
   return seedValue.Get ();
@@ -26,16 +30,19 @@
 void 
 RngSeedManager::SetSeed (uint32_t seed)
 {
+  NS_LOG_FUNCTION (seed);
   Config::SetGlobal ("RngSeed", IntegerValue(seed));
 }
 
 void RngSeedManager::SetRun (uint64_t run)
 {
+  NS_LOG_FUNCTION (run);
   Config::SetGlobal ("RngRun", IntegerValue (run));
 }
 
 uint64_t RngSeedManager::GetRun ()
 {
+  NS_LOG_FUNCTION_NOARGS ();
   IntegerValue value;
   g_rngRun.GetValue (value);
   int run = value.Get();
@@ -44,6 +51,7 @@
 
 uint64_t RngSeedManager::GetNextStreamIndex (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   uint64_t next = g_nextStreamIndex;
   g_nextStreamIndex++;
   return next;
--- a/src/core/model/rng-stream.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/rng-stream.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -24,6 +24,9 @@
 #include <iostream>
 #include "rng-stream.h"
 #include "fatal-error.h"
+#include "log.h"
+
+NS_LOG_COMPONENT_DEFINE ("RngStream");
 
 namespace
 {
@@ -70,6 +73,7 @@
 //
 double MultModM (double a, double s, double c, double m)
 {
+  NS_LOG_FUNCTION (a << s << c << m);
   double v;
   int32_t a1;
 
@@ -105,6 +109,7 @@
 void MatVecModM (const Matrix A, const double s[3], double v[3],
                  double m)
 {
+  NS_LOG_FUNCTION (&A << s << v << m);
   int i;
   double x[3];                 // Necessary if v = s
 
@@ -128,6 +133,7 @@
 void MatMatModM (const Matrix A, const Matrix B,
                  Matrix C, double m)
 {
+  NS_LOG_FUNCTION (&A << &B << &C << m);
   int i, j;
   double V[3];
   Matrix W;
@@ -159,6 +165,7 @@
 //
 void MatTwoPowModM (const Matrix src, Matrix dst, double m, int32_t e)
 {
+  NS_LOG_FUNCTION (&src << &dst << m << e);
   int i, j;
 
   /* initialize: dst = src */
@@ -183,6 +190,7 @@
 /*
 void MatPowModM (const double A[3][3], double B[3][3], double m, int32_t n)
 {
+  NS_LOG_FUNCTION (A << B << m << n);
   int i, j;
   double W[3][3];
 
@@ -233,6 +241,7 @@
 }
 void PowerOfTwoMatrix (int n, Matrix a1p, Matrix a2p)
 {
+  NS_LOG_FUNCTION (n << &a1p << &a2p);
   static struct Precalculated constants = PowerOfTwoConstants ();
   for (int i = 0; i < 3; i ++)
     {
@@ -253,6 +262,7 @@
 //
 double RngStream::RandU01 ()
 {
+  NS_LOG_FUNCTION (this);
   int32_t k;
   double p1, p2, u;
 
@@ -284,6 +294,7 @@
 
 RngStream::RngStream (uint32_t seedNumber, uint64_t stream, uint64_t substream)
 {
+  NS_LOG_FUNCTION (this << seedNumber << stream << substream);
   if (seedNumber >= m1 || seedNumber >= m2 || seedNumber == 0)
     {
       NS_FATAL_ERROR ("invalid Seed " << seedNumber);
@@ -298,6 +309,7 @@
 
 RngStream::RngStream(const RngStream& r)
 {
+  NS_LOG_FUNCTION (this << &r);
   for (int i = 0; i < 6; ++i)
     {
       m_currentState[i] = r.m_currentState[i];
@@ -307,6 +319,7 @@
 void 
 RngStream::AdvanceNthBy (uint64_t nth, int by, double state[6])
 {
+  NS_LOG_FUNCTION (this << &nth << by << state);
   Matrix matrix1,matrix2;
   for (int i = 0; i < 64; i++)
     {
--- a/src/core/model/scheduler.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/scheduler.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -20,6 +20,9 @@
 
 #include "scheduler.h"
 #include "assert.h"
+#include "log.h"
+
+NS_LOG_COMPONENT_DEFINE ("Scheduler");
 
 namespace ns3 {
 
@@ -27,11 +30,13 @@
 
 Scheduler::~Scheduler ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 TypeId
 Scheduler::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::Scheduler")
     .SetParent<Object> ()
   ;
--- a/src/core/model/simulator-impl.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/simulator-impl.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -1,10 +1,14 @@
 #include "simulator-impl.h"
+#include "log.h"
+
+NS_LOG_COMPONENT_DEFINE ("SimulatorImpl");
 
 namespace ns3 {
 
 TypeId 
 SimulatorImpl::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::SimulatorImpl")
     .SetParent<Object> ()
   ;
--- a/src/core/model/simulator.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/simulator.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -54,12 +54,14 @@
 static void
 TimePrinter (std::ostream &os)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   os << Simulator::Now ().GetSeconds () << "s";
 }
 
 static void
 NodePrinter (std::ostream &os)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   if (Simulator::GetContext () == 0xffffffff)
     {
       os << "-1";
@@ -72,12 +74,14 @@
 
 static SimulatorImpl **PeekImpl (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static SimulatorImpl *impl = 0;
   return &impl;
 }
 
 static SimulatorImpl * GetImpl (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   SimulatorImpl **pimpl = PeekImpl ();
   /* Please, don't include any calls to logging macros in this function
    * or pay the price, that is, stack explosions.
@@ -159,6 +163,7 @@
 void 
 Simulator::Stop (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   NS_LOG_LOGIC ("stop");
   GetImpl ()->Stop ();
 }
@@ -176,6 +181,7 @@
   /* Please, don't include any calls to logging macros in this function
    * or pay the price, that is, stack explosions.
    */
+  NS_LOG_FUNCTION_NOARGS ();
   return GetImpl ()->Now ();
 }
 
@@ -202,6 +208,7 @@
 void
 Simulator::ScheduleWithContext (uint32_t context, const Time &time, EventImpl *impl)
 {
+  NS_LOG_FUNCTION (context << time << impl);
   return GetImpl ()->ScheduleWithContext (context, time, impl);
 }
 EventId
@@ -213,16 +220,19 @@
 EventId 
 Simulator::DoSchedule (Time const &time, EventImpl *impl)
 {
+  NS_LOG_FUNCTION (time << impl);
   return GetImpl ()->Schedule (time, impl);
 }
 EventId 
 Simulator::DoScheduleNow (EventImpl *impl)
 {
+  NS_LOG_FUNCTION (impl);
   return GetImpl ()->ScheduleNow (impl);
 }
 EventId 
 Simulator::DoScheduleDestroy (EventImpl *impl)
 {
+  NS_LOG_FUNCTION (impl);
   return GetImpl ()->ScheduleDestroy (impl);
 }
 
@@ -304,6 +314,7 @@
 uint32_t
 Simulator::GetContext (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   return GetImpl ()->GetContext ();
 }
 
@@ -325,6 +336,7 @@
 void
 Simulator::SetImplementation (Ptr<SimulatorImpl> impl)
 {
+  NS_LOG_FUNCTION (impl);
   if (*PeekImpl () != 0)
     {
       NS_FATAL_ERROR ("It is not possible to set the implementation after calling any Simulator:: function. Call Simulator::SetImplementation earlier or after Simulator::Destroy.");
@@ -349,6 +361,7 @@
 Ptr<SimulatorImpl>
 Simulator::GetImplementation (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   return GetImpl ();
 }
 
--- a/src/core/model/synchronizer.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/synchronizer.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -17,6 +17,9 @@
  */
 
 #include "synchronizer.h"
+#include "log.h"
+
+NS_LOG_COMPONENT_DEFINE ("Synchronizer");
 
 namespace ns3 {
 
@@ -25,6 +28,7 @@
 TypeId 
 Synchronizer::GetTypeId (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TypeId tid = TypeId ("ns3::Synchronizer")
     .SetParent<Object> ()
   ;
@@ -34,27 +38,32 @@
 Synchronizer::Synchronizer ()
   : m_realtimeOriginNano (0), m_simOriginNano (0)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 Synchronizer::~Synchronizer ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 bool
 Synchronizer::Realtime (void)
 {
+  NS_LOG_FUNCTION (this);
   return DoRealtime ();
 }
 
 uint64_t
 Synchronizer::GetCurrentRealtime (void)
 {
+  NS_LOG_FUNCTION (this);
   return NanosecondToTimeStep (DoGetCurrentRealtime ());
 }
 
 void
 Synchronizer::SetOrigin (uint64_t ts)
 {
+  NS_LOG_FUNCTION (this << ts);
   m_simOriginNano = TimeStepToNanosecond (ts);
   DoSetOrigin (m_simOriginNano);
 }
@@ -62,12 +71,14 @@
 uint64_t
 Synchronizer::GetOrigin (void)
 {
+  NS_LOG_FUNCTION (this);
   return NanosecondToTimeStep (m_simOriginNano);
 }
 
 int64_t
 Synchronizer::GetDrift (uint64_t ts)
 {
+  NS_LOG_FUNCTION (this << ts);
   int64_t tDrift = DoGetDrift (TimeStepToNanosecond (ts));
 
   if (tDrift < 0) 
@@ -81,6 +92,7 @@
 bool
 Synchronizer::Synchronize (uint64_t tsCurrent, uint64_t tsDelay)
 {
+  NS_LOG_FUNCTION (this << tsCurrent << tsDelay);
   return DoSynchronize (TimeStepToNanosecond (tsCurrent), 
                         TimeStepToNanosecond (tsDelay));
 }
@@ -88,36 +100,42 @@
 void
 Synchronizer::Signal (void)
 {
+  NS_LOG_FUNCTION (this);
   DoSignal ();
 }
 
 void
 Synchronizer::SetCondition (bool cond)
 {
+  NS_LOG_FUNCTION (this << cond);
   DoSetCondition (cond);
 }
 
 void
 Synchronizer::EventStart (void)
 {
+  NS_LOG_FUNCTION (this);
   DoEventStart ();
 }
 
 uint64_t
 Synchronizer::EventEnd (void)
 {
+  NS_LOG_FUNCTION (this);
   return NanosecondToTimeStep (DoEventEnd ());
 }
 
 uint64_t
 Synchronizer::TimeStepToNanosecond (uint64_t ts)
 {
+  NS_LOG_FUNCTION (this << ts);
   return TimeStep (ts).GetNanoSeconds ();
 }
 
 uint64_t
 Synchronizer::NanosecondToTimeStep (uint64_t ns)
 {
+  NS_LOG_FUNCTION (this << ns);
   return NanoSeconds (ns).GetTimeStep ();
 }
 
--- a/src/core/model/system-path.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/system-path.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -20,6 +20,7 @@
 #include "system-path.h"
 #include "fatal-error.h"
 #include "assert.h"
+#include "log.h"
 #include "ns3/core-config.h"
 #include <cstdlib>
 #include <cerrno>
@@ -54,12 +55,15 @@
 #define SYSTEM_PATH_SEP "/"
 #endif
 
+NS_LOG_COMPONENT_DEFINE ("SystemPath");
+
 namespace ns3 {
 
 namespace SystemPath {
 
 std::string Dirname (std::string path)
 {
+  NS_LOG_FUNCTION (path);
   std::list<std::string> elements = Split (path);
   std::list<std::string>::const_iterator last = elements.end();
   last--;
@@ -77,6 +81,7 @@
    * BSD with procfs: readlink /proc/curproc/file
    * Windows: GetModuleFileName() with hModule = NULL
    */
+  NS_LOG_FUNCTION_NOARGS ();
   std::string filename;
 #if defined(__linux__)
   {
@@ -158,6 +163,7 @@
 std::string Append (std::string left, std::string right)
 {
   // removing trailing separators from 'left'
+  NS_LOG_FUNCTION (left << right);
   while (true)
     {
       std::string::size_type lastSep = left.rfind (SYSTEM_PATH_SEP);
@@ -173,6 +179,7 @@
 
 std::list<std::string> Split (std::string path)
 {
+  NS_LOG_FUNCTION (path);
   std::list<std::string> retval;
   std::string::size_type current = 0, next = 0;
   next = path.find (SYSTEM_PATH_SEP, current);
@@ -191,6 +198,7 @@
 std::string Join (std::list<std::string>::const_iterator begin,
 		  std::list<std::string>::const_iterator end)
 {
+  NS_LOG_FUNCTION (&begin << &end);
   std::string retval = "";
   for (std::list<std::string>::const_iterator i = begin; i != end; i++)
     {
@@ -208,6 +216,7 @@
   
 std::list<std::string> ReadFiles (std::string path)
 {
+  NS_LOG_FUNCTION (path);
   std::list<std::string> files;
 #if defined HAVE_OPENDIR
   DIR *dp = opendir (path.c_str ());
@@ -246,6 +255,7 @@
 std::string 
 MakeTemporaryDirectoryName (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   char *path = NULL;
 
   path = getenv ("TMP");
@@ -292,6 +302,7 @@
 void 
 MakeDirectories (std::string path)
 {
+  NS_LOG_FUNCTION (path);
   std::list<std::string> elements = Split (path);
   for (std::list<std::string>::const_iterator i = elements.begin (); i != elements.end (); ++i)
     {
--- a/src/core/model/system-thread.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/system-thread.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -32,7 +32,7 @@
 SystemThread::SystemThread (Callback<void> callback)
   : m_callback (callback)
 {
-  NS_LOG_FUNCTION (this);
+  NS_LOG_FUNCTION (this << &callback);
 }
 
 SystemThread::~SystemThread()
@@ -82,12 +82,14 @@
 SystemThread::ThreadId 
 SystemThread::Self (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   return pthread_self ();
 }
 
 bool 
 SystemThread::Equals (SystemThread::ThreadId id)
 {
+  NS_LOG_FUNCTION (id);
   return (pthread_equal (pthread_self (), id) != 0);
 }
 
--- a/src/core/model/test.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/test.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -20,6 +20,7 @@
 #include "assert.h"
 #include "abort.h"
 #include "system-path.h"
+#include "log.h"
 #include <cmath>
 #include <cstring>
 #include <vector>
@@ -29,9 +30,12 @@
 
 namespace ns3 {
 
+NS_LOG_COMPONENT_DEFINE ("Test");
+
 bool
 TestDoubleIsEqual (const double x1, const double x2, const double epsilon)
 {
+  NS_LOG_FUNCTION (x1 << x2 << epsilon);
   int exponent;
   double delta, difference;
 
@@ -127,10 +131,14 @@
                                   std::string _file, int32_t _line)
   : cond (_cond), actual (_actual), limit (_limit),
     message (_message), file (_file), line (_line)
-{}
+{
+  NS_LOG_FUNCTION (this << _cond << _actual << _limit << _message << _file << _line);
+}
 TestCase::Result::Result ()
   : childrenFailed (false)
-{}
+{
+  NS_LOG_FUNCTION (this);
+}
 
 
 
@@ -141,10 +149,12 @@
     m_result (0),
     m_name (name)
 {
+  NS_LOG_FUNCTION (this << name);
 }
 
 TestCase::~TestCase ()
 {
+  NS_LOG_FUNCTION (this);
   NS_ASSERT (m_runner == 0);
   m_parent = 0;
   delete m_result;
@@ -158,6 +168,7 @@
 void
 TestCase::AddTestCase (TestCase *testCase)
 {
+  NS_LOG_FUNCTION (&testCase);
   m_children.push_back (testCase);
   testCase->m_parent = this;
 
@@ -187,12 +198,14 @@
 bool
 TestCase::IsFailed (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_result->childrenFailed || !m_result->failure.empty ();
 }
 
 void 
 TestCase::Run (TestRunnerImpl *runner)
 {
+  NS_LOG_FUNCTION (this << runner);
   m_result = new Result ();
   m_runner = runner;
   DoSetup ();
@@ -215,6 +228,7 @@
 std::string 
 TestCase::GetName (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_name;
 }
 void
@@ -222,6 +236,7 @@
                              std::string limit, std::string message, 
                              std::string file, int32_t line)
 {
+  NS_LOG_FUNCTION (this << cond << actual << limit << message << file << line);
   m_result->failure.push_back (TestCaseFailure (cond, actual, limit,
                                                 message, file, line));
   // set childrenFailed flag on parents.
@@ -236,17 +251,20 @@
 bool 
 TestCase::MustAssertOnFailure (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_runner->MustAssertOnFailure ();
 }
 bool 
 TestCase::MustContinueOnFailure (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_runner->MustContinueOnFailure ();
 }
 
 std::string 
 TestCase::CreateDataDirFilename (std::string filename)
 {
+  NS_LOG_FUNCTION (this << filename);
   const TestCase *current = this;
   while (current->m_dataDir == "" && current != 0)
     {
@@ -264,6 +282,7 @@
 std::string 
 TestCase::CreateTempDirFilename (std::string filename)
 {
+  NS_LOG_FUNCTION (this << filename);
   if (m_runner->MustUpdateData ())
     {
       return CreateDataDirFilename (filename);
@@ -285,49 +304,61 @@
 bool 
 TestCase::GetErrorStatus (void) const
 {
+  NS_LOG_FUNCTION (this);
   return IsStatusFailure ();
 }
 bool 
 TestCase::IsStatusFailure (void) const
 {
+  NS_LOG_FUNCTION (this);
   return !IsStatusSuccess ();
 }
 bool 
 TestCase::IsStatusSuccess (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_result->failure.empty ();
 }
 
 void 
 TestCase::SetDataDir (std::string directory)
 {
+  NS_LOG_FUNCTION (this << directory);
   m_dataDir = directory;
 }
 
 void 
 TestCase::DoSetup (void)
-{}
+{
+  NS_LOG_FUNCTION (this);
+}
 void 
 TestCase::DoTeardown (void)
-{}
+{
+  NS_LOG_FUNCTION (this);
+}
 
 
 TestSuite::TestSuite (std::string name, TestSuite::Type type)
   : TestCase (name), 
     m_type (type)
 {
+  NS_LOG_FUNCTION (this << name << type);
   TestRunnerImpl::Instance ()->AddTestSuite (this);
 }
 
 TestSuite::Type 
 TestSuite::GetTestType (void)
 {
+  NS_LOG_FUNCTION (this);
   return m_type;
 }
 
 void 
 TestSuite::DoRun (void)
-{}
+{
+  NS_LOG_FUNCTION (this);
+}
 
 TestRunnerImpl::TestRunnerImpl ()
  : m_tempDir (""),
@@ -335,10 +366,12 @@
    m_continueOnFailure (true),
    m_updateData (false)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 TestRunnerImpl::~TestRunnerImpl ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 
@@ -346,6 +379,7 @@
 TestRunnerImpl *
 TestRunnerImpl::Instance (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   static TestRunnerImpl runner;
   return &runner;
 }
@@ -353,6 +387,7 @@
 void
 TestRunnerImpl::AddTestSuite (TestSuite *testSuite)
 {
+  NS_LOG_FUNCTION (this << testSuite);
   m_suites.push_back (testSuite);
 }
 
@@ -360,27 +395,32 @@
 bool 
 TestRunnerImpl::MustAssertOnFailure (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_assertOnFailure;
 }
 bool 
 TestRunnerImpl::MustContinueOnFailure (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_continueOnFailure;
 }
 
 bool 
 TestRunnerImpl::MustUpdateData (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_updateData;
 }
 std::string
 TestRunnerImpl::GetTempDir (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_tempDir;
 }
 bool
 TestRunnerImpl::IsTopLevelSourceDir (std::string path) const
 {
+  NS_LOG_FUNCTION (this << path);
   bool haveVersion = false;
   bool haveLicense = false;
   
@@ -408,6 +448,7 @@
 std::string 
 TestRunnerImpl::GetTopLevelSourceDir (void) const
 {
+  NS_LOG_FUNCTION (this);
   std::string self = SystemPath::FindSelfDirectory ();
   std::list<std::string> elements = SystemPath::Split (self);
   while (!elements.empty ())
@@ -430,6 +471,7 @@
 std::string
 TestRunnerImpl::ReplaceXmlSpecialCharacters (std::string xml) const
 {
+  NS_LOG_FUNCTION (this << xml);
   std::string specials = "<>&\"'";
   std::string replacements[] = {"&lt;", "&gt;", "&amp;", "&#39;", "&quot;"};
   std::string result;
@@ -458,9 +500,12 @@
 };
 Indent::Indent (int _level)
   : level (_level)
-{}
+{
+  NS_LOG_FUNCTION (this << _level);
+}
 std::ostream &operator << (std::ostream &os, const Indent &val)
 {
+  NS_LOG_FUNCTION (&os << &val);
   for (int i = 0; i < val.level; i++)
     {
       os << "  ";
@@ -471,6 +516,7 @@
 void
 TestRunnerImpl::PrintReport (TestCase *test, std::ostream *os, bool xml, int level)
 {
+  NS_LOG_FUNCTION (this << test << os << xml << level);
   if (test->m_result == 0)
     {
       // Do not print reports for tests that were not run.
@@ -543,6 +589,7 @@
 void
 TestRunnerImpl::PrintHelp (const char *program_name) const
 {
+  NS_LOG_FUNCTION (this << program_name);
   std::cout << "Usage: " << program_name << " [OPTIONS]" << std::endl
             << std::endl
             << "Options: "
@@ -575,6 +622,7 @@
                                    std::list<TestCase *>::const_iterator end,
                                    bool printTestType) const
 {
+  NS_LOG_FUNCTION (this << &begin << &end << printTestType);
   std::map<TestSuite::Type, std::string> label;
 
   label[TestSuite::ALL]         = "all          ";
@@ -598,6 +646,7 @@
 void
 TestRunnerImpl::PrintTestTypeList (void) const
 {
+  NS_LOG_FUNCTION (this);
   std::cout << "  bvt:         Build Verification Tests (to see if build completed successfully)" << std::endl;
   std::cout << "  core:        Run all TestSuite-based tests (exclude examples)" << std::endl;
   std::cout << "  example:     Examples (to see if example programs run successfully)" << std::endl;
@@ -610,6 +659,7 @@
 std::list<TestCase *>
 TestRunnerImpl::FilterTests (std::string testName, enum TestSuite::Type testType) const
 {
+  NS_LOG_FUNCTION (this << testName << testType);
   std::list<TestCase *> tests;
   for (uint32_t i = 0; i < m_suites.size (); ++i)
     {
@@ -633,6 +683,7 @@
 int 
 TestRunnerImpl::Run (int argc, char *argv[])
 {
+  NS_LOG_FUNCTION (this << argc << argv);
   std::string testName = "";
   std::string testTypeString = "";
   std::string out = "";
@@ -832,6 +883,7 @@
 int 
 TestRunner::Run (int argc, char *argv[])
 {
+  NS_LOG_FUNCTION (argc << argv);
   return TestRunnerImpl::Instance ()->Run (argc, argv);
 }
 
--- a/src/core/model/time.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/time.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -26,13 +26,17 @@
 #include "string.h"
 #include "object.h"
 #include "config.h"
+#include "log.h"
 #include <cmath>
 #include <sstream>
 
 namespace ns3 {
 
+NS_LOG_COMPONENT_DEFINE ("Time");
+
 Time::Time (const std::string& s)
 {
+  NS_LOG_FUNCTION (this << &s);
   std::string::size_type n = s.find_first_not_of ("+-0123456789.");
   if (n != std::string::npos)
     { // Found non-numeric
@@ -85,6 +89,7 @@
 struct Time::Resolution
 Time::GetNsResolution (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   struct Resolution resolution;
   SetResolution (Time::NS, &resolution);
   return resolution;
@@ -92,11 +97,13 @@
 void 
 Time::SetResolution (enum Unit resolution)
 {
+  NS_LOG_FUNCTION (resolution);
   SetResolution (resolution, PeekResolution ());
 }
 void 
 Time::SetResolution (enum Unit unit, struct Resolution *resolution)
 {
+  NS_LOG_FUNCTION (unit << resolution);
   int8_t power [LAST] = { 15, 12, 9, 6, 3, 0};
   for (int i = 0; i < Time::LAST; i++)
     {
@@ -132,6 +139,7 @@
 enum Time::Unit
 Time::GetResolution (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   return PeekResolution ()->unit;
 }
 
@@ -139,6 +147,7 @@
 std::ostream&
 operator<< (std::ostream& os, const Time & time)
 {
+  NS_LOG_FUNCTION (&os << time);
   std::string unit;
   switch (Time::GetResolution ())
     {
@@ -171,6 +180,7 @@
 }
 std::istream& operator>> (std::istream& is, Time & time)
 {
+  NS_LOG_FUNCTION (&is << time);
   std::string value;
   is >> value;
   time = Time (value);
--- a/src/core/model/timer.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/timer.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -20,6 +20,9 @@
 #include "timer.h"
 #include "simulator.h"
 #include "simulation-singleton.h"
+#include "log.h"
+
+NS_LOG_COMPONENT_DEFINE ("Timer");
 
 namespace ns3 {
 
@@ -29,6 +32,7 @@
     m_event (),
     m_impl (0)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 Timer::Timer (enum DestroyPolicy destroyPolicy)
@@ -37,10 +41,12 @@
     m_event (),
     m_impl (0)
 {
+  NS_LOG_FUNCTION (this << destroyPolicy);
 }
 
 Timer::~Timer ()
 {
+  NS_LOG_FUNCTION (this);
   if (m_flags & CHECK_ON_DESTROY)
     {
       if (m_event.IsRunning ())
@@ -62,16 +68,19 @@
 void
 Timer::SetDelay (const Time &time)
 {
+  NS_LOG_FUNCTION (this << time);
   m_delay = time;
 }
 Time
 Timer::GetDelay (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_delay;
 }
 Time
 Timer::GetDelayLeft (void) const
 {
+  NS_LOG_FUNCTION (this);
   switch (GetState ())
     {
     case Timer::RUNNING:
@@ -93,31 +102,37 @@
 void
 Timer::Cancel (void)
 {
+  NS_LOG_FUNCTION (this);
   Simulator::Cancel (m_event);
 }
 void
 Timer::Remove (void)
 {
+  NS_LOG_FUNCTION (this);
   Simulator::Remove (m_event);
 }
 bool
 Timer::IsExpired (void) const
 {
+  NS_LOG_FUNCTION (this);
   return !IsSuspended () && m_event.IsExpired ();
 }
 bool
 Timer::IsRunning (void) const
 {
+  NS_LOG_FUNCTION (this);
   return !IsSuspended () && m_event.IsRunning ();
 }
 bool
 Timer::IsSuspended (void) const
 {
+  NS_LOG_FUNCTION (this);
   return (m_flags & TIMER_SUSPENDED) == TIMER_SUSPENDED;
 }
 enum Timer::State
 Timer::GetState (void) const
 {
+  NS_LOG_FUNCTION (this);
   if (IsRunning ())
     {
       return Timer::RUNNING;
@@ -136,12 +151,14 @@
 void
 Timer::Schedule (void)
 {
+  NS_LOG_FUNCTION (this);
   Schedule (m_delay);
 }
 
 void
 Timer::Schedule (Time delay)
 {
+  NS_LOG_FUNCTION (this << delay);
   NS_ASSERT (m_impl != 0);
   if (m_event.IsRunning ())
     {
@@ -153,6 +170,7 @@
 void
 Timer::Suspend (void)
 {
+  NS_LOG_FUNCTION (this);
   NS_ASSERT (IsRunning ());
   m_delayLeft = Simulator::GetDelayLeft (m_event);
   Simulator::Remove (m_event);
@@ -162,6 +180,7 @@
 void
 Timer::Resume (void)
 {
+  NS_LOG_FUNCTION (this);
   NS_ASSERT (m_flags & TIMER_SUSPENDED);
   m_event = m_impl->Schedule (m_delayLeft);
   m_flags &= ~TIMER_SUSPENDED;
--- a/src/core/model/trace-source-accessor.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/trace-source-accessor.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -18,14 +18,19 @@
  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  */
 #include "trace-source-accessor.h"
+#include "log.h"
+
+NS_LOG_COMPONENT_DEFINE ("TraceSourceAccessor");
 
 namespace ns3 {
 
 TraceSourceAccessor::TraceSourceAccessor ()
 {
+  NS_LOG_FUNCTION (this);
 }
 TraceSourceAccessor::~TraceSourceAccessor ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 } // namespace ns3
--- a/src/core/model/type-id.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/type-id.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -20,6 +20,7 @@
 #include "type-id.h"
 #include "singleton.h"
 #include "trace-source-accessor.h"
+#include "log.h"
 #include <vector>
 #include <sstream>
 
@@ -27,6 +28,8 @@
  *         Helper code
  *********************************************************************/
 
+NS_LOG_COMPONENT_DEFINE ("TypeID");
+
 namespace {
 
 class IidManager
@@ -89,11 +92,13 @@
 
 IidManager::IidManager ()
 {
+  NS_LOG_FUNCTION (this);
 }
 
 uint16_t
 IidManager::AllocateUid (std::string name)
 {
+  NS_LOG_FUNCTION (this << name);
   uint16_t j = 1;
   for (Iterator i = m_information.begin (); i != m_information.end (); i++)
     {
@@ -119,6 +124,7 @@
 struct IidManager::IidInformation *
 IidManager::LookupInformation (uint16_t uid) const
 {
+  NS_LOG_FUNCTION (this << uid);
   NS_ASSERT (uid <= m_information.size () && uid != 0);
   return const_cast<struct IidInformation *> (&m_information[uid-1]);
 }
@@ -126,6 +132,7 @@
 void 
 IidManager::SetParent (uint16_t uid, uint16_t parent)
 {
+  NS_LOG_FUNCTION (this << uid << parent);
   NS_ASSERT (parent <= m_information.size ());
   struct IidInformation *information = LookupInformation (uid);
   information->parent = parent;
@@ -133,12 +140,14 @@
 void 
 IidManager::SetGroupName (uint16_t uid, std::string groupName)
 {
+  NS_LOG_FUNCTION (this << uid << groupName);
   struct IidInformation *information = LookupInformation (uid);
   information->groupName = groupName;
 }
 void
 IidManager::HideFromDocumentation (uint16_t uid)
 {
+  NS_LOG_FUNCTION (this << uid);
   struct IidInformation *information = LookupInformation (uid);
   information->mustHideFromDocumentation = true;
 }
@@ -146,6 +155,7 @@
 void 
 IidManager::AddConstructor (uint16_t uid, ns3::Callback<ns3::ObjectBase *> callback)
 {
+  NS_LOG_FUNCTION (this << uid << &callback);
   struct IidInformation *information = LookupInformation (uid);
   if (information->hasConstructor)
     {
@@ -158,6 +168,7 @@
 uint16_t 
 IidManager::GetUid (std::string name) const
 {
+  NS_LOG_FUNCTION (this << name);
   uint32_t j = 1;
   for (Iterator i = m_information.begin (); i != m_information.end (); i++)
     {
@@ -173,18 +184,21 @@
 std::string 
 IidManager::GetName (uint16_t uid) const
 {
+  NS_LOG_FUNCTION (this << uid);
   struct IidInformation *information = LookupInformation (uid);
   return information->name;
 }
 uint16_t 
 IidManager::GetParent (uint16_t uid) const
 {
+  NS_LOG_FUNCTION (this << uid);
   struct IidInformation *information = LookupInformation (uid);
   return information->parent;
 }
 std::string 
 IidManager::GetGroupName (uint16_t uid) const
 {
+  NS_LOG_FUNCTION (this << uid);
   struct IidInformation *information = LookupInformation (uid);
   return information->groupName;
 }
@@ -192,6 +206,7 @@
 ns3::Callback<ns3::ObjectBase *> 
 IidManager::GetConstructor (uint16_t uid) const
 {
+  NS_LOG_FUNCTION (this << uid);
   struct IidInformation *information = LookupInformation (uid);
   if (!information->hasConstructor)
     {
@@ -203,6 +218,7 @@
 bool 
 IidManager::HasConstructor (uint16_t uid) const
 {
+  NS_LOG_FUNCTION (this << uid);
   struct IidInformation *information = LookupInformation (uid);
   return information->hasConstructor;
 }
@@ -210,11 +226,13 @@
 uint32_t 
 IidManager::GetRegisteredN (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_information.size ();
 }
 uint16_t 
 IidManager::GetRegistered (uint32_t i) const
 {
+  NS_LOG_FUNCTION (this << i);
   return i + 1;
 }
 
@@ -222,6 +240,7 @@
 IidManager::HasAttribute (uint16_t uid,
                           std::string name)
 {
+  NS_LOG_FUNCTION (this << uid << name);
   struct IidInformation *information  = LookupInformation (uid);
   while (true)
     {
@@ -254,6 +273,7 @@
                           ns3::Ptr<const ns3::AttributeAccessor> accessor,
                           ns3::Ptr<const ns3::AttributeChecker> checker)
 {
+  NS_LOG_FUNCTION (this << uid << name << help << flags << initialValue << accessor << checker);
   struct IidInformation *information = LookupInformation (uid);
   if (HasAttribute (uid, name))
     {
@@ -275,6 +295,7 @@
                                      uint32_t i,
                                      ns3::Ptr<const ns3::AttributeValue> initialValue)
 {
+  NS_LOG_FUNCTION (this << uid << i << initialValue);
   struct IidInformation *information = LookupInformation (uid);
   NS_ASSERT (i < information->attributes.size ());
   information->attributes[i].initialValue = initialValue;
@@ -285,12 +306,14 @@
 uint32_t 
 IidManager::GetAttributeN (uint16_t uid) const
 {
+  NS_LOG_FUNCTION (this << uid);
   struct IidInformation *information = LookupInformation (uid);
   return information->attributes.size ();
 }
 struct ns3::TypeId::AttributeInformation 
 IidManager::GetAttribute(uint16_t uid, uint32_t i) const
 {
+  NS_LOG_FUNCTION (this << uid << i);
   struct IidInformation *information = LookupInformation (uid);
   NS_ASSERT (i < information->attributes.size ());
   return information->attributes[i];
@@ -300,6 +323,7 @@
 IidManager::HasTraceSource (uint16_t uid,
                             std::string name)
 {
+  NS_LOG_FUNCTION (this << uid << name);
   struct IidInformation *information  = LookupInformation (uid);
   while (true)
     {
@@ -329,6 +353,7 @@
                             std::string help,
                             ns3::Ptr<const ns3::TraceSourceAccessor> accessor)
 {
+  NS_LOG_FUNCTION (this << uid << name << help << accessor);
   struct IidInformation *information  = LookupInformation (uid);
   if (HasTraceSource (uid, name))
     {
@@ -344,12 +369,14 @@
 uint32_t 
 IidManager::GetTraceSourceN (uint16_t uid) const
 {
+  NS_LOG_FUNCTION (this << uid);
   struct IidInformation *information = LookupInformation (uid);
   return information->traceSources.size ();
 }
 struct ns3::TypeId::TraceSourceInformation 
 IidManager::GetTraceSource(uint16_t uid, uint32_t i) const
 {
+  NS_LOG_FUNCTION (this << uid << i);
   struct IidInformation *information = LookupInformation (uid);
   NS_ASSERT (i < information->traceSources.size ());
   return information->traceSources[i];
@@ -357,6 +384,7 @@
 bool 
 IidManager::MustHideFromDocumentation (uint16_t uid) const
 {
+  NS_LOG_FUNCTION (this << uid);
   struct IidInformation *information = LookupInformation (uid);
   return information->mustHideFromDocumentation;
 }
@@ -371,6 +399,7 @@
 
 TypeId::TypeId (const char *name)
 {
+  NS_LOG_FUNCTION (this << name);
   uint16_t uid = Singleton<IidManager>::Get ()->AllocateUid (name);
   NS_ASSERT (uid != 0);
   m_tid = uid;
@@ -380,10 +409,12 @@
 TypeId::TypeId (uint16_t tid)
   : m_tid (tid)
 {
+  NS_LOG_FUNCTION (this << tid);
 }
 TypeId
 TypeId::LookupByName (std::string name)
 {
+  NS_LOG_FUNCTION (name);
   uint16_t uid = Singleton<IidManager>::Get ()->GetUid (name);
   NS_ASSERT_MSG (uid != 0, "Assert in TypeId::LookupByName: " << name << " not found");
   return TypeId (uid);
@@ -391,6 +422,7 @@
 bool
 TypeId::LookupByNameFailSafe (std::string name, TypeId *tid)
 {
+  NS_LOG_FUNCTION (name << tid);
   uint16_t uid = Singleton<IidManager>::Get ()->GetUid (name);
   if (uid == 0)
     {
@@ -403,17 +435,20 @@
 uint32_t 
 TypeId::GetRegisteredN (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   return Singleton<IidManager>::Get ()->GetRegisteredN ();
 }
 TypeId 
 TypeId::GetRegistered (uint32_t i)
 {
+  NS_LOG_FUNCTION (i);
   return TypeId (Singleton<IidManager>::Get ()->GetRegistered (i));
 }
 
 bool
 TypeId::LookupAttributeByName (std::string name, struct TypeId::AttributeInformation *info) const
 {
+  NS_LOG_FUNCTION (this << name << info);
   TypeId tid;
   TypeId nextTid = *this;
   do {
@@ -435,30 +470,35 @@
 TypeId 
 TypeId::SetParent (TypeId tid)
 {
+  NS_LOG_FUNCTION (this << tid);
   Singleton<IidManager>::Get ()->SetParent (m_tid, tid.m_tid);
   return *this;
 }
 TypeId 
 TypeId::SetGroupName (std::string groupName)
 {
+  NS_LOG_FUNCTION (this << groupName);
   Singleton<IidManager>::Get ()->SetGroupName (m_tid, groupName);
   return *this;
 }
 TypeId 
 TypeId::GetParent (void) const
 {
+  NS_LOG_FUNCTION (this);
   uint16_t parent = Singleton<IidManager>::Get ()->GetParent (m_tid);
   return TypeId (parent);
 }
 bool 
 TypeId::HasParent (void) const
 {
+  NS_LOG_FUNCTION (this);
   uint16_t parent = Singleton<IidManager>::Get ()->GetParent (m_tid);
   return parent != m_tid;
 }
 bool 
 TypeId::IsChildOf (TypeId other) const
 {
+  NS_LOG_FUNCTION (this << other);
   TypeId tmp = *this;
   while (tmp != other && tmp != tmp.GetParent ())
     {
@@ -469,6 +509,7 @@
 std::string 
 TypeId::GetGroupName (void) const
 {
+  NS_LOG_FUNCTION (this);
   std::string groupName = Singleton<IidManager>::Get ()->GetGroupName (m_tid);
   return groupName;
 }
@@ -476,6 +517,7 @@
 std::string 
 TypeId::GetName (void) const
 {
+  NS_LOG_FUNCTION (this);
   std::string name = Singleton<IidManager>::Get ()->GetName (m_tid);
   return name;
 }
@@ -483,6 +525,7 @@
 bool 
 TypeId::HasConstructor (void) const
 {
+  NS_LOG_FUNCTION (this);
   bool hasConstructor = Singleton<IidManager>::Get ()->HasConstructor (m_tid);
   return hasConstructor;
 }
@@ -490,6 +533,7 @@
 void
 TypeId::DoAddConstructor (Callback<ObjectBase *> cb)
 {
+  NS_LOG_FUNCTION (this << &cb);
   Singleton<IidManager>::Get ()->AddConstructor (m_tid, cb);
 }
 
@@ -500,6 +544,7 @@
                       Ptr<const AttributeAccessor> accessor,
                       Ptr<const AttributeChecker> checker)
 {
+  NS_LOG_FUNCTION (this << name << help << &initialValue << accessor << checker);
   Singleton<IidManager>::Get ()->AddAttribute (m_tid, name, help, ATTR_SGC, initialValue.Copy (), accessor, checker);
   return *this;
 }
@@ -512,6 +557,7 @@
                       Ptr<const AttributeAccessor> accessor,
                       Ptr<const AttributeChecker> checker)
 {
+  NS_LOG_FUNCTION (this << name << help << flags << &initialValue << accessor << checker);
   Singleton<IidManager>::Get ()->AddAttribute (m_tid, name, help, flags, initialValue.Copy (), accessor, checker);
   return *this;
 }
@@ -520,6 +566,7 @@
 TypeId::SetAttributeInitialValue(uint32_t i, 
                                  Ptr<const AttributeValue> initialValue)
 {
+  NS_LOG_FUNCTION (this << i << initialValue);
   Singleton<IidManager>::Get ()->SetAttributeInitialValue (m_tid, i, initialValue);
   return true;
 }
@@ -528,6 +575,7 @@
 Callback<ObjectBase *> 
 TypeId::GetConstructor (void) const
 {
+  NS_LOG_FUNCTION (this);
   Callback<ObjectBase *>  cb = Singleton<IidManager>::Get ()->GetConstructor (m_tid);
   return cb;
 }
@@ -535,6 +583,7 @@
 bool 
 TypeId::MustHideFromDocumentation (void) const
 {
+  NS_LOG_FUNCTION (this);
   bool mustHide = Singleton<IidManager>::Get ()->MustHideFromDocumentation (m_tid);
   return mustHide;
 }
@@ -542,17 +591,20 @@
 uint32_t 
 TypeId::GetAttributeN (void) const
 {
+  NS_LOG_FUNCTION (this);
   uint32_t n = Singleton<IidManager>::Get ()->GetAttributeN (m_tid);
   return n;
 }
 struct TypeId::AttributeInformation 
 TypeId::GetAttribute(uint32_t i) const
 {
+  NS_LOG_FUNCTION (this << i);
   return Singleton<IidManager>::Get ()->GetAttribute(m_tid, i);
 }
 std::string 
 TypeId::GetAttributeFullName (uint32_t i) const
 {
+  NS_LOG_FUNCTION (this << i);
   struct TypeId::AttributeInformation info = GetAttribute(i);
   return GetName () + "::" + info.name;
 }
@@ -560,11 +612,13 @@
 uint32_t 
 TypeId::GetTraceSourceN (void) const
 {
+  NS_LOG_FUNCTION (this);
   return Singleton<IidManager>::Get ()->GetTraceSourceN (m_tid);
 }
 struct TypeId::TraceSourceInformation 
 TypeId::GetTraceSource(uint32_t i) const
 {
+  NS_LOG_FUNCTION (this << i);
   return Singleton<IidManager>::Get ()->GetTraceSource(m_tid, i);
 }
 
@@ -573,6 +627,7 @@
                         std::string help,
                         Ptr<const TraceSourceAccessor> accessor)
 {
+  NS_LOG_FUNCTION (this << name << help << accessor);
   Singleton<IidManager>::Get ()->AddTraceSource (m_tid, name, help, accessor);
   return *this;
 }
@@ -580,6 +635,7 @@
 TypeId 
 TypeId::HideFromDocumentation (void)
 {
+  NS_LOG_FUNCTION (this);
   Singleton<IidManager>::Get ()->HideFromDocumentation (m_tid);
   return *this;
 }
@@ -588,6 +644,7 @@
 Ptr<const TraceSourceAccessor> 
 TypeId::LookupTraceSourceByName (std::string name) const
 {
+  NS_LOG_FUNCTION (this << name);
   TypeId tid;
   TypeId nextTid = *this;
   do {
@@ -608,21 +665,25 @@
 uint16_t 
 TypeId::GetUid (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_tid;
 }
 void 
 TypeId::SetUid (uint16_t tid)
 {
+  NS_LOG_FUNCTION (this << tid);
   m_tid = tid;
 }
 
 std::ostream & operator << (std::ostream &os, TypeId tid)
 {
+  NS_LOG_FUNCTION (&os << &tid);
   os << tid.GetName ();
   return os;
 }
 std::istream & operator >> (std::istream &is, TypeId &tid)
 {
+  NS_LOG_FUNCTION (&is << &tid);
   std::string tidString;
   is >> tidString;
   bool ok = TypeId::LookupByNameFailSafe (tidString, &tid);
@@ -638,6 +699,7 @@
 
 bool operator < (TypeId a, TypeId b)
 {
+  NS_LOG_FUNCTION (a << b);
   return a.m_tid < b.m_tid;
 }
 
--- a/src/core/model/uinteger.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/uinteger.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -19,8 +19,11 @@
  */
 #include "uinteger.h"
 #include "fatal-error.h"
+#include "log.h"
 #include <sstream>
 
+NS_LOG_COMPONENT_DEFINE ("Uinteger");
+
 namespace ns3 {
 
 ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME (uint64_t,Uinteger);
@@ -29,6 +32,7 @@
 
 Ptr<const AttributeChecker> MakeUintegerChecker (uint64_t min, uint64_t max, std::string name)
 {
+  NS_LOG_FUNCTION (min << max << name);
   struct Checker : public AttributeChecker
   {
     Checker (uint64_t minValue, uint64_t maxValue, std::string name)
@@ -36,6 +40,7 @@
         m_maxValue (maxValue),
         m_name (name) {}
     virtual bool Check (const AttributeValue &value) const {
+      NS_LOG_FUNCTION (&value);
       const UintegerValue *v = dynamic_cast<const UintegerValue *> (&value);
       if (v == 0)
         {
@@ -44,20 +49,25 @@
       return v->Get () >= m_minValue && v->Get () <= m_maxValue;
     }
     virtual std::string GetValueTypeName (void) const {
+      NS_LOG_FUNCTION_NOARGS ();
       return "ns3::UintegerValue";
     }
     virtual bool HasUnderlyingTypeInformation (void) const {
+      NS_LOG_FUNCTION_NOARGS ();
       return true;
     }
     virtual std::string GetUnderlyingTypeInformation (void) const {
+      NS_LOG_FUNCTION_NOARGS ();
       std::ostringstream oss;
       oss << m_name << " " << m_minValue << ":" << m_maxValue;
       return oss.str ();
     }
     virtual Ptr<AttributeValue> Create (void) const {
+      NS_LOG_FUNCTION_NOARGS ();
       return ns3::Create<UintegerValue> ();
     }
     virtual bool Copy (const AttributeValue &source, AttributeValue &destination) const {
+      NS_LOG_FUNCTION (&source << &destination);
       const UintegerValue *src = dynamic_cast<const UintegerValue *> (&source);
       UintegerValue *dst = dynamic_cast<UintegerValue *> (&destination);
       if (src == 0 || dst == 0)
--- a/src/core/model/unix-fd-reader.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/unix-fd-reader.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -40,17 +40,20 @@
   : m_fd (-1), m_readCallback (0), m_readThread (0), m_stop (false),
     m_destroyEvent ()
 {
+  NS_LOG_FUNCTION (this);
   m_evpipe[0] = -1;
   m_evpipe[1] = -1;
 }
 
 FdReader::~FdReader ()
 {
+  NS_LOG_FUNCTION (this);
   Stop ();
 }
 
 void FdReader::Start (int fd, Callback<void, uint8_t *, ssize_t> readCallback)
 {
+  NS_LOG_FUNCTION (this << fd << &readCallback);
   int tmp;
 
   NS_ASSERT_MSG (m_readThread == 0, "read thread already exists");
@@ -102,12 +105,14 @@
 
 void FdReader::DestroyEvent (void)
 {
+  NS_LOG_FUNCTION (this);
   Stop ();
   this->Unref ();
 }
 
 void FdReader::Stop (void)
 {
+  NS_LOG_FUNCTION (this);
   m_stop = true;
 
   // signal the read thread
@@ -149,6 +154,7 @@
 // This runs in a separate thread
 void FdReader::Run (void)
 {
+  NS_LOG_FUNCTION (this);
   int nfds;
   fd_set rfds;
 
--- a/src/core/model/unix-system-condition.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/unix-system-condition.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -51,7 +51,7 @@
 
 SystemConditionPrivate::SystemConditionPrivate ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
 
   m_condition = false;
 
@@ -76,7 +76,7 @@
 
 SystemConditionPrivate::~SystemConditionPrivate() 
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   pthread_mutex_destroy (&m_mutex);
   pthread_cond_destroy (&m_cond);
 }
@@ -84,21 +84,21 @@
 void
 SystemConditionPrivate::SetCondition (bool condition)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this << condition);
   m_condition = condition;
 }
 	
 bool
 SystemConditionPrivate::GetCondition (void)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   return m_condition;
 }
 	
 void
 SystemConditionPrivate::Signal (void)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
 
   pthread_mutex_lock (&m_mutex);
   pthread_cond_signal (&m_cond);
@@ -108,7 +108,7 @@
 void
 SystemConditionPrivate::Broadcast (void)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
 
   pthread_mutex_lock (&m_mutex);
   pthread_cond_broadcast (&m_cond);
@@ -118,7 +118,7 @@
 void
 SystemConditionPrivate::Wait (void)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
 
   pthread_mutex_lock (&m_mutex);
   m_condition = false;
@@ -132,7 +132,7 @@
 bool
 SystemConditionPrivate::TimedWait (uint64_t ns)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this << ns);
 
   struct timespec ts;
   ts.tv_sec = ns / NS_PER_SEC;
@@ -168,54 +168,54 @@
 SystemCondition::SystemCondition() 
   : m_priv (new SystemConditionPrivate ())
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);;
 }
 
 SystemCondition::~SystemCondition () 
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   delete m_priv;
 }
 
 void
 SystemCondition::SetCondition (bool condition) 
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this << condition);
   m_priv->SetCondition (condition);
 }
 
 bool
 SystemCondition::GetCondition (void) 
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   return m_priv->GetCondition ();
 }
 
 void
 SystemCondition::Signal (void) 
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   m_priv->Signal ();
 }
 
 void
 SystemCondition::Broadcast (void) 
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   m_priv->Broadcast ();
 }
 
 void
 SystemCondition::Wait (void) 
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   m_priv->Wait ();
 }
 
 bool
 SystemCondition::TimedWait (uint64_t ns) 
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this << ns);
   return m_priv->TimedWait (ns);
 }
 
--- a/src/core/model/unix-system-mutex.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/unix-system-mutex.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -44,7 +44,7 @@
 
 SystemMutexPrivate::SystemMutexPrivate ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
 
   pthread_mutexattr_t attr;
   pthread_mutexattr_init (&attr);
@@ -67,14 +67,14 @@
 
 SystemMutexPrivate::~SystemMutexPrivate() 
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   pthread_mutex_destroy (&m_mutex);
 }
 	
 void
 SystemMutexPrivate::Lock (void)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
 
   int rc = pthread_mutex_lock (&m_mutex);
   if (rc != 0) 
@@ -88,7 +88,7 @@
 void
 SystemMutexPrivate::Unlock (void) 
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
 
   int rc = pthread_mutex_unlock (&m_mutex);
   if (rc != 0)
@@ -102,39 +102,39 @@
 SystemMutex::SystemMutex() 
   : m_priv (new SystemMutexPrivate ())
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
 }
 
 SystemMutex::~SystemMutex() 
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   delete m_priv;
 }
 
 void
 SystemMutex::Lock ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   m_priv->Lock ();
 }
 
 void
 SystemMutex::Unlock ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   m_priv->Unlock ();
 }
 
 CriticalSection::CriticalSection (SystemMutex &mutex)
   : m_mutex (mutex)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this << &mutex);
   m_mutex.Lock ();
 }
 
 CriticalSection::~CriticalSection ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
   m_mutex.Unlock ();
 }
 
--- a/src/core/model/unix-system-wall-clock-ms.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/unix-system-wall-clock-ms.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -20,9 +20,12 @@
 
 #include "system-wall-clock-ms.h"
 #include "abort.h"
+#include "log.h"
 #include <sys/times.h>
 #include <unistd.h>
 
+NS_LOG_COMPONENT_DEFINE ("SystemWallClockMsPrivate");
+
 namespace ns3 {
 
 class SystemWallClockMsPrivate {
@@ -44,6 +47,7 @@
 void 
 SystemWallClockMsPrivate::Start (void)
 {
+  NS_LOG_FUNCTION (this);
   m_startTime = times (&m_startTimes);
 }
 
@@ -76,6 +80,7 @@
   // time is measured that turns out to be less than a millisecond, we'll just 
   // return zero which would, I think, also will be expected.
   //
+  NS_LOG_FUNCTION (this);
   static int64_t ticksPerSecond = sysconf (_SC_CLK_TCK);
   static double millisecondsPerTick = 1000. / ticksPerSecond;
 
@@ -104,28 +109,33 @@
 int64_t
 SystemWallClockMsPrivate::GetElapsedReal (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_elapsedReal;
 }
 
 int64_t
 SystemWallClockMsPrivate::GetElapsedUser (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_elapsedUser;
 }
 
 int64_t
 SystemWallClockMsPrivate::GetElapsedSystem (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_elapsedSystem;
 }
 
 SystemWallClockMs::SystemWallClockMs ()
   : m_priv (new SystemWallClockMsPrivate ())
 {
+  NS_LOG_FUNCTION (this);
 }
 
 SystemWallClockMs::~SystemWallClockMs ()
 {
+  NS_LOG_FUNCTION (this);
   delete m_priv;
   m_priv = 0;
 }
@@ -133,30 +143,35 @@
 void
 SystemWallClockMs::Start (void)
 {
+  NS_LOG_FUNCTION (this);
   m_priv->Start ();
 }
 
 int64_t
 SystemWallClockMs::End (void)
 {
+  NS_LOG_FUNCTION (this);
   return m_priv->End ();
 }
 
 int64_t
 SystemWallClockMs::GetElapsedReal (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_priv->GetElapsedReal ();
 }
 
 int64_t
 SystemWallClockMs::GetElapsedUser (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_priv->GetElapsedUser ();
 }
 
 int64_t
 SystemWallClockMs::GetElapsedSystem (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_priv->GetElapsedSystem ();
 }
 
--- a/src/core/model/vector.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/vector.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -19,9 +19,12 @@
  */
 #include "vector.h"
 #include "fatal-error.h"
+#include "log.h"
 #include <cmath>
 #include <sstream>
 
+NS_LOG_COMPONENT_DEFINE ("Vector");
+
 namespace ns3 {
 
 ATTRIBUTE_HELPER_CPP (Vector3D);
@@ -29,6 +32,7 @@
 // compatibility for mobility code
 Ptr<const AttributeChecker> MakeVectorChecker (void)
 {
+  NS_LOG_FUNCTION_NOARGS ();
   return MakeVector3DChecker ();
 }
 
@@ -38,6 +42,7 @@
     y (_y),
     z (_z)
 {
+  NS_LOG_FUNCTION (this << _x << _y << _z);
 }
 
 Vector3D::Vector3D ()
@@ -45,23 +50,27 @@
     y (0.0),
     z (0.0)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 Vector2D::Vector2D (double _x, double _y)
   : x (_x),
     y (_y)
 {
+  NS_LOG_FUNCTION (this << _x << _y);
 }
 
 Vector2D::Vector2D ()
   : x (0.0),
     y (0.0)
 {
+  NS_LOG_FUNCTION (this);
 }
 
 double
 CalculateDistance (const Vector3D &a, const Vector3D &b)
 {
+  NS_LOG_FUNCTION (a << b);
   double dx = b.x - a.x;
   double dy = b.y - a.y;
   double dz = b.z - a.z;
@@ -71,6 +80,7 @@
 double 
 CalculateDistance (const Vector2D &a, const Vector2D &b)
 {
+  NS_LOG_FUNCTION (a << b);
   double dx = b.x - a.x;
   double dy = b.y - a.y;
   double distance = std::sqrt (dx * dx + dy * dy);
@@ -79,11 +89,13 @@
 
 std::ostream &operator << (std::ostream &os, const Vector3D &vector)
 {
+  NS_LOG_FUNCTION (&os << vector);
   os << vector.x << ":" << vector.y << ":" << vector.z;
   return os;
 }
 std::istream &operator >> (std::istream &is, Vector3D &vector)
 {
+  NS_LOG_FUNCTION (&is << vector);
   char c1, c2;
   is >> vector.x >> c1 >> vector.y >> c2 >> vector.z;
   if (c1 != ':' ||
@@ -95,11 +107,13 @@
 }
 std::ostream &operator << (std::ostream &os, const Vector2D &vector)
 {
+  NS_LOG_FUNCTION (&os << vector);
   os << vector.x << ":" << vector.y;
   return os;
 }
 std::istream &operator >> (std::istream &is, Vector2D &vector)
 {
+  NS_LOG_FUNCTION (&is << vector);
   char c1;
   is >> vector.x >> c1 >> vector.y;
   if (c1 != ':')
--- 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)
--- a/src/core/model/watchdog.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/watchdog.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -18,6 +18,9 @@
  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  */
 #include "watchdog.h"
+#include "log.h"
+
+NS_LOG_COMPONENT_DEFINE ("Watchdog");
 
 namespace ns3 {
 
@@ -26,16 +29,19 @@
     m_event (),
     m_end (MicroSeconds (0))
 {
+  NS_LOG_FUNCTION_NOARGS ();
 }
 
 Watchdog::~Watchdog ()
 {
+  NS_LOG_FUNCTION (this);
   delete m_impl;
 }
 
 void
 Watchdog::Ping (Time delay)
 {
+  NS_LOG_FUNCTION (this << delay);
   Time end = Simulator::Now () + delay;
   m_end = std::max (m_end, end);
   if (m_event.IsRunning ())
@@ -48,6 +54,7 @@
 void
 Watchdog::Expire (void)
 {
+  NS_LOG_FUNCTION (this);
   if (m_end == Simulator::Now ())
     {
       m_impl->Invoke ();
--- a/src/core/model/win32-system-wall-clock-ms.cc	Sat Nov 10 18:45:37 2012 +0100
+++ b/src/core/model/win32-system-wall-clock-ms.cc	Sat Nov 10 19:16:38 2012 +0100
@@ -42,6 +42,7 @@
 void 
 SystemWallClockMsPrivate::Start (void)
 {
+  NS_LOG_FUNCTION (this);
   m_startTime = std::clock ();
 }
 
@@ -74,6 +75,7 @@
   // time is measured that turns out to be less than a millisecond, we'll just 
   // return zero which would, I think, also will be expected.
   //
+  NS_LOG_FUNCTION (this);
   static int64_t ticksPerSecond = CLOCKS_PER_SEC;
   static double millisecondsPerTick = 1000. / ticksPerSecond;
 
@@ -96,28 +98,33 @@
 int64_t
 SystemWallClockMsPrivate::GetElapsedReal (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_elapsedReal;
 }
 
 int64_t
 SystemWallClockMsPrivate::GetElapsedUser (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_elapsedUser;
 }
 
 int64_t
 SystemWallClockMsPrivate::GetElapsedSystem (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_elapsedSystem;
 }
 
 SystemWallClockMs::SystemWallClockMs ()
   : m_priv (new SystemWallClockMsPrivate ())
 {
+  NS_LOG_FUNCTION (this);
 }
 
 SystemWallClockMs::~SystemWallClockMs ()
 {
+  NS_LOG_FUNCTION (this);
   delete m_priv;
   m_priv = 0;
 }
@@ -125,30 +132,35 @@
 void
 SystemWallClockMs::Start (void)
 {
+  NS_LOG_FUNCTION (this);
   m_priv->Start ();
 }
 
 int64_t
 SystemWallClockMs::End (void)
 {
+  NS_LOG_FUNCTION (this);
   return m_priv->End ();
 }
 
 int64_t
 SystemWallClockMs::GetElapsedReal (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_priv->GetElapsedReal ();
 }
 
 int64_t
 SystemWallClockMs::GetElapsedUser (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_priv->GetElapsedUser ();
 }
 
 int64_t
 SystemWallClockMs::GetElapsedSystem (void) const
 {
+  NS_LOG_FUNCTION (this);
   return m_priv->GetElapsedSystem ();
 }