[ccache] explanation of ccache stats

Anders Björklund anders at itension.se
Fri Mar 18 07:23:04 UTC 2016


Stéphane Charette wrote:

>> Hmm, I looked at the code a bit and I don't think this will fly:
>>
>> find /home -maxdepth 3 -type f -name ccache.conf | sort
>>
> This started out as a plugin just for myself.  I needed to come up with a
> way to find the ccache directory without hard-coding my username into the
> plugin.

Right, I think the default configuration I had was just "~/.ccache".
Possibly looking at the value of $CCACHE_DIR, or reading ccache.conf ?

> If there is a better way for root to find all the ccache directories
> without hard-coding a value, please let me know!  This was the best I could
> come up with.

Not sure I had any, except leaving it as a monitoring configuration...

> In an enterprise setting, this will cause a lot of thrashing
>> only to come up with nothing since ccache isn't stored there.
>
> Correct, if the ccache directories are not stored in the user's home
> directories, then that line would have to be changed.  I guess this limits
> the plugin to people like myself using ccache on a system with "normal"
> configuration.

There's also the problem of not having access to other users,
and the home directories not being stored locally (but on NFS)..

For your use case, it will probably work - but you could end up
with lots (30) of users in the same graph for a shared computer ?


>> This is reasonable, but misses those things not being reported:
>>
>> ccache_total=$((ccache_hit + ccache_miss))
>>
>> That is, if ccache fails for some other reason you won't see it.
>
> Correct, I was just curious to see how "effective" ccache was in my
> projects, in terms of hits versus misses.  (I'm averaging 75%.)  Also note
> that the only stats I know about (since I've never dug into the ccache
> source code) is the output of ccache --show-stats.  Are there other stats
> not reported in --show-stats?  If so, where are they stored?

They are reported, but most are only reported if they are not zero.
You can see the full list being declared in the ccache source code:

https://github.com/jrosdahl/ccache/blob/master/ccache.h#L23
https://github.com/jrosdahl/ccache/blob/master/stats.c#L50


> Otherwise, it is looking good! Especially like the "effectiveness".
>> Not sure if 1-min or 5-min is best, guess it depends on volume...
>>
>
> Munin runs every 5 minutes.  That I don't get to define.  But unless the
> ccache stats are being reset back down to zero more often than once every 5
> minutes, this shouldn't be a problem.  (
> http://munin-monitoring.org/wiki/faq#Q:CanIrunmuninatdifferenttimeintervalsthanthedefault

That explains it, we are running every 10 seconds so choose 1-min.
(not using Munin, but another monitoring system running a daemon)

Probably should move to absolute counters, that would make it more
independent of the sampling interval. Right now it reports percent.

Which means it harder to calculate with and harder to aggregate ?

Should get RRDtool to do the math, instead of letting the probe...

/Anders


More information about the ccache mailing list