tmux-plugins / tmux-cpu

Plug and play cpu percentage and icon indicator for Tmux.
MIT License
444 stars 69 forks source link

Grab CPU stats from iostat on a mac #1

Closed lglenn closed 9 years ago

lglenn commented 9 years ago

OSX doesn't have procfs, so grabbing cpu usage from /proc/stat won't work.

Rather, if is_osx() returns true, get stats from the output of the iostat utility.

Note that the first line of data that iostat prints is always averaged over system uptime. You need to tell it to print two lines, averaging over one second, and use the data in the second line.

ctjhoa commented 9 years ago

@lglenn Thanks dude ! I cannot test it because I don't get a mac but this seems to be OK.