[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: g++ and library optimisations
From: |
Dave Steffen |
Subject: |
Re: g++ and library optimisations |
Date: |
14 May 2007 10:33:36 -0600 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
pemo <peet.morris@gmail.com> writes:
> On May 13, 4:34 pm, Paul Pluzhnikov <ppluzhnikov-...@charter.net>
[...]
>
> Could you clarify it's neither a .h/.cpp? The source code behind the
> vector template has to be compiled, and thus found. Intuitively, I
> would expect this be be in some include path, i.e., as vector is
> included in her source, the template boiler plate has also to be
> 'included' somehow. This seems *not* to be the case however, so I'm
> curious as to how the code 'arrives' for compilation.
The code is there, almost certainly in a file called "vector" (no .h
or .cpp suffix). That file almost certainly #includes some others
that you'll want to look at. But again, it's not compiled into a
library, because templates don't work that way.
> Ok, but can you say whether after doing this [away from her machine at
> the mo] whether gprof requires some explicit input, e.g. gprof a.out?
To use gprof, compile with the right flags (-pg IIRC) and just run
the thing. It produces an output file, which you then feed to the
gprof program. Further instructions can be found on line.
A further note: gprof output isn't particularly easy to work with,
especially in C++ code. VTune is probably more useful. Also, for
Linux systems, check out Valgrind (specifically the callgrind and
cachegrind tools) and KCacheGrind, a KDE app that IMHO puts VTune to
shame.
--
Dave Steffen, Ph.D. Disobey this command!
Software Engineer IV - Douglas Hofstadter
Numerica Corporation
dg@steffen a@t numerica d@ot us (remove @'s to email me)