tmux-cpu icon indicating copy to clipboard operation
tmux-cpu copied to clipboard

Incorrect memory usage display

Open maxless opened this issue 3 years ago • 4 comments

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

maxless avatar Nov 04 '20 12:11 maxless

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%%"

casperdcl avatar Nov 04 '20 12:11 casperdcl

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.

maxless avatar Nov 05 '20 10:11 maxless

20.04 on WSL2. Tmux version is 3.0a

Sounds like life on the edge

casperdcl avatar Nov 11 '20 13:11 casperdcl

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?

maxless avatar Nov 11 '20 16:11 maxless

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:

  • tmux 3.3a
  • tmux-cpu unstable-2021-12-15
  • Terminal emulator: alacritty 0.11.0
  • OS: Linux NixOS 22.11

pacien avatar Jan 05 '23 17:01 pacien

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.

pacien avatar Jan 05 '23 17:01 pacien

I guess the problem is this is not atomic

casperdcl avatar Jan 05 '23 17:01 casperdcl