On 02/27/2013 05:25 PM, Krzysztof wrote:
> Hi,
> 
> I need system info such CPU (by PID), memory usage (by PID), free memory
> etc. Target platform: Linux.
> Linux have command line tools like ps, top, memstat, but I'm just
> wondering if Free Pascal has wrappers for these commands. If not, then I
> just get these information by execution external process.
> 

On newer linux kernels, instead of running external processes you can
better read and parse /proc/pid/stat (replace pid with the PID). If you
need per thread info you can read /proc/pid/task/tid/stat. These are
single line pseudo files with space separated values. Much easier than
parsing the free format output from ps, top, etc.
http://www.kernel.org/doc/man-pages/online/pages/man5/proc.5.html

Ludo

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to