Skip to content

Commit

Permalink
Merge pull request matryer#1505 from plaa/cpu-thermal-throttle
Browse files Browse the repository at this point in the history
Add CPU thermal throttling plugin
  • Loading branch information
matryer authored Dec 11, 2020
2 parents 4ff1cc0 + d42e0a6 commit 7edaa2f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions System/cpu-thermal-throttle.30s.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# <bitbar.title>CPU thermal throttling</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Sampo Juustila</bitbar.author>
# <bitbar.author.github>plaa</bitbar.author.github>
# <bitbar.desc>Displays the current CPU thermal throttling speed (using `pmset -g therm`).</bitbar.desc>

OUTPUT="$(pmset -g therm)"
SCHEDLIMIT="$(echo "$OUTPUT" | grep CPU_Scheduler_Limit | cut -d= -f2)"
SPEEDLIMIT="$(echo "$OUTPUT" | grep CPU_Speed_Limit | cut -d= -f2)"
AVAILCPU="$(echo "$OUTPUT" | grep CPU_Available_CPUs | cut -d= -f2)"
TOTAL=$(($SCHEDLIMIT * $SPEEDLIMIT / 100))

if [ "$TOTAL" -ge 80 ]; then
SYMBOL="🌡"
else
SYMBOL="🔥"
fi

cat <<EOF
$SYMBOL$TOTAL%
---
CPU_Speed_Limit $SPEEDLIMIT%
CPU_Scheduler_Limit $SCHEDLIMIT%
CPU_Available_CPUs $AVAILCPU
EOF

0 comments on commit 7edaa2f

Please sign in to comment.