For a concrete example of this at work, see Johan&#39;s ekg package: <a href="http://hackage.haskell.org/package/ekg">http://hackage.haskell.org/package/ekg</a><div><br></div><div>G<br><br><div class="gmail_quote">On Mon, Aug 27, 2012 at 8:12 PM, Joachim Breitner <span dir="ltr">&lt;<a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Am Montag, den 27.08.2012, 18:20 +0200 schrieb Alberto G. Corona :<br>
<div><div class="h5">&gt; For a caching library, I need to know the runtime usage of memory of<br>
&gt; the  program and the total amount of memory, the total memory used by<br>
&gt; all the programs etc.<br>
&gt;<br>
&gt;<br>
&gt;  I need not do profiling or monitoring but to do different things<br>
&gt; inside my program depending on memory usage.<br>
&gt;<br>
&gt; The search is difficult because all searches go to profiling utilities<br>
&gt; which I don´t need.<br>
&gt;<br>
&gt;<br>
&gt; Are there some  portable way to to this? . The various monitoring<br>
&gt; libraries indicates that there are ways to do it, but they seem not to<br>
&gt; allow  runtime &quot;internal automonitoring&quot;<br>
<br>
</div></div>you can use the GHC.Stats module, see<br>
<a href="http://www.haskell.org/ghc/docs/latest/html/libraries/base/GHC-Stats.html" target="_blank">http://www.haskell.org/ghc/docs/latest/html/libraries/base/GHC-Stats.html</a>, and remember to pass +RTS -T to the program, or -with-rtsopts=-T to the compiler.<br>

<br>
Greetings,<br>
Joachim<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Joachim &quot;nomeata&quot; Breitner<br>
  <a href="mailto:mail@joachim-breitner.de">mail@joachim-breitner.de</a>  |  <a href="mailto:nomeata@debian.org">nomeata@debian.org</a>  |  GPG: 0x4743206C<br>
  xmpp: <a href="mailto:nomeata@joachim-breitner.de">nomeata@joachim-breitner.de</a> | <a href="http://www.joachim-breitner.de/" target="_blank">http://www.joachim-breitner.de/</a><br>
<br>
</font></span><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Gregory Collins &lt;<a href="mailto:greg@gregorycollins.net" target="_blank">greg@gregorycollins.net</a>&gt;<br>
</div>