aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorczjstmax <jstmaxlol@disroot.org>2026-05-09 21:44:54 +0200
committerczjstmax <jstmaxlol@disroot.org>2026-05-09 21:44:54 +0200
commita6404ab9c36e33c73f38ea2e264568aa1eea34b4 (patch)
tree65a79a0cfd233e43ce8c8504ca4c963e8a1b01ad
v1
Signed-off-by: czjstmax <jstmaxlol@disroot.org>
-rw-r--r--README.md2
-rwxr-xr-xinstall3
-rwxr-xr-xperfmgr71
-rw-r--r--rfile1
4 files changed, 77 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..855f0ad
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+# perfmgr
+**perf**ormance**m**ana**g**e**r** is an awful python script to trade knowing useful commands for speed
diff --git a/install b/install
new file mode 100755
index 0000000..1decb21
--- /dev/null
+++ b/install
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+sudo cp ./perfmgr /usr/bin/perfmgr
+sudo ln -s /usr/bin/perfmgr /usr/bin/pfmgr
diff --git a/perfmgr b/perfmgr
new file mode 100755
index 0000000..143a23c
--- /dev/null
+++ b/perfmgr
@@ -0,0 +1,71 @@
+#!/usr/bin/python
+import sys
+import subprocess
+
+def system(cmd):
+ print(f"$ {cmd}")
+ subprocess.run(cmd, shell=True)
+
+def usage():
+ print(f"usage: {sys.argv[0]} [on|off / turbo[on|off] / info]")
+
+def main(argv) -> int:
+ argc = len(argv)
+
+ if argc < 2:
+ usage()
+ return 1
+
+ opt1 = argv[1]
+
+ if argc == 2:
+ if opt1 == "on":
+ system("sudo -E cpupower frequency-set -g powersave")
+ return 0
+ elif opt1 == "off":
+ system("sudo -E cpupower frequency-set -g performance")
+ return 0
+ elif opt1 == "info":
+ system("cpupower frequency-info")
+ return 0
+ elif opt1 == "-h" or opt1 == "--help":
+ usage()
+ return 0
+ else:
+ print(f"unknown option \'{opt1}\'")
+ return 1
+
+ elif argc >= 3:
+ opt2 = argv[2]
+
+ if opt1 == "turbo":
+ if opt2 == "on":
+ system("echo 0 | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo")
+ return 0
+ elif opt2 == "off":
+ system("echo 1 | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo")
+ return 0
+ else:
+ print(f"unknown option \'{opt2}\' for 'turbo'")
+ return 1
+ else:
+ if opt1 == "on":
+ system("sudo -E cpupower frequency-set -g powersave")
+ return 0
+ elif opt1 == "off":
+ system("sudo -E cpupower frequency-set -g performance")
+ return 0
+ elif opt1 == "info":
+ system("cpupower frequency-info")
+ return 0
+ elif opt1 == "-h" or opt1 == "--help":
+ usage()
+ return 0
+ else:
+ print(f"unknown option \'{opt1}\'")
+ return 1
+
+ return 0
+
+main(sys.argv)
+
diff --git a/rfile b/rfile
new file mode 100644
index 0000000..ea3ec70
--- /dev/null
+++ b/rfile
@@ -0,0 +1 @@
+./install