|
From: Henrik A. <h.m...@gm...> - 2009-06-29 08:32:23
|
Hi, I'm working on parsing the callgrind output in order to add the data into a database. This will be used for a web interface in order to do automatic performance measurements in a build system and for following the performance evolution. I'm currently struggling a bit with the fi/fe tags. I tried to do a simple program that uses inlined code but these tags never seems to appear :( Question: are these tags used for inlined code i.e code using the keyword "inline", or is it for macro definitions ? My simple example is attached together with the scripts required to run it. I tried with both -00 and -O3 but without any success. Regards, Henrik |
|
From: Josef W. <Jos...@gm...> - 2009-06-29 17:51:48
|
On Monday 29 June 2009, Henrik Akesson wrote:
> I'm working on parsing the callgrind output in order to add the data
> into a database. This will be used for a web interface in order to do
> automatic performance measurements in a build system and for following
> the performance evolution.
>
> I'm currently struggling a bit with the fi/fe tags. I tried to do a
> simple program that uses inlined code but these tags never seems to
> appear :(
Hmm.. Cachegrind used these ages ago, but does not generate them anymore.
Callgrind still does. It uses them when the file name of a source line
for which data is dumped changes. "fi" is used when it is different from
the source file of the function, which is defined as the source file
found from the debug info of the first instruction of the function.
> Question: are these tags used for inlined code i.e code using the
> keyword "inline", or is it for macro definitions ?
It very much depends on what debug information the compiler generates.
AFAICT, for source in macro definition, GCC just generates debug information
which only gives the line where the macro is referenced; so for macros
you will not see a source file change.
It should appear with inlined code, however. I do not see what you try to
achieve with your example: compiled with -g implies -O0, and then the
compiler always produces real calls here (so no fe/fi possible). With
-O2, the compiler optimizes all calls away, and calculates the constant
result already at compilation time. Again no chance for fe/fi ;-)
What about some non-trivial code given as inline function in
a header, and called in main, compiled with '-g -O2'
===============================
test.h
inline int foo(int a)
{ int i;
for(i=0:i<a;i++) a+=i;
return a;
}
test.c
main(int argc, char argv[])
{
return foo(argc);
}
================================
This produces fi/fe tags for me. KCachegrind shows the lines from test.h
as part of function main(), but under a header "Inlined from test.h".
Josef
>
> My simple example is attached together with the scripts required to run it.
>
> I tried with both -00 and -O3 but without any success.
>
> Regards,
>
> Henrik
>
|