note
ryan
If you are meaning the memory used by your program then there was talk of this [id://58560|here]
<p>
If you are talking of the system in general then I might do something crude like this with the /proc file system:
<br>
<code>$meminfo=`cat /proc/meminfo | grep "^Mem: "`;
$meminfo =~ s/^Mem\:\W+//;
($total, $used, $free, $shared, $buffered, $cached) = split(/\W+/,$meminfo,6);
</code>
<p>
Then you have the 2nd line of /proc/meminfo in 6 variables and can write them out to whatever log you want. There are modules to deal with /proc but I can't find anything to return memory information, only individual process attributes.
<p>
I'm not fantastic at coding, just thought I'd give it a try, I'm sure there is a quicker way - but that is how I would do it with my current knowledge :) I guess this could break if the format of /proc/meminfo was ever changed.
59612
59612