PDA

View Full Version : current Cpu(s) usage info



swiety
15th January 2008, 15:04
How can i get this info ? or how can i get this via KProcess and top command, because


KProcess p;
p->setProgram( "top", QStringList() );
p->start();

and readAllStandardOutput() doesn't work.

wysota
15th January 2008, 16:39
The process works in an asynchronous way. You can start it and immediately read the result - it's not there. Connect to a proper signal instead.

swiety
15th January 2008, 18:30
i konw that. I have error "top: failed tty get" . Any idea?

wysota
15th January 2008, 19:17
Apparently it needs a real terminal. Try using uptime instead of top or parse /proc/stat yourself.