[Qt-interest] How to get per-process stats (on linux) - reading /proc

prashant bhutani prashantbhutani2008 at gmail.com
Thu Nov 4 10:22:09 CET 2010


 On Thu, Nov 4, 2010 at 2:04 PM, Wilhelm <wilhelm.meier at fh-kl.de> wrote:

> Hi all,
>
Hi,

>
> looks like a simple question, but I did not found any good answers:
>
Same happened with me and it took me hefty googling to get the answer.

>
> What is the best way to read /proc (on linux) to get per-process
> statistics (as %cpu, ...)?
>
I don't know the best way but the only(might be for me) way I came across
was to use *ps* command, which gives the information about running processes
on the system.
You can use system("ps  -A -o your_format_you_want_data_in") and write it to
a file using freopen() in C/C++ code.
Rest depends on how much you are familiar with string manipulation ;)

>
> I also looked at KDE3/ksysguard source code. Is anybody aware of good
> other implementations?
>
> --
> Wilhelm
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>

Prashant Bhutani
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101104/312ca769/attachment.html 


More information about the Qt-interest-old mailing list