<div dir="ltr">Interesting.<div><br></div><div>I suppose ekg could also (ab)use this. <div><br></div><div>Johan?<div><br></div><div>-Edward</div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 31, 2014 at 5:51 AM, Simon Marlow <span dir="ltr"><<a href="mailto:marlowsd@gmail.com" target="_blank">marlowsd@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hey Bryan,<br>
<br>
Sorry for the delay.<div><div class="h5"><br>
<br>
On 15/07/14 01:57, Bryan O'Sullivan wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I spent a bit of time over the weekend trying to figure out how to force<br>
the RTS to collect GC statistics, but was unable to do so.<br>
<br>
I'm currently working on enriching criterion's ability to gather data,<br>
among which I'd like to see GC statistics. If I try to obtain GC stats<br>
using criterion when I'm not running the benchmark app with +RTS -T, I<br>
get an exception.<br>
<br>
Is there a way to allow criterion to forcibly enable stats collection?<br>
My efforts to do so have gotten me nowhere. It would be unfortunate if I<br>
had to tell users of criterion that they should always run with +RTS -T<br>
or add a -rtsopts clause, as they'll simply forget.<br>
<br>
And while I'm asking, why does GHC not simply collect GC stats by<br>
default? Collecting them seems to have zero cost, from what I can see?<br>
</blockquote>
<br></div></div>
So you can do this in the same way as GHC. See<br>
<br>
<a href="https://phabricator.haskell.org/diffusion/GHC/browse/master/ghc/hschooks.c;6fa6caad0cb4ba99b2c0b444b0583190e743dd63$18-28" target="_blank">https://phabricator.haskell.<u></u>org/diffusion/GHC/browse/<u></u>master/ghc/hschooks.c;<u></u>6fa6caad0cb4ba99b2c0b444b05831<u></u>90e743dd63$18-28</a><br>

<br>
Which is imported into Haskell like this:<br>
<br>
<a href="https://phabricator.haskell.org/diffusion/GHC/browse/master/ghc/Main.hs;6fa6caad0cb4ba99b2c0b444b0583190e743dd63$847-848" target="_blank">https://phabricator.haskell.<u></u>org/diffusion/GHC/browse/<u></u>master/ghc/Main.hs;<u></u>6fa6caad0cb4ba99b2c0b444b05831<u></u>90e743dd63$847-848</a><br>

<br>
I'm not sure why it's marked "safe", but it doesn't hurt.<br>
<br>
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.<br>
<br>
Cheers,<br>
Simon<br>
<br>
______________________________<u></u>_________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/ghc-devs" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/ghc-devs</a><br>
</blockquote></div><br></div>