[Ns-developers] code, tools, facilities and debuging helpers in pedro estrela web page
Pedro Vale Estrela
pedro.estrela at gmail.com
Mon Aug 20 05:02:45 PDT 2007
I've taken this opportunity to describe the most useful ones that can be
integrated in NS2, and post this info both in the mailing list and in my
page. If anybody has any problem using these facilities, do not hesitate in
asking for assistance!
Regards,
Pedro Estrela
http://tagus.inesc-id.pt/~pestrela/ns2
PS: sorry for the double post, now it has the correct subject line.
-------
a) A very simple, no frills, Getopt-inspired argument processing, which
supports short arguments in any order and precedence in a very simple way
http://tagus.inesc-id.pt/~pestrela/ns2/contributed_code.html#_Toc147652228
useful for testing many parameters manually., eg:
> ns -- -s 10 <more args>
> ns -- -s 10 <more args> -s 20
being the array opt(speed) changed with the last given argument (-s).
b) Several useful short TCL procs, mentioned in
http://tagus.inesc-id.pt/~pestrela/ns2/contributed_code.html#_Toc147652229
of these I can point as the most useful:
proc static {varname {initval 0}} {
proc incr { name {value 1 } } {
Class instproc instances {} {
Class instproc subclass {} {
Class instproc vars {} {
proc trace_annotate_time { str { doprint 1 } } {
Simulator instproc set-animation-rate { rate } {
c) Hierarchical addresses procs:
I've made a set of helper functions that enabled me to easily convert from
each type of address that a node can have, where the value "-1" in an error
/ unk.
## Type | VarNames | C++ type | TCL |
Example | Error / UNK
##
-----------------------|-------------|-----------|----------------|---------
----|--------------
## Node's handle | N_handle | char * | string |
"_o89" | "-1"
## String HierAddress | N_haddr | char * | string |
"1.2.3" | "-1"
## 32 bit Address | N_iaddr | int | int in string | 6144
| -1
## Sequential ID | N_id | int | int in string | 4
| -1
eg: I've made tcl and C++ functions called iaddr2handle(),handle2haddr(),
etc that can be used in sequence anytime that an address conversion is
required in the code (which in my case was very common).
note that that these functions depend on a small modification in
/tcl/lib/ns-lib.tcl Simulator Node {}, to make sure that all nodes (wired
and wireless) get inside the Simulator::Node_ array.
d) the oTCL debugging facilities.
Using the TK support, it is very easy to add the MASH inspector, which is a
powerful oTCL object inspector. (and also the TKCON console, for a nicer
console).
http://tagus.inesc-id.pt/~pestrela/ns2/ns2_with_tkcon_and_tcldebug_screensho
t2.PNG
However, note that this only enables debugging at NS zero-time; for run-time
debugging, its required to install the Tcl debugger, with some modifications
of mine described in the last steps of the guide.
I've also got C++ helper and debugging functions in
http://tagus.inesc-id.pt/~pestrela/ns2/files/utils_ns.h
some examples of very useful helper functions for calling TCL code inside
C++, which was very common in my case:
#define CUR_TIME Scheduler::instance().clock()
#define MY_ADDR Address::instance().get_nodeaddr(addr())
#define TCL_RESULT Tcl::instance().result()
#define PRINT_NODEADDR(X) Address::instance().print_nodeaddr(X)
#define TCL_EVALF Tcl::instance().evalf
// prototypes
int dprintf (const char *format, ...);
int dTCL_EVALF (const char *format, ...);
int dTCL_EVALFr (const char *format, ...);
int TCL_EVALFr (const char *format, ...);
On 8/15/07, Tom Henderson <tomh at tomh.org> wrote:
Pedro,
I just committed your step2 patch for enabling Tk. So far, I've only
tested it on Linux i386.
I am quite impressed with your ns-2 page, by the way. Feel free to
suggest other things that you think would help the simulator. I will
try to repost your gathered information on the wiki at some point.
Regards,
Tom
-------- Original Message --------
Subject: [Nsnam-commits] ns-2 CHANGES.html
Date: Tue, 14 Aug 2007 22:51:00 -0700
From: Tom Henderson < tom_henderson at users.sourceforge.net>
To: nsnam-commits at lists.sourceforge.net
Update of /cvsroot/nsnam/ns-2
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23814
Modified Files:
CHANGES.html
Log Message:
Update CHANGES.html
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Nsnam-commits mailing list
Nsnam-commits at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nsnam-commits
More information about the Ns-developers
mailing list