Skip to content

Add sar and fix some system detect command wrong #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@


all:
$(CXX) scripts/sysstat.cpp -o scripts/tmux_sysstat


clean:
rm -rf tmux_sysstat
File renamed without changes
File renamed without changes
78 changes: 0 additions & 78 deletions scripts/cpu.sh

This file was deleted.

53 changes: 0 additions & 53 deletions scripts/cpu_collect.sh

This file was deleted.

50 changes: 43 additions & 7 deletions scripts/helpers.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@

sysstat_color_map=(
5fff00
87ff00
afff00
d7ff00
ffff00
ffd700
ffaf00
ff8700
ff5f00
d70000
ff0000
)

get_tmux_option() {
local option="$1"
local default_value="$2"
local option_value="$(tmux show-option -gqv "$option")"
if [ -z "$option_value" ]; then
echo "$default_value"
echo "$default_value"
else
echo "$option_value"
echo "$option_value"
fi
}

Expand All @@ -16,6 +30,28 @@ set_tmux_option() {
tmux set-option -gq "$option" "$value"
}

get_tmux_option_ex() {
local option=$1
local default_value=$2
local force_icon=$3
if [[ $force_icon == "force" ]]; then
local option_value=$(tmux show-option -gqv "$option")
if [[ $option_value != $default_value ]]; then
set_tmux_option "$option" "$default_value"
fi
fi
local option_value=$(tmux show-option -gqv "$option")
if [[ $force_icon == "custom" ]]; then
echo "$default_value"
elif [[ $force_icon == "force" ]]; then
echo "$option_value"
elif [[ $option_value != "" ]]; then
echo "$option_value"
else
echo "$default_value"
# echo "$option_value"
fi
}
is_osx() {
[ $(uname) == "Darwin" ]
}
Expand Down Expand Up @@ -52,7 +88,7 @@ fcomp() {
# 1048576 - scale to GiB
function get_size_scale_factor(){
local size_unit="$1"
case "$size_unit" in
case "$size_unit" in
G) echo 1048576;;
M) echo 1024;;
K) echo 1;;
Expand All @@ -62,15 +98,15 @@ function get_size_scale_factor(){
# Depending on scale factor, change precision
# 12612325K - no digits after floating point
# 1261M - no digits after floating point
# 1.1G - 1 digit after floating point
# 1.1G - 1 digit after floating point
function get_size_format(){
local size_unit="$1"
case "$size_unit" in
case "$size_unit" in
G) echo '%.1f%s';;
M) echo '%.0f%s';;
K) echo '%.0f%s';;
esac
}



28 changes: 0 additions & 28 deletions scripts/loadavg.sh

This file was deleted.

Loading