split auto-cpufreq into bin and source (core)
This commit is contained in:
parent
e2f6da6072
commit
787560c056
|
@ -1,8 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# auto-cpufreq - Automatic CPU speed & power optimizer for Linux
|
||||
#
|
||||
# Blog post: http://foolcontrol.org/?p=3124
|
||||
# auto-cpufreq - core functionality
|
||||
|
||||
import subprocess
|
||||
import os
|
||||
|
@ -382,67 +380,4 @@ def running_check():
|
|||
print("----")
|
||||
print("\nTo view live log run:\n\tauto-cpufreq --log")
|
||||
footer(79)
|
||||
sys.exit()
|
||||
|
||||
# cli
|
||||
@click.command()
|
||||
@click.option("--monitor", is_flag=True, help="Monitor and suggest CPU optimizations")
|
||||
@click.option("--live", is_flag=True, help="Monitor and make suggested CPU optimizations")
|
||||
@click.option("--install/--remove", default=True, help="Install/remove daemon for automatic CPU optimizations")
|
||||
@click.option("--log", is_flag=True, help="View live CPU optimization log made by daemon")
|
||||
@click.option("--daemon", is_flag=True, hidden=True)
|
||||
|
||||
def cli(monitor, live, daemon, install, log):
|
||||
# print --help by default if no argument is provided when auto-cpufreq is run
|
||||
if len(sys.argv) == 1:
|
||||
print("\n" + "-" * 22 + " auto-cpufreq " + "-" * 23 + "\n")
|
||||
print("Automatic CPU speed & power optimizer for Linux")
|
||||
print("\nExample usage:\npython3 " + tool_run + " --monitor")
|
||||
print("\n-----\n")
|
||||
|
||||
s.call(["python3", "auto-cpufreq.py", "--help"])
|
||||
print("\n" + "-" * 59 + "\n")
|
||||
else:
|
||||
if daemon:
|
||||
while True:
|
||||
root_check()
|
||||
gov_check()
|
||||
cpufreqctl()
|
||||
sysinfo()
|
||||
set_autofreq()
|
||||
countdown(5)
|
||||
subprocess.call("clear")
|
||||
elif monitor:
|
||||
while True:
|
||||
running_check()
|
||||
root_check()
|
||||
gov_check()
|
||||
cpufreqctl()
|
||||
sysinfo()
|
||||
mon_autofreq()
|
||||
countdown(5)
|
||||
subprocess.call("clear")
|
||||
elif live:
|
||||
while True:
|
||||
running_check()
|
||||
root_check()
|
||||
gov_check()
|
||||
cpufreqctl()
|
||||
sysinfo()
|
||||
set_autofreq()
|
||||
countdown(5)
|
||||
subprocess.call("clear")
|
||||
elif log:
|
||||
read_log()
|
||||
elif install:
|
||||
running_check()
|
||||
root_check()
|
||||
gov_check()
|
||||
deploy()
|
||||
elif remove:
|
||||
root_check()
|
||||
remove()
|
||||
|
||||
if __name__ == '__main__':
|
||||
# while True:
|
||||
cli()
|
||||
sys.exit()
|
|
@ -0,0 +1,68 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
sys.path.append('../')
|
||||
from app_source.core import *
|
||||
|
||||
# cli
|
||||
@click.command()
|
||||
@click.option("--monitor", is_flag=True, help="Monitor and suggest CPU optimizations")
|
||||
@click.option("--live", is_flag=True, help="Monitor and make suggested CPU optimizations")
|
||||
@click.option("--install/--remove", default=True, help="Install/remove daemon for automatic CPU optimizations")
|
||||
@click.option("--log", is_flag=True, help="View live CPU optimization log made by daemon")
|
||||
@click.option("--daemon", is_flag=True, hidden=True)
|
||||
|
||||
def main(monitor, live, daemon, install, log):
|
||||
# print --help by default if no argument is provided when auto-cpufreq is run
|
||||
if len(sys.argv) == 1:
|
||||
print("\n" + "-" * 32 + " auto-cpufreq " + "-" * 33 + "\n")
|
||||
print("Automatic CPU speed & power optimizer for Linux")
|
||||
print("\nExample usage:\nauto-cpufreq --monitor")
|
||||
print("\n-----\n")
|
||||
|
||||
s.call(["python3", "auto-cpufreq", "--help"])
|
||||
footer(79)
|
||||
else:
|
||||
if daemon:
|
||||
while True:
|
||||
root_check()
|
||||
gov_check()
|
||||
cpufreqctl()
|
||||
sysinfo()
|
||||
set_autofreq()
|
||||
countdown(5)
|
||||
subprocess.call("clear")
|
||||
elif monitor:
|
||||
while True:
|
||||
running_check()
|
||||
root_check()
|
||||
gov_check()
|
||||
cpufreqctl()
|
||||
sysinfo()
|
||||
mon_autofreq()
|
||||
countdown(5)
|
||||
subprocess.call("clear")
|
||||
elif live:
|
||||
while True:
|
||||
running_check()
|
||||
root_check()
|
||||
gov_check()
|
||||
cpufreqctl()
|
||||
sysinfo()
|
||||
set_autofreq()
|
||||
countdown(5)
|
||||
subprocess.call("clear")
|
||||
elif log:
|
||||
read_log()
|
||||
elif install:
|
||||
running_check()
|
||||
root_check()
|
||||
gov_check()
|
||||
deploy()
|
||||
elif remove:
|
||||
root_check()
|
||||
remove()
|
||||
|
||||
if __name__ == '__main__':
|
||||
# while True:
|
||||
main()
|
Loading…
Reference in New Issue