-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathboost-tuner
33 lines (26 loc) · 928 Bytes
/
boost-tuner
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /bin/bash
#----------------------------------------------------------------------
# Description: enable CPU boost only when given applications are running
# will be unconditionally enabled if /tmp/boost exists
#
# Author: Artem S. Tashkinov
# Created at: Sun 05 Jan 2020 06:57:51 PM
# Computer: localhost.localdomain
# System: Linux 5.4.2-zen2 on x86_64
#
# Copyright (c) 2020 Artem S. Tashkinov All rights reserved.
#----------------------------------------------------------------------
interval=10
apps="^gcc|^cpp|^ld|^make|^configure|^cmake"
fileon=/tmp/boost
handler=/sys/devices/system/cpu/cpufreq/boost
while :; do
test ! -f "$handler" && echo "CPU frequency subsystem failure: boost not found" && exit 1
result=`ps axco command | egrep "$apps"`
if [ -n "$result" -o -f "$fileon" ]; then
echo 1 > "$handler"
else
echo 0 > "$handler"
fi
sleep $interval
done