Re: Linking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cameron Simpson wrote:
> On 08Dec2006 12:01, Luca <luca.piol@xxxxxxxxxxxxx> wrote:
> | How do I capture the linking time and data size of ld?
> | 
> | I mean, example, when I compile a package foo from scratch, what
> | commands should I use to save a log file with something like:
> | 
> | /usr/bin/ld: total time in link: [time]
> | /usr/bin/ld: data size [size]
>
> Second part first: the 'size" command reports on the section sizes of
> an executable, so if the ld command makes a file "bah", the command:
>
>   size bah
>
> will report on its size. See "man size" for details.
>
> For timing, you can get the time with the "time" command. Where you
> have "ld foo...", put "time ld foo...". Time writes to standard error,
> so you will need to send that somewhere:
>
>   time ld foo... 2>output-file
>
> However, ld will write its own error messages to stderr too, and you
> _don't_ want to interfere with them. This incantation
>
>   time sh -c 'exec 2>&3 3>&-; exec ld foo...' 3>&2 2>output-file
>
> will work around that, sending time's stderr to the output-file and ld's
> stderr wherever the original stderr went (usually your terminal). It
> takes a copy of the original stderr and the reattaches the copy as stderr
> inside the sh command.
>
> Finally, "time" is often a builtin command in shells. You may get better
> behaviour by saying "/usr/bin/time" instead of just "time". That will
> run the system "time" executable rather than whatever your shell provides
> internally.
>
> Cheers,
>   
Thanks Cameron;

I read something about using gprof and profiling but wasn't 100% sure so
I thought better ask.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux