Merge branch 'master' of https://github.com/dracula/tmux into freebsd_support
This commit is contained in:
commit
8f235a8b09
2 changed files with 7 additions and 7 deletions
|
@ -16,7 +16,7 @@ get_percent()
|
||||||
{
|
{
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Linux)
|
Linux)
|
||||||
percent=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}')
|
percent=$(LC_NUMERIC=en_US.UTF-8 top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}')
|
||||||
echo $percent
|
echo $percent
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ get_platform()
|
||||||
{
|
{
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Linux)
|
Linux)
|
||||||
gpu=$(lspci -v | grep -i gpu | grep driver | awk '{print $5}')
|
gpu=$(lspci -v | grep VGA | head -n 1 | awk '{print $5}')
|
||||||
echo $gpu
|
echo $gpu
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -32,10 +32,12 @@ get_platform()
|
||||||
get_gpu()
|
get_gpu()
|
||||||
{
|
{
|
||||||
gpu=$(get_platform)
|
gpu=$(get_platform)
|
||||||
if [ $gpu == nvidia-gpu ]; then
|
if [[ "$gpu" == NVIDIA ]]; then
|
||||||
usage=$(nvidia-smi | grep "%" | awk '{print $13}')
|
usage=$(nvidia-smi | grep '%' | awk '{ sum += $13 } END { printf("%d%%\n", sum / NR) }')
|
||||||
echo $usage
|
else
|
||||||
|
usage='unknown'
|
||||||
fi
|
fi
|
||||||
|
echo $usage
|
||||||
}
|
}
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
|
@ -47,5 +49,3 @@ main()
|
||||||
}
|
}
|
||||||
# run the main driver
|
# run the main driver
|
||||||
main
|
main
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue