Skip to content

Commit

Permalink
scripts: Speed things up
Browse files Browse the repository at this point in the history
Signed-off-by: Rem01Gaming <[email protected]>
  • Loading branch information
Rem01Gaming committed Oct 5, 2024
1 parent effe9df commit ca4819c
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 78 deletions.
59 changes: 30 additions & 29 deletions src/scripts/encore-normal
Original file line number Diff line number Diff line change
Expand Up @@ -51,33 +51,31 @@ if [ -d tp_path ]; then
apply "0" $tp_path/oppo_tp_direction
fi

# I/O Tweaks
for queue in /sys/block/*/queue; do
# Fallback to latency friendly
apply 128 "$queue/read_ahead_kb"
done

# Setting perf_cpu_time_max_percent to 20
apply 20 /proc/sys/kernel/perf_cpu_time_max_percent

# Memory Tweaks
apply 120 /proc/sys/vm/vfs_cache_pressure

# CPU tweaks
for path in /sys/devices/system/cpu/cpufreq/policy*; do
apply "$default_cpu_gov" "$path/scaling_governor"
done

apply 1 /sys/devices/system/cpu/cpu1/online

# eMMC and UFS governor
for path in /sys/class/devfreq/*.ufshc; do
apply simple_ondemand $path/governor
done

done &
for path in /sys/class/devfreq/mmc*; do
apply simple_ondemand $path/governor
done
done &

# CPU tweaks
for path in /sys/devices/system/cpu/cpufreq/policy*; do
apply "$default_cpu_gov" "$path/scaling_governor"
done &
apply 1 /sys/devices/system/cpu/cpu1/online

# I/O Tweaks
for queue in /sys/block/*/queue; do
# Fallback to latency friendly
apply 128 "$queue/read_ahead_kb"
done &

# Mediatek Tweaks
if [ $soc -eq 1 ]; then
Expand Down Expand Up @@ -142,62 +140,62 @@ elif [ $soc -eq 2 ]; then
# Qualcomm CPU Bus and DRAM frequencies
for path in /sys/class/devfreq/*cpu-ddr-latfloor*; do
apply "compute" $path/governor
done
done &

for path in /sys/class/devfreq/*cpu*-lat; do
apply "mem_latency" $path/governor
done
done &

for path in /sys/class/devfreq/*cpu-cpu-ddr-bw; do
apply "bw_hwmon" $path/governor
done
done &

for path in /sys/class/devfreq/*cpu-cpu-llcc-bw; do
apply "bw_hwmon" $path/governor
done
done &

if [ -d /sys/devices/system/cpu/bus_dcvs/LLCC ]; then
max_freq=$(cat /sys/devices/system/cpu/bus_dcvs/LLCC/available_frequencies/available_frequencies | tr ' ' '\n' | sort -nr | head -n 1)
min_freq=$(cat /sys/devices/system/cpu/bus_dcvs/LLCC/available_frequencies/available_frequencies | tr ' ' '\n' | sort -n | head -n 1)
for path in /sys/devices/system/cpu/bus_dcvs/LLCC/*/max_freq; do
apply $max_freq $path
done
done &
for path in /sys/devices/system/cpu/bus_dcvs/LLCC/*/min_freq; do
apply $min_freq $path
done
done &
fi

if [ -d /sys/devices/system/cpu/bus_dcvs/L3 ]; then
max_freq=$(cat /sys/devices/system/cpu/bus_dcvs/L3/available_frequencies/available_frequencies | tr ' ' '\n' | sort -nr | head -n 1)
min_freq=$(cat /sys/devices/system/cpu/bus_dcvs/L3/available_frequencies/available_frequencies | tr ' ' '\n' | sort -n | head -n 1)
for path in /sys/devices/system/cpu/bus_dcvs/L3/*/max_freq; do
apply $max_freq $path
done
done &
for path in /sys/devices/system/cpu/bus_dcvs/L3/*/min_freq; do
apply $min_freq $path
done
done &
fi

if [ -d /sys/devices/system/cpu/bus_dcvs/DDR ]; then
max_freq=$(cat /sys/devices/system/cpu/bus_dcvs/DDR/available_frequencies/available_frequencies | tr ' ' '\n' | sort -nr | head -n 1)
min_freq=$(cat /sys/devices/system/cpu/bus_dcvs/DDR/available_frequencies/available_frequencies | tr ' ' '\n' | sort -n | head -n 1)
for path in /sys/devices/system/cpu/bus_dcvs/DDR/*/max_freq; do
apply $max_freq $path
done
done &
for path in /sys/devices/system/cpu/bus_dcvs/DDR/*/min_freq; do
apply $min_freq $path
done
done &
fi

if [ -d /sys/devices/system/cpu/bus_dcvs/DDRQOS ]; then
max_freq=$(cat /sys/devices/system/cpu/bus_dcvs/DDRQOS/available_frequencies/available_frequencies | tr ' ' '\n' | sort -nr | head -n 1)
min_freq=$(cat /sys/devices/system/cpu/bus_dcvs/DDRQOS/available_frequencies/available_frequencies | tr ' ' '\n' | sort -n | head -n 1)
for path in /sys/devices/system/cpu/bus_dcvs/DDRQOS/*/max_freq; do
apply $max_freq $path
done
done &
for path in /sys/devices/system/cpu/bus_dcvs/DDRQOS/*/min_freq; do
apply $min_freq $path
done
done &
fi

# GPU Frequency
Expand All @@ -213,7 +211,7 @@ elif [ $soc -eq 2 ]; then
# GPU Bus
for path in /sys/class/devfreq/*gpubw*; do
apply "bw_vbif" $path/governor
done
done &

# Adreno Boost
apply 1 /sys/class/kgsl/kgsl-3d0/devfreq/adrenoboost
Expand Down Expand Up @@ -254,3 +252,6 @@ elif [ $soc -eq 5 ]; then
apply $max_freq $gpu_path/scaling_max_freq
fi
fi

wait
exit 0
16 changes: 7 additions & 9 deletions src/scripts/encore-perfcommon
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
sync

# Push Notification
su -lp 2000 -c "cmd notification post -S bigtext -t 'ENCORE Tweaks' 'Tag$(date +%s)' 'Tweaks successfully applied.'"

# Start preload graphic libs
if [ $(cat /data/encore/preload_graphiclibs) -eq 1 ]; then
encore-mempreload 1 1
fi
su -lp 2000 -c "cmd notification post -S bigtext -t 'ENCORE Tweaks' 'Tag$(date +%s)' 'Tweaks successfully applied.'" &

apply() {
if [ -f $2 ]; then
Expand All @@ -26,7 +21,7 @@ for queue in /sys/block/*/queue; do

# Reduce the maximum number of I/O requests in exchange for latency
apply 64 "$queue/nr_requests"
done
done &

# Lower the swappiness
MemTotal=$(cat /proc/meminfo | grep MemTotal)
Expand All @@ -41,7 +36,7 @@ find /sys/devices/system/cpu/ -name schedutil -type d | while IFS= read -r gover
# Consider changing frequencies once per scheduling period
apply 10000 $governor/up_rate_limit_us
apply 20000 $governor/down_rate_limit_us
done
done &

# Networking tweaks
apply "cubic" /proc/sys/net/ipv4/tcp_congestion_control
Expand All @@ -57,7 +52,7 @@ apply 0 /sys/kernel/ccci/debug
# Thermal governor
for thermal in /sys/class/thermal/thermal_zone*; do
apply "step_wise" ${thermal}/policy
done
done &

# Stop tracing and debugging
apply 0 /sys/kernel/tracing/tracing_on
Expand Down Expand Up @@ -105,3 +100,6 @@ apply 0 /sys/module/mmc_core/parameters/use_spi_crc
apply 0 /sys/module/cpufreq_bouncing/parameters/enable
apply 0 /proc/task_info/task_sched_info/task_sched_info_enable
apply 0 /proc/oplus_scheduler/sched_assist/sched_assist_enabled

wait
exit 0
49 changes: 25 additions & 24 deletions src/scripts/encore-performance
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ if [ -d tp_path ]; then
apply "1" $tp_path/oppo_tp_direction
fi

# I/O Tweaks
for queue in /sys/block/*/queue; do
# Most games nowadays have big assets that requires more throughput
apply 256 "$queue/read_ahead_kb"
done

# Setting perf_cpu_time_max_percent to 3
apply 3 /proc/sys/kernel/perf_cpu_time_max_percent

Expand All @@ -61,19 +55,23 @@ apply 80 /proc/sys/vm/vfs_cache_pressure
# eMMC and UFS governor
for path in /sys/class/devfreq/*.ufshc; do
apply performance $path/governor
done

done &
for path in /sys/class/devfreq/mmc*; do
apply performance $path/governor
done
done &

# CPU tweaks
for path in /sys/devices/system/cpu/cpufreq/policy*; do
apply "$(cat /data/encore/perf_cpu_gov)" "$path/scaling_governor"
done

done &
apply 1 /sys/devices/system/cpu/cpu1/online

# I/O Tweaks
for queue in /sys/block/*/queue; do
# Most games nowadays have big assets that requires more throughput
apply 256 "$queue/read_ahead_kb"
done &

# Mediatek Tweaks
if [ $soc -eq 1 ]; then
# Force CPU to highest possible OPP
Expand Down Expand Up @@ -135,58 +133,58 @@ elif [ $soc -eq 2 ]; then
# Qualcomm CPU Bus and DRAM frequencies
for path in /sys/class/devfreq/*cpu-ddr-latfloor*; do
apply "performance" $path/governor
done
done &

for path in /sys/class/devfreq/*cpu*-lat; do
apply "performance" $path/governor
done
done &

for path in /sys/class/devfreq/*cpu-cpu-ddr-bw; do
apply "performance" $path/governor
done
done &

for path in /sys/class/devfreq/*cpu-cpu-llcc-bw; do
apply "performance" $path/governor
done
done &

if [ -d /sys/devices/system/cpu/bus_dcvs/LLCC ]; then
freq=$(cat /sys/devices/system/cpu/bus_dcvs/LLCC/available_frequencies | tr ' ' '\n' | sort -nr | head -n 1)
for path in /sys/devices/system/cpu/bus_dcvs/LLCC/*/max_freq; do
apply $freq $path
done
done &
for path in /sys/devices/system/cpu/bus_dcvs/LLCC/*/min_freq; do
apply $freq $path
done
done &
fi

if [ -d /sys/devices/system/cpu/bus_dcvs/L3 ]; then
freq=$(cat /sys/devices/system/cpu/bus_dcvs/L3/available_frequencies | tr ' ' '\n' | sort -nr | head -n 1)
for path in /sys/devices/system/cpu/bus_dcvs/L3/*/max_freq; do
apply $freq $path
done
done &
for path in /sys/devices/system/cpu/bus_dcvs/L3/*/min_freq; do
apply $freq $path
done
done &
fi

if [ -d /sys/devices/system/cpu/bus_dcvs/DDR ]; then
freq=$(cat /sys/devices/system/cpu/bus_dcvs/DDR/available_frequencies | tr ' ' '\n' | sort -nr | head -n 1)
for path in /sys/devices/system/cpu/bus_dcvs/DDR/*/max_freq; do
apply $freq $path
done
done &
for path in /sys/devices/system/cpu/bus_dcvs/DDR/*/min_freq; do
apply $freq $path
done
done &
fi

if [ -d /sys/devices/system/cpu/bus_dcvs/DDRQOS ]; then
freq=$(cat /sys/devices/system/cpu/bus_dcvs/DDRQOS/available_frequencies | tr ' ' '\n' | sort -nr | head -n 1)
for path in /sys/devices/system/cpu/bus_dcvs/DDRQOS/*/max_freq; do
apply $freq $path
done
done &
for path in /sys/devices/system/cpu/bus_dcvs/DDRQOS/*/min_freq; do
apply $freq $path
done
done &
fi

# GPU Frequency
Expand All @@ -201,7 +199,7 @@ elif [ $soc -eq 2 ]; then
# GPU Bus
for path in /sys/class/devfreq/*gpubw*; do
apply "performance" $path/governor
done
done &

# Adreno Boost
apply 3 /sys/class/kgsl/kgsl-3d0/devfreq/adrenoboost
Expand Down Expand Up @@ -239,3 +237,6 @@ elif [ $soc -eq 5 ]; then
apply $freq $gpu_path/scaling_max_freq
fi
fi

wait
exit 0
Loading

0 comments on commit ca4819c

Please sign in to comment.