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
|
||||
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
|
||||
;;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ get_platform()
|
|||
{
|
||||
case $(uname -s) in
|
||||
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
|
||||
;;
|
||||
|
||||
|
@ -32,10 +32,12 @@ get_platform()
|
|||
get_gpu()
|
||||
{
|
||||
gpu=$(get_platform)
|
||||
if [ $gpu == nvidia-gpu ]; then
|
||||
usage=$(nvidia-smi | grep "%" | awk '{print $13}')
|
||||
echo $usage
|
||||
if [[ "$gpu" == NVIDIA ]]; then
|
||||
usage=$(nvidia-smi | grep '%' | awk '{ sum += $13 } END { printf("%d%%\n", sum / NR) }')
|
||||
else
|
||||
usage='unknown'
|
||||
fi
|
||||
echo $usage
|
||||
}
|
||||
main()
|
||||
{
|
||||
|
@ -47,5 +49,3 @@ main()
|
|||
}
|
||||
# run the main driver
|
||||
main
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue