Forcing apps to collect GC stats?

Johan Tibell johan.tibell at gmail.com
Thu Jul 31 16:41:41 UTC 2014


Indeed. I filed a bug earlier today to make use of this.

On Thu, Jul 31, 2014 at 6:15 PM, Edward Kmett <ekmett at gmail.com> wrote:
> Interesting.
>
> I suppose ekg could also (ab)use this.
>
> Johan?
>
> -Edward
>
>
> On Thu, Jul 31, 2014 at 5:51 AM, Simon Marlow <marlowsd at gmail.com> wrote:
>>
>> Hey Bryan,
>>
>> Sorry for the delay.
>>
>>
>> On 15/07/14 01:57, Bryan O'Sullivan wrote:
>>>
>>> I spent a bit of time over the weekend trying to figure out how to force
>>> the RTS to collect GC statistics, but was unable to do so.
>>>
>>> I'm currently working on enriching criterion's ability to gather data,
>>> among which I'd like to see GC statistics. If I try to obtain GC stats
>>> using criterion when I'm not running the benchmark app with +RTS -T, I
>>> get an exception.
>>>
>>> Is there a way to allow criterion to forcibly enable stats collection?
>>> My efforts to do so have gotten me nowhere. It would be unfortunate if I
>>> had to tell users of criterion that they should always run with +RTS -T
>>> or add a -rtsopts clause, as they'll simply forget.
>>>
>>> And while I'm asking, why does GHC not simply collect GC stats by
>>> default? Collecting them seems to have zero cost, from what I can see?
>>
>>
>> So you can do this in the same way as GHC. See
>>
>>
>> https://phabricator.haskell.org/diffusion/GHC/browse/master/ghc/hschooks.c;6fa6caad0cb4ba99b2c0b444b0583190e743dd63$18-28
>>
>> Which is imported into Haskell like this:
>>
>>
>> https://phabricator.haskell.org/diffusion/GHC/browse/master/ghc/Main.hs;6fa6caad0cb4ba99b2c0b444b0583190e743dd63$847-848
>>
>> I'm not sure why it's marked "safe", but it doesn't hurt.
>>
>> This API is kind-of public, in the sense that we deliberately expose it
>> via the Rts.h header, and I'll try not to break it gratuitously.
>>
>> Cheers,
>> Simon
>>
>> _______________________________________________
>> ghc-devs mailing list
>> ghc-devs at haskell.org
>> http://www.haskell.org/mailman/listinfo/ghc-devs
>
>


More information about the ghc-devs mailing list