-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Matt Yang <yccy@outlook.com>
- Loading branch information
Showing
15 changed files
with
505 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,30 @@ | ||
# This file will be read by resetprop | ||
# Example: Change dpi | ||
# ro.sf.lcd_density=320 | ||
|
||
# unify surfaceflinger props | ||
debug.sf.latch_unsignaled=1 | ||
ro.surface_flinger.max_frame_buffer_acquired_buffers=3 | ||
# app phase | ||
ro.surface_flinger.vsync_event_phase_offset_ns=1000000 | ||
# SF phase | ||
ro.surface_flinger.vsync_sf_event_phase_offset_ns=1000000 | ||
# the offset in nanoseconds to add to vsync time when timestamping present fences. | ||
ro.surface_flinger.present_time_offset_from_vsync_ns=0 | ||
# early SF phase | ||
debug.sf.early_phase_offset_ns=1000000 | ||
# GL early app phase | ||
debug.sf.early_gl_phase_offset_ns=1000000 | ||
# early app phase | ||
debug.sf.early_app_phase_offset_ns=1000000 | ||
# GL early SF phase | ||
debug.sf.early_gl_app_phase_offset_ns=1000000 | ||
# GL early app phase(90Hz+) | ||
debug.sf.high_fps_early_gl_phase_offset_ns=1000000 | ||
# early SF phase(90Hz+) | ||
debug.sf.high_fps_early_phase_offset_ns=1000000 | ||
# Below defines the threshold when an offset is considered to be negative, i.e. targeting | ||
# for the N+2 vsync instead of N+1. This means that: | ||
# For offset < threshold, SF wake up (vsync_duration - offset) before HW vsync. | ||
# For offset >= threshold, SF wake up (2 * vsync_duration - offset) before HW vsync. | ||
# debug.sf.phase_offset_threshold_for_next_vsync_ns=6100000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
#!/system/bin/sh | ||
# Cgroup Library | ||
# https://github.com/yc9559/ | ||
# Author: Matt Yang | ||
# Version: 20201230 | ||
|
||
BASEDIR="$(dirname "$0")" | ||
. $BASEDIR/pathinfo.sh | ||
. $BASEDIR/libcommon.sh | ||
|
||
# avoid matching grep itself | ||
# ps -Ao pid,args | grep kswapd | ||
# 150 [kswapd0] | ||
# 16490 grep kswapd | ||
|
||
# $1:task_name $2:cgroup_name $3:"cpuset"/"stune" | ||
change_task_cgroup() | ||
{ | ||
local ps_ret | ||
ps_ret="$(ps -Ao pid,args)" | ||
for temp_pid in $(echo "$ps_ret" | grep -i "$1" | awk '{print $1}'); do | ||
for temp_tid in $(ls "/proc/$temp_pid/task/"); do | ||
comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" | ||
log "change $1/$comm($temp_tid) -> cgroup:$2" | ||
echo "$temp_tid" > "/dev/$3/$2/tasks" | ||
done | ||
done | ||
} | ||
|
||
# $1:process_name $2:cgroup_name $3:"cpuset"/"stune" | ||
change_proc_cgroup() | ||
{ | ||
local ps_ret | ||
ps_ret="$(ps -Ao pid,args)" | ||
for temp_pid in $(echo "$ps_ret" | grep -i "$1" | awk '{print $1}'); do | ||
comm="$(cat /proc/$temp_pid/comm)" | ||
log "change $comm($temp_pid) -> cgroup:$2" | ||
echo $temp_pid > "/dev/$3/$2/cgroup.procs" | ||
done | ||
} | ||
|
||
# $1:task_name $2:thread_name $3:cgroup_name $4:"cpuset"/"stune" | ||
change_thread_cgroup() | ||
{ | ||
local ps_ret | ||
ps_ret="$(ps -Ao pid,args)" | ||
for temp_pid in $(echo "$ps_ret" | grep -i "$1" | awk '{print $1}'); do | ||
for temp_tid in $(ls "/proc/$temp_pid/task/"); do | ||
comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" | ||
if [ "$(echo $comm | grep -i "$2")" != "" ]; then | ||
log "change $1/$comm($temp_tid) -> cgroup:$3" | ||
echo "$temp_tid" > "/dev/$4/$3/tasks" | ||
fi | ||
done | ||
done | ||
} | ||
|
||
# $1:task_name $2:hex_mask(0x00000003 is CPU0 and CPU1) | ||
change_task_affinity() | ||
{ | ||
local ps_ret | ||
ps_ret="$(ps -Ao pid,args)" | ||
for temp_pid in $(echo "$ps_ret" | grep -i "$1" | awk '{print $1}'); do | ||
for temp_tid in $(ls "/proc/$temp_pid/task/"); do | ||
comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" | ||
log "change $1/$comm($temp_tid) -> mask:$2" | ||
taskset -p "$2" "$temp_tid" >> $LOG_FILE | ||
done | ||
done | ||
} | ||
|
||
# $1:task_name $2:thread_name $3:hex_mask(0x00000003 is CPU0 and CPU1) | ||
change_thread_affinity() | ||
{ | ||
local ps_ret | ||
local comm | ||
ps_ret="$(ps -Ao pid,args)" | ||
for temp_pid in $(echo "$ps_ret" | grep -i "$1" | awk '{print $1}'); do | ||
for temp_tid in $(ls "/proc/$temp_pid/task/"); do | ||
comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" | ||
if [ "$(echo $comm | grep -i "$2")" != "" ]; then | ||
log "change $1/$comm($temp_tid) -> mask:$3" | ||
taskset -p "$3" "$temp_tid" >> $LOG_FILE | ||
fi | ||
done | ||
done | ||
} | ||
|
||
# $1:task_name $2:nice(relative to 120) | ||
change_task_nice() | ||
{ | ||
local ps_ret | ||
ps_ret="$(ps -Ao pid,args)" | ||
for temp_pid in $(echo "$ps_ret" | grep -i "$1" | awk '{print $1}'); do | ||
for temp_tid in $(ls "/proc/$temp_pid/task/"); do | ||
renice "$2" -p "$temp_tid" >> $LOG_FILE | ||
done | ||
done | ||
} | ||
|
||
# $1:task_name $2:thread_name $3:priority(100-x, 2-99) | ||
change_thread_rt() | ||
{ | ||
local ps_ret | ||
local comm | ||
ps_ret="$(ps -Ao pid,args)" | ||
for temp_pid in $(echo "$ps_ret" | grep -i "$1" | awk '{print $1}'); do | ||
for temp_tid in $(ls "/proc/$temp_pid/task/"); do | ||
comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" | ||
if [ "$(echo $comm | grep -i "$2")" != "" ]; then | ||
log "change $1/$comm($temp_tid) -> RT policy" | ||
chrt -f -p "$3" "$temp_tid" >> $LOG_FILE | ||
fi | ||
done | ||
done | ||
} | ||
|
||
# $1:task_name $2:thread_name | ||
pin_thread_on_pwr() | ||
{ | ||
change_thread_cgroup "$1" "$2" "background" "cpuset" | ||
} | ||
|
||
# $1:task_name $2:thread_name | ||
pin_thread_on_perf() | ||
{ | ||
change_thread_affinity "$1" "$2" "f0" | ||
} | ||
|
||
# $1:task_name $2:thread_name | ||
unpin_thread() | ||
{ | ||
change_thread_cgroup "$1" "$2" "" "cpuset" | ||
} | ||
|
||
# $1:task_name | ||
pin_proc_on_pwr() | ||
{ | ||
change_task_cgroup "$1" "background" "cpuset" | ||
} | ||
|
||
# $1:task_name | ||
pin_proc_on_perf() | ||
{ | ||
change_task_affinity "$1" "f0" | ||
} | ||
|
||
# $1:task_name | ||
unpin_proc() | ||
{ | ||
change_task_cgroup "$1" "" "cpuset" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.