[Ns-developers] log time -> log context

Gustavo Carneiro gjcarneiro at gmail.com
Sat May 17 14:13:18 PDT 2008


I am unhappy about current logging.  As I reported some weeks ago, I miss
the node number in logging messages, among other things.

The repository gjc/ns-3-log-context I am (slowly) uploading tries to provide
that.  First it renames LogTimePrinter to LogContextPrinter and so on.
Then  it adds Simulator::SetCurrentNode (int32_t nodeId) method (and some
other related methods).  This method is to be called when the simulation is
changing current node, for some reason.  The most common reason is a
NetDevice receiving a packet.  Also EvenImpl receives a new nodeId attribute
(32 bits), so that when a node "schedules" an event, when the event is
actually run Simulator::SetCurrentNode is called with that nodeId.

This patch is barely tested, so be warned.  It doesn't seem to work 100%;
I'll have to figure out why later.

What I regret most is adding 32 bits to EventImpl.  But maybe we can live
with additional 32 bits per event, I don't know.  Additionally, these 32
bits could be added only for debug builds and removed from optimized builds;
after all, it is only used for logging, so...

Comments?

-- 
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert


More information about the Ns-developers mailing list