Added WSL support#86
Conversation
There was a problem hiding this comment.
Thanks for this!
From my tests, it seems a bit slower (WSL2 debian on Win11):
- CPU
wmic: 1.3sec - CPU
ps -aux: 0.3sec - RAM
wmic: 0.54sec - RAM
free: 0.14sec
are there any advantages to using wmic? Is it more accurate? I didn't quite understand "guest CPU / RAM can be limited by WSL config the current methods are not indicative of the whole system"
There was a problem hiding this comment.
any reason not to just do this?
| if [[ $(get_tmux_option @cpu_wsl_host) == "true" && -n "${WSL_DISTRO_NAME}" ]] ; then | |
| if command_exists "wmic.exe"; then |
or even better, alter the is_cygwin function & convert pre-exisiting WMIC calls to wmic.exe?
There was a problem hiding this comment.
I was trying to ensure we gave users the options if they wanted to just see the guest/WSL performance or the whole system and to make sure it only ran if you actually were inside WSL (I use the same .tmux.conf on multiple systems)
or even better, alter the is_cygwin function & convert pre-exisiting WMIC calls to wmic.exe?
This might be a better option, although cygwin and WSL are different beasts - I'll install cygwin and give it a go when I've got chance.
There was a problem hiding this comment.
no need to install cygwin -- I mean we can change is_cygwin to simply is_win (i.e. is_wsl_or_cygwin)

This PR adds support to gather CPU & RAM % usage of the Windows host system when using Windows subsystem for Linux.
As the guest CPU / RAM can be limited by WSL config the current methods are not indicative of the whole system.
This also adds two new options:
@cpu_wsl_hostand@ram_wsl_hostto control if this data should come from the guest or the host - when set the data comes from querying wmic.exe