[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Debug switch in agents, links etc.
Hi ns developers,
I found debugging switches in ns agents not very convenient to use.
I mean preprocessor directives like #ifdef DEBUGSACK1A.
In my developing version of ns I use class data integer variable
debug_ included in agent and other classes I want to debug.
In tcl scripts I have acces to this variable by set command, like:
[ns link $k1 $r1] set debug 0
$tcp1 set debug 1
[$k1 agent 0] set debug 2
This gives also a flexibily in debug levels.
0 - no debug printouts
1 - least debug
etc.
In agents I have debug switches like
if( debug_ > 0 ) printf("SACK/TCP got ACK %d\n",pkt->seqno_);
if( debug_ > 1 ) printf("reset RETX timer\n");
etc.
This technique allows dynamically switch debugging printouts without
recompiling ns. The only disadvantage is a bit enlarged size of
non-developed version of ns,
which can be avoided using one general directive #ifdef DEBUG_NS
If someone needs more information please e-mail me.
Ihor Strutynskyj.