On 30/08/2011 3:50 AM, WAROQUIERS Philippe wrote:
>> However, the cost seems to include overhead from valgrind itself, such
>> as malloc&  other hooks.
>> (I see in the call graph that malloc calls "malloc_hook_ini"
>> once with a
>> cost of around 60,000 Ir.
>> Having only one a few mallocs in a particluar algorithm this overhead
>> greatly distorts test results.
>>
>> A second problem are symbol resolutions in the C library. Apparently
>> '_dl_runtime_resolve' is called once for each symbol used from
>> the C lib
>> (such as sprintf).  This is also unwanted overhead.
> Are you sure these hooks are from valgrind ?
> I think there are rather from glibc and similar, and callgrind properly
> shows that your code (indirectly) implies these calls.
>
> (I did a grep for malloc_hook_ini on recent Valgrind sources, and found
> no hit in .c or .h files).
>
Probably not. I now believe that all those unwanted calls are to blame 
on the C library and dynamic loader. There were many unwanted calls to 
functions like '_dl_runtime_resolve', '_dl_addr' and the like. Looking 
at my call graph again, 'malloc_hook_ini' calls 'ptmalloc_init' which 
calls '_dl_addr', and the cost of 60,000 Ir is due to '_dl_addr'.

I solved all those problems by using static linkage.

Chris


------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to