Hi,
as far as I know, ns-3 doesn't have an option to create pg
option-ed binaries.
easier way to do it without concerning any headers and
libraries dependencies is to modify waf build script,
wscript.
you can modify 'wscript' file by hands and add '-pg' option
to compile and link flags.
you can refer how --enable-gcov option is handled and add
proper options to compiler/linker.
http://code.nsnam.org/ns-3-dev/file/b4e0285d2f22/wscript#l300
# though this option is now broken for a while.
https://www.nsnam.org/bugzilla/show_bug.cgi?id=1583
I think the followings are what you need to edit.
env.append_value('CCFLAGS', '-pg')
env.append_value('CXXFLAGS', '-pg')
env.append_value('LINKFLAGS', '-pg')
-- Hajime
At Wed, 13 Nov 2013 16:00:47 -0800 (PST),
negs wrote:
>
> [1 <text/plain; ISO-8859-1 (7bit)>]
> 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?
> Hoa can i enable profiling while comipiling my ns3.18 code?
>
> --
> You received this message because you are subscribed to the Google Groups "ns-3-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
ns-3-users+...@googlegroups.com.
> To post to this group, send email to
ns-3-...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/ns-3-users.
> For more options, visit
https://groups.google.com/groups/opt_out.
> [2 <text/html; ISO-8859-1 (quoted-printable)>]
>