开发者

read data from a stream in ruby

I have to run top in my machine (mac osx), and get the cpu usage from there, in real 开发者_如何学Ctime. How can I do that?

I tried running top and saving it but it must end before it saves it.

Thank you.


The -n command line option lets you run top for the specified number of cycles, then exit. So top -n 1 just runs it once and you can parse the output.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜