aboutsummaryrefslogtreecommitdiff
path: root/segments/cpu.sh
diff options
context:
space:
mode:
authorCody Hiar <codyfh@gmail.com>2017-04-20 19:37:10 -0600
committerCody Hiar <codyfh@gmail.com>2017-04-20 19:37:10 -0600
commit2dd809781527976307b47a598887062047e202c9 (patch)
tree8b29daba2c1ef072f380ef530b7e7d9256e43eb3 /segments/cpu.sh
parentbaeb698bb006193559fc5aa1901180a3ccc73b7a (diff)
Making tmux configuration much easier to manage
Diffstat (limited to 'segments/cpu.sh')
-rwxr-xr-xsegments/cpu.sh22
1 files changed, 0 insertions, 22 deletions
diff --git a/segments/cpu.sh b/segments/cpu.sh
deleted file mode 100755
index 637bcda..0000000
--- a/segments/cpu.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-# Prints the CPU usage: user% sys% idle.
-
-run_segment() {
- if shell_is_linux; then
- cpu_line=$(top -b -n 1 | grep "Cpu(s)" )
- cpu_user=$(echo "$cpu_line" | grep -Po "(\d+(.\d+)?)(?=%?\s?(us(er)?))")
- cpu_system=$(echo "$cpu_line" | grep -Po "(\d+(.\d+)?)(?=%?\s?(sys?))")
- cpu_idle=$(echo "$cpu_line" | grep -Po "(\d+(.\d+)?)(?=%?\s?(id(le)?))")
- elif shell_is_osx; then
- cpus_line=$(top -e -l 1 | grep "CPU usage:" | sed 's/CPU usage: //')
- cpu_user=$(echo "$cpus_line" | awk '{print $1}' | sed 's/%//' )
- cpu_system=$(echo "$cpus_line" | awk '{print $3}'| sed 's/%//' )
- cpu_idle=$(echo "$cpus_line" | awk '{print $5}' | sed 's/%//' )
- fi
-
- if [ -n "$cpu_user" ] && [ -n "$cpu_system" ] && [ -n "$cpu_idle" ]; then
- echo "${cpu_user}, ${cpu_system}, ${cpu_idle}" | awk -F', ' '{printf("%5.1f,%5.1f,%5.1f",$1,$2,$3)}'
- return 0
- else
- return 1
- fi
-}