How to use gprof to profile ns3.18 code

143 views
Skip to first unread message

negs

unread,
Nov 13, 2013, 7:07:06 PM11/13/13
to ns-3-...@googlegroups.com
I am using NS3.18 running on a redhat 4.4.6-4. I have gcc version 4.4.6. Recently, i added a new feature to my code and the simulation has become really slow.I want to use the gnuprof tool to check what part of the code is the cause of slow speed.
I usually build a cc file using the command - ./waf --run filename and it works fine. According to the instructions mentioned on the gnuprof page -http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html and http://www.ibm.com/developerworks/library/l-gnuprof.html , i need to simply specify `-pg' in addition to the usual options. The same option, `-pg', alters either compilation or linking to do what is necessary for profiling but when i use the command "./waf --run filename -pg" i get the following error - "waf:error:no such option : -g"

And when i try the command "gcc filename.cc -pg -o filename" i get a lot of errors stating many variables in the file have not been declared.

If i build with waf everything builds but i am unable to use gnuprof and when i try to compile with gcc giving -pg option i get errors.
Could you please tell me how i could use gnuprof with waf or how i could use gcc without getting the errors?
How can i enable profiling while comipiling my ns3.18 code?
Reply all
Reply to author
Forward
0 new messages