tmux-plugins / tmux-cpu

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

Cygwin blink #5

Open ctjhoa opened 9 years ago

ctjhoa commented 9 years ago

Command to get CPU load on windows is so slow that tmux status bar blink sometimes.

% time ./cpu_percentage.sh
5.0%./cpu_percentage.sh  0.03s user 0.04s system 6% cpu 1.197 total

1.197 seconds against 0.016 with linux command for example.

If a windows expert have better command. I'll be glad.

Memphizzz commented 8 years ago

I guess thats also causing the CPU usage hickups in task manager then... I had to disable the plugin because of them..

Memphizzz commented 8 years ago

Maybe you can use this command as it works on cygwin and it looks like its not cpu heavy:

typeperf "\Processor(_Total)\% Processor Time"

ctjhoa commented 8 years ago

I will do some benchmark with the command: typeperf "\Process(*)\% Processor Time" -sc 1 I'll keep you in touch.

ctjhoa commented 8 years ago

So here is the trick. typeperf use counters to get what you want to retrieve. In our case, there are "Process"/"Processor Time"/"Processor". Those counters are localized by the system language (source). For example, for me, with my french system I have to type this to get the right result:

ctjhoa@SKYNET ~ % time typeperf "\processeur(_total)\% temps processeur" -sc 1

"(PDH-CSV 4.0)","\\SKYNET\processeur(_total)\% temps processeur"
"04/30/2016 11:26:02.558","20.444041"
Fin du programme, veuillez patienter...
L'opération s'est bien déroulée.
typeperf "\processeur(_total)\% temps processeur" -sc 1  0.00s user 0.01s system 1% cpu 1.141 total

First, the total time is as bad as the WMIC command. Second, I should limit this feature to english system only. And get system language doesn't seems so easy in windows world (source). Not to mention that retrieve system language take time and cpu.

So typeperf command is not the answer IMO.

Finally, I've done some performance testing of the tmux-cpu's cygwin command: I don't see any high cpu usage with tmux in the task manager. capture

I've done some benchmark too with the task manager's graphs. Red zone is when I use tmux.

Screenshot with the WMIC command: capture-with-tmux-cpu

Screenshot with a dummy number (12): capture-without_tmux_cpu

So yes, the WMIC consume more cpu but it's reasonable. My system info:

ctjhoa commented 8 years ago

Maybe you should try to update your tmux package ?

Memphizzz commented 8 years ago

I'm on tmux v.2.2. Nothing to update there...

ctjhoa commented 8 years ago

@Memphizzz could you send me screenshot of our task manager (when tmux-cpu is running) and more info about your system please ?