开发者

read data from a stream in ruby

开发者 https://www.devze.com 2023-03-03 04:52 出处:网络
I have to run top in my machine (mac osx), and get the cpu usage from there, in real 开发者_如何学Ctime.

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

精彩评论

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

关注公众号