cache misses in gcc 3.3
Daniel Berlin
dberlin@dberlin.org
Mon Feb 10 03:07:00 GMT 2003
On Sunday, February 9, 2003, at 09:43 PM, Andi Kleen wrote:
> On Sun, Feb 09, 2003 at 11:31:44PM +0100, Daniel Berlin wrote:
>>
>>
>> On Sun, 9 Feb 2003, Andi Kleen wrote:
>>
>>>
>>> I ran a slightly older gcc 3.3 on linux in cachegrind
>>> (http://developer.kde.org/~sewardj/) on an Athlon with 256K cache.
>>> cachegrind is a cache simulator and gives detailed reports about
>>> the caching behaviour of a program.
>>
>> Cachegrind usually gives me *wildly* different results than real
>> profiling
>> (either with oprofile or vtune for linux).
>
> I double checked with oprofile now (ordering the other way round)
>
> For dcaches it is not that much different - most of the functions
> idenitified as hot by cachegrind are hot in oprofile too.
>
I find this is only true sometimes, but i'm on a P4, probably
architecture differences. I last tried cachegrind at 1.0.2 or
thereabouts, maybe it's improved.
When i used to use it, I found that those functions identified by
cachegrind generally are hot, but it missed the top cache missing
functions completely many times.
IE it's useful, but if you want to get the heavy hitters, you usually
need to do a real profile of some sort in addition.
> I guess the difference can be explained in the difference methologies.
> cachegrind runs an exact model, while oprofile does an statistical
> sample (i used an NMI every 2000 events) and has to fight with an
> out-of-order CPU with a large issue window mixing instructions too.
Which is reality, unfortunately.
> New interesting is lookup_tag(). I'm not sure why it gets
> that many dcaches misses and isn't noticed by cachegrind at all.
> Could be an OOO artifact.
>
> yyparse/bison slowness is even more clearly visible here.
>
> -Andi
>
> Cpu type: Athlon
> Cpu speed was (MHz estimation) : 896.198
> Counter 0 counted DATA_CACHE_MISSES events (Data cache misses) with a
> unit mask of 0x00 (Not set) count 2000
> vma samples %-age symbol name linenr info
> [...]
> 0808b6e0 64 1.48561 init_alias_analysis
> /src/src/gcc-3.3/obj/gcc/../../gcc/gcc/alias.c:2692
> 081fae60 65 1.50882 side_effects_p
> /src/src/gcc-3.3/obj/gcc/../../gcc/gcc/rtlanal.c:2256
> 0822ca50 76 1.76416 ggc_alloc
> /src/src/gcc-3.3/obj/gcc/../../gcc/gcc/ggc-page.c:872
> 08112560 85 1.97307 gt_ggc_mx_rtx_def
> /src/src/gcc-3.3/obj/gcc/gtype-desc.c:374
> 081fa1b0 86 1.99629 note_stores
> /src/src/gcc-3.3/obj/gcc/../../gcc/gcc/rtlanal.c:1610
> 08049610 143 3.31941 yyparse
> /usr/share/bison/bison.simple:383
> 0822d100 188 4.36397 ggc_pop_context
> /src/src/gcc-3.3/obj/gcc/../../gcc/gcc/ggc-page.c:1257
> 0822cc10 304 7.05664 ggc_set_mark
> /src/src/gcc-3.3/obj/gcc/../../gcc/gcc/ggc-page.c:1002
> 0805a2d0 327 7.59053 gt_ggc_mx_lang_tree_node
> /src/src/gcc-3.3/obj/gcc/gt-c-decl.h:44
> 080543e0 363 8.42618 lookup_tag
> /src/src/gcc-3.3/obj/gcc/../../gcc/gcc/c-decl.c:2343
>
>
More information about the Gcc
mailing list