samoshkin / tmux-plugin-sysstat Goto Github PK
View Code? Open in Web Editor NEWPrints CPU usage, memory & swap, load average, net I/O metrics in Tmux status bar
License: MIT License
Prints CPU usage, memory & swap, load average, net I/O metrics in Tmux status bar
License: MIT License
See the background for this issue here: samoshkin/tmux-config#4
In a short, cpu.sh
is long running process, which takes $status-refresh-interval-1
seconds to complete. This cause various issues regarding status line refresh behavior:
cmd ~/.tmux/plugins/sysstat/scripts/cpu.sh not ready
message.cpu.sh
completes after 4 seconds, tmux refreshes all widgets in status line (not only cpu). This cause excessive spawns of other widget's scripts (mem, loadavg, swap, any other like tmux-status-online), so refresh behavior of status bar doesn't follow status-refresh-interval
settings any more.The idea for solution is to split cpu.sh
logic into:
Feature request to add hard drive storage stats. ie. free space & total
Hi,
I hope you can help me/us. On my machine I can see that the iostat
command defined in the cpu_collect.sh
script in the line 18 is hanging.
If I run the script in debug mode I see it hanging here:
bash scripts/cpu_collect.sh
+++ dirname scripts/cpu_collect.sh
++ cd scripts
++ pwd
+ CURRENT_DIR=/Users/jba/.tmux/plugins/tmux-plugin-sysstat/scripts
+ source /Users/jba/.tmux/plugins/tmux-plugin-sysstat/scripts/helpers.sh
++ get_tmux_option status-interval 5
++ local option=status-interval
++ local default_value=5
+++ tmux show-option -gqv status-interval
++ local option_value=5
++ '[' -z 5 ']'
++ echo 5
+ refresh_interval=5
+ samples_count=60
++ get_tmux_option @sysstat_cpu_tmp_dir /dev/null
++ local option=@sysstat_cpu_tmp_dir
++ local default_value=/dev/null
+++ tmux show-option -gqv @sysstat_cpu_tmp_dir
++ local option_value=/var/folders/4l/7gzvgyn97sb6x09cmt3cn_b8kcxzzd/T/tmp.YbccsN2w
++ '[' -z /var/folders/4l/7gzvgyn97sb6x09cmt3cn_b8kcxzzd/T/tmp.YbccsN2w ']'
++ echo /var/folders/4l/7gzvgyn97sb6x09cmt3cn_b8kcxzzd/T/tmp.YbccsN2w
+ cpu_metric_file=/var/folders/4l/7gzvgyn97sb6x09cmt3cn_b8kcxzzd/T/tmp.YbccsN2w/cpu_collect.metric
+ main
+ get_cpu_usage
+ is_osx
+ read -r value
++ uname
+ '[' Darwin == Darwin ']'
+ command_exists iostat
+ local command=iostat
+ type iostat
+ iostat -w 5 -c 60
+ stdbuf -o0 awk 'NR > 2 { print 100-$(NF-3); }'
If I copy the command in this way iostat -w 5 -c 60 | stdbuf -o0 awk 'NR > 2 { print 100-$(NF-3); }'
it works without a problem, but in the script It does not work.
Do you have any idea?
Regards
jolbax
On a system, where mawk
is the default awk
instead of gawk
(for example, Raspbian Stretch), the following will fail to give any output until all the samples are produced. For default settings, this will cause a delay of 60x10 seconds between CPU usage updates.
tmux-plugin-sysstat/scripts/cpu_collect.sh
Lines 30 to 31 in 29e150f
I propose two solutions:
awk
with /usr/bin/gawk
everywhere in the code and list gawk
as a dependency.stdbuf
and mawk
can produce streaming output.Hi, cpu usage is always at 0.0%. I reduced sampling time to 1 second and ran a build process. This still doesn't change the output.
I also tried to redirect the CPU file to ~/cpu_shit
folder (just in case the default temp folder is not working due to a permissions issue). I see no files being written to this folder.
Does anyone experience this issue? I installed via tmp.
Am I missing any dependencies on XUbuntu?
Hi,
thanks for your plug-in. Great tool! Unfortunately, it does not work under Mojave. Further, on El Capitan 10.11.6, nothing work except load average.
This is just a quick one - I love this wee plugin!
How would I go about padding the CPU and MEM % outputs? I'd like them to always take up the same amount of space.
It may be rare in most cases, but I sometimes do see a load of 0.00 in my uptime
, but it's displayed by this plugin as 0
. That seems inconsistent and does not look nice.
Thanks for the great work!
I have a relatively simple request, I'd like an option to trim floating points from CPU percentage as they add no value to me and make the percentage harder to read at times.
OS: macOS mojave 10.14
Tmux: 2.8
get_cpu_usage_or_collect() {
local collect_cpu_metric="$cpu_tmp_dir/cpu_collect.metric"
# read cpu metric from file, otherwise 0 as a temporary null value, until first cpu metric is collected
[ -f "$collect_cpu_metric" ] && cat "$collect_cpu_metric" || echo "0.0"
start_cpu_collect_if_required >/dev/null 2>&1
}
Looks like the plugin never read cpu metric from file in my case, because the CPU usage is always 0.0% while Ram usage did show real time value. Here is my minimum configuration:
set -g status-left " Sess: #S / CPU: #{sysstat_cpu} / Mem: #{sysstat_mem} "
set -g @sysstat_cpu_view_tmpl "#{cpu.pused}"
set -g @sysstat_mem_view_tmpl "#{mem.pused}"
set -g @plugin 'samoshkin/tmux-plugin-sysstat'
My full Tmux config file can be found at https://github.com/huyvohcmc/dotfiles/blob/master/tmux.conf.
I am running a multiprocessing program.
After the program runs, the display stays at 0.0%, and only after a few minutes does it show 9.5%, and it doesn't change for a long time.
Here is the cpu info.
โ ~ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 256
On-line CPU(s) list: 0-255
Thread(s) per core: 2
Core(s) per socket: 64
Socket(s): 2
NUMA node(s): 2
Vendor ID: AuthenticAMD
CPU family: 23
Model: 49
Model name: AMD EPYC 7H12 64-Core Processor
Stepping: 0
CPU MHz: 1499.957
CPU max MHz: 2600.0000
CPU min MHz: 1500.0000
BogoMIPS: 5199.91
Virtualization: AMD-V
L1d cache: 32K
L1i cache: 32K
L2 cache: 512K
L3 cache: 16384K
NUMA node0 CPU(s): 0-63,128-191
NUMA node1 CPU(s): 64-127,192-255
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate sme ssbd mba sev ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr wbnoinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif umip rdpid overflow_recov succor smca
Memory not printed under OS X Big Sur, even with coreutils installed :-(
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.