tmux-plugins / tmux-cpu

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

Incorrect memory usage display #62

Closed maxless closed 1 year ago

maxless commented 4 years ago

Sometimes I can see memory usage like this: image It stays like this for a short period of time (probably the update period) and then shows correctly: image That leads me to another issue - you can see how MEM is green, is there a way to reset the text color back to default?

I use Ubuntu 20.04 on WSL2. Tmux version is 3.0a. The relevant config section is:

set-option -g status-left-length 20
set-option -g status-left "#S | "
set-option -g status-left-style fg=#aaaaaa,bg=#050505
set-option -g status-style fg=#aaaaaa,bg=#050505
set-option -g status-right 'CPU: #{cpu_fg_color}#{cpu_percentage} MEM: #{ram_fg_color}#{ram_percentage}'
set-option -g status-right-style fg=#aaaaaa,bg=#050505
casperdcl commented 4 years ago

reset colours:

-set-option -g status-right 'CPU: #{cpu_fg_color}#{cpu_percentage} MEM: #{ram_fg_color}#{ram_percentage}'
+set-option -g status-right 'CPU: #{cpu_fg_color}#{cpu_percentage}#[fg=#aaaaaa] MEM: #{ram_fg_color}#{ram_percentage}'

I'm on Ubuntu 16.04 and 18.04 and haven't noticed doubled up percentages - and I have a whopper:

set -g status-right-length 50
set -g status-right '#{host} #{cpu_bg_color}#{cpu_percentage}#[bg=green][#{ram_bg_color}#{ram_percentage}#[bg=green]](#{cpu_temp_bg_color}#{cpu_temp}#[bg=green]) #{gpu_bg_color}#{gpu_percentage}#[bg=green][#{gram_bg_color}#{gram_percentage}#[bg=green]](#{gpu_temp_bg_color}#{gpu_temp}#[bg=green])'
set -g @cpu_percentage_format "%4.1f%%"
set -g @gpu_percentage_format "%2.0f%%"
maxless commented 4 years ago

Thanks for the colors bit.

This is is first time I'm using this plugin so I don't know whether it's related to Ubuntu version.

casperdcl commented 4 years ago

20.04 on WSL2. Tmux version is 3.0a

Sounds like life on the edge

maxless commented 4 years ago

Nah, I just got to upgrading my development environment (happens around every 2 years) and it coincided with the WSL2 release :)

I've noticed some shell scripts in htop running periodically, if they're from tmux-cpu, perhaps I could give you their input/output for debugging?

pacien commented 1 year ago

I'm observing the same issue: the RAM percentage is sometimes repeated. I'm not using any colouring.

The issue is mostly happening through SSH. It rarely happens with a local tmux.

https://user-images.githubusercontent.com/1449319/210838566-65686032-7421-4945-92e3-f578fb6e6417.mp4

Config:

set -ga status-right ' #{cpu_percentage}C #{ram_percentage}M'

Versions:

pacien commented 1 year ago

Debugging further: the issue seems to be happening when launching more than one tmux window at the same time.

The repeated output can be reproduced with the script alone:

~/src/tmux-cpu master
❯ while true
      ./scripts/ram_percentage.sh
      echo
      sleep 0.01
  end

The issue appears when launching this loop on multiple terminals at the same time.

casperdcl commented 1 year ago

I guess the problem is this is not atomic