How do I enable code profiling in ns-3 ?

286 views
Skip to first unread message

gglggl

unread,
Jun 8, 2010, 12:44:41 AM6/8/10
to ns-3-users
Can someone give me details on how to enable profiling with ns-3.6,
not obvious from the waf command line options.
I'm using Mac OS X 10.5.8 on Intel.
Thanks,
G

Julien Mineraud

unread,
Jun 8, 2010, 9:41:15 AM6/8/10
to ns-3-users
Hi,

What you can do is too configure ns-3 to optimized
CXXFLAGS='-g' ./waf configure -d optimized
then build: ./waf build
then use valgring: ./waf --run yourprogam --command-template="valgrind
--tool=callgrind --time-stamp=yes %s"

Then you should get a file callgrind.out.xxxxx.
After you need a program to visualise the result file, such as
KCachegrind.

For mac OS X:
http://kcachegrind.darwinports.com/
http://www.maccallgrind.com/
http://sourceforge.net/projects/ccg/

I am not on Mac OS X so I didnt try any of those.

Regards

Julien

gglggl

unread,
Jun 8, 2010, 11:58:23 AM6/8/10
to ns-3-users
Thanks but when I add the --command-template arguments I get an error
saying my program can't be found - is this the correct syntax ? :

./waf --run "scratch/mywifi-simple-adhoc4 --numPackets=10 --
distance=650" --command-template="valgrind--tool=callgrind --time-
stamp=yes %s"



On Jun 8, 6:41 am, Julien Mineraud <julien.miner...@gmail.com> wrote:
> Hi,
>
> What you can do is too configure ns-3 to optimized
> CXXFLAGS='-g' ./waf configure -d optimized
> then build: ./waf build
> then use valgring: ./waf --run yourprogam --command-template="valgrind
> --tool=callgrind --time-stamp=yes %s"
>
> Then you should get a file callgrind.out.xxxxx.
> After you need a program to visualise the result file, such as
> KCachegrind.
>
> For mac OS X:http://kcachegrind.darwinports.com/http://www.maccallgrind.com/http://sourceforge.net/projects/ccg/

Gustavo Carneiro

unread,
Jun 8, 2010, 12:49:31 PM6/8/10
to ns-3-...@googlegroups.com
On Tue, Jun 8, 2010 at 16:58, gglggl <ggl...@gmail.com> wrote:
Thanks but when I add the --command-template arguments I get an error
saying my program can't be found - is this the correct syntax ? :

./waf --run "scratch/mywifi-simple-adhoc4 --numPackets=10 --
distance=650" --command-template="valgrind--tool=callgrind --time-
stamp=yes %s"


I think you should not pass arguments inside the --run option, in this case. put them inside the --command-template instead.  Try this:

./waf --run "scratch/mywifi-simple-adhoc4" --command-template="valgrind --tool=callgrind --time-stamp=yes %s --numPackets=10 --distance=650"
 


On Jun 8, 6:41 am, Julien Mineraud <julien.miner...@gmail.com> wrote:
> Hi,
>
> What you can do is too configure ns-3 to optimized
> CXXFLAGS='-g' ./waf configure -d optimized
> then build: ./waf build
> then use valgring: ./waf --run yourprogam --command-template="valgrind
> --tool=callgrind --time-stamp=yes %s"
>
> Then you should get a file callgrind.out.xxxxx.
> After you need a program to visualise the result file, such as
> KCachegrind.
>
> For mac OS X:http://kcachegrind.darwinports.com/http://www.maccallgrind.com/http://sourceforge.net/projects/ccg/
>
> I am not on Mac OS X so I didnt try any of those.
>
> Regards
>
> Julien
>
> On 8 juin, 05:44, gglggl <ggl...@gmail.com> wrote:
>
> > Can someone give me details on how to enable profiling with ns-3.6,
> > not obvious from the waf command line options.
> > I'm using Mac OS X 10.5.8 on Intel.
> > Thanks,
> > G
>
>

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.




--
Gustavo J. A. M. Carneiro
INESC Porto, UTM, WiN, http://win.inescporto.pt/gjc
"The universe is always one step beyond logic." -- Frank Herbert

Andrey Mazo

unread,
Jun 8, 2010, 5:31:38 PM6/8/10
to ns-3-users

On Jun 8, 5:41 pm, Julien Mineraud <julien.miner...@gmail.com> wrote:
> What you can do is too configure ns-3 to optimized
> CXXFLAGS='-g' ./waf configure -d optimized
> then build: ./waf build
> then use valgring: ./waf --run yourprogam --command-template="valgrind
> --tool=callgrind --time-stamp=yes %s"
I think, you can safely drop the CXXFLAGS assignment, because
optimized version is built with -g option on its own.
Reply all
Reply to author
Forward
0 new messages