Re: Instrumenting code for profiling.

s.bosscher@student.tudelft.nl (Steven Bosscher)
17 Nov 2004 11:37:04 -0500

          From comp.compilers

Related articles
Instrumenting code for profiling. par_ianth@yahoo.com (2004-11-14)
Re: Instrumenting code for profiling. gah@ugcs.caltech.edu (glen herrmannsfeldt) (2004-11-17)
Re: Instrumenting code for profiling. s.bosscher@student.tudelft.nl (2004-11-17)
Re: Instrumenting code for profiling. nmm1@cus.cam.ac.uk (2004-11-19)
Re: Instrumenting code for profiling. diablovision@yahoo.com (2004-11-20)
Re: Instrumenting code for profiling. idbaxter@semdesigns.com (Ira Baxter) (2004-11-20)
Re: Instrumenting code for profiling. tmk@netvision.net.il (2004-11-20)
Re: Instrumenting code for profiling. nmm1@cus.cam.ac.uk (2004-11-26)
| List of all articles for this month |
From: s.bosscher@student.tudelft.nl (Steven Bosscher)
Newsgroups: comp.compilers
Date: 17 Nov 2004 11:37:04 -0500
Organization: http://groups.google.com
References: 04-11-043
Keywords: performance, debug
Posted-Date: 17 Nov 2004 11:37:04 EST

par_ianth@yahoo.com (PK) wrote
> I had a question regarding how compilers do instrumentation to
> collect profile information. Specifically, how do compilers handle the
> part of mapping the collected profile back to the original program
> (which is without the instrumentation).


In GCC, the profile is read in at the same point in the compilation
process where the instrumentation is added to gather the profile
information.


The cfg instrumentation adds edge and block counters, so when you read
the profile, your control flow graph must match the one that was
instrumented. Similarly for value profiling the instructions you
instrumented must still be in the same place (ie. basic block,
instruction) when you want to use the value profile information.


This means that GCC really *must* read the fed back profile at the
same point in the compilation process where the CFG was previously
instrumented for the test runs. Otherwise there is no mapping from
the profile data to the intermediate language.


This also means that when you change the source, any profile
information you might have is no longer useful. Other compilers
apparently don't have this restriction. My understanding is that the
DEC compiler could still use some profile information even when the
source code has been modified. If anyone knows more about this, I'd
like to hear... ;-)


Gr.
Steven



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.