[erlang-questions] process stats
Sat Nov 3 03:54:25 CET 2012
On Nov 2, 2012, at 1:40 PM, Jachym Holecek wrote:
> # J?zsef B?rces 2012-11-02:
>> I am writing an application that runs in the background crunching some
>> data and writing result files to the disk. It has a web interface to
>> configure what data and how to process. And I was thinking about that
>> it would be good to be able to present some stats on the web interface
>> about which Erlang processes how much CPU resources used during the last
>> second/minute/day/week etc.
>> Is there any way to get this kind of info somehow without wasting too
>> much resources on the stat collection itself? I do not want it for all
>> Erlang processes, only for a well defined subset of them.
> You could poll them with erlang:process_info/2 and compile some stats
> from that. Memory usage items are quite detailed and self-explanatory,
> the 'reductions' item then corresponds to CPU usage (roughly the total
> number of function applications evaluated, I think).
The problem that I see with using reductions is that it is an absolute value,
which means that in order to get something CPU-utilization-like - you'll need
to sample every single process and calculate the relative values from there.
IMHO, this is OK for a temporary glance of a top-like tool, but doesn't seem
like the best idea for persistent monitoring that the OP desires.
More information about the erlang-questions