Skip to content

Commit

Permalink
DEV 20200419
Browse files Browse the repository at this point in the history
wipev2:结果导出:更改导出json三档模式的对应性能评分
wipev2:配置文件:降低孤立卡顿权重,重点关注连续卡顿
配置文件生成器:下调9810 9820滑动时的最低频率
once:uperf限制在background cgroup
once:修复默认模式设定滞后于uperf启动
安装脚本:去除伪装为system binary

Signed-off-by: Matt Yang <[email protected]>
  • Loading branch information
yc9559 committed Apr 19, 2020
1 parent fd48d8f commit b39cf6a
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 41 deletions.
14 changes: 10 additions & 4 deletions magisk/common/service.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/system/bin/sh
# Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/...
# This will make your scripts compatible even if Magisk change its mount point in the future
MODDIR=${0%/*}

sh $MODDIR/run_uperf.sh
BASEDIR="$(dirname $(readlink -f "$0"))"
SCRIPT_DIR="$BASEDIR/script"

if [ "$(cat $SCRIPT_DIR/pathinfo.sh | grep "$PATH")" == "" ]; then
echo "" >> $SCRIPT_DIR/pathinfo.sh
echo "# prefer to use busybox provided by magisk" >> $SCRIPT_DIR/pathinfo.sh
echo "PATH=$PATH" >> $SCRIPT_DIR/pathinfo.sh
fi

sh $BASEDIR/initsvc_uperf.sh
19 changes: 19 additions & 0 deletions magisk/initsvc_uperf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/vendor/bin/sh
# Uperf Service Script
# https://github.com/yc9559/
# Author: Matt Yang
# Version: 20200401

BASEDIR="$(dirname $(readlink -f "$0"))"

wait_until_login()
{
# we doesn't have the permission to rw "/sdcard" before the user unlocks the screen
while [ ! -d "/sdcard/Android" ]; do
sleep 2
done
}

wait_until_login
sleep 5
sh $BASEDIR/run_uperf.sh
3 changes: 0 additions & 3 deletions magisk/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ on_install()
# use universal setup.sh
sh $MODPATH/setup_uperf.sh
[ "$?" != "0" ] && abort
# pretend to be system binary
mkdir -p $MODPATH/system/bin
cp $MODPATH/bin/uperf $MODPATH/system/bin
# use once
rm $MODPATH/setup_uperf.sh
}
Expand Down
2 changes: 1 addition & 1 deletion magisk/module.prop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id=uperf
name=Uperf
version=DEV 20200416
version=DEV 20200419
versionCode=1
author=Matt Yang
description=Userspace performance controller for android. Repo: https://github.com/yc9559/uperf/
Expand Down
18 changes: 1 addition & 17 deletions magisk/run_uperf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,6 @@
BASEDIR="$(dirname $(readlink -f "$0"))"
SCRIPT_DIR="$BASEDIR/script"

wait_until_login()
{
# we doesn't have the permission to rw "/sdcard" before the user unlocks the screen
while [ ! -d "/sdcard/Android" ]; do
sleep 2
done
}

if [ "$(cat $SCRIPT_DIR/pathinfo.sh | grep "$PATH")" == "" ]; then
echo "" >> $SCRIPT_DIR/pathinfo.sh
echo "# prefer to use busybox provided by magisk" >> $SCRIPT_DIR/pathinfo.sh
echo "PATH=$PATH" >> $SCRIPT_DIR/pathinfo.sh
fi

# support vtools
cp -af $SCRIPT_DIR/vtools-powercfg.sh /data/powercfg.sh
cp -af $SCRIPT_DIR/vtools-powercfg.sh /data/powercfg-base.sh
Expand All @@ -31,7 +17,5 @@ chmod 755 /data/powercfg-base.sh
echo "sh $SCRIPT_DIR/powercfg_main.sh \"\$1\"" >> /data/powercfg.sh

# not relying on executable permissions
wait_until_login
sleep 10
sh $SCRIPT_DIR/powercfg_once.sh
sh $SCRIPT_DIR/powercfg_main.sh
sh $SCRIPT_DIR/powercfg_once.sh
17 changes: 7 additions & 10 deletions magisk/script/libuperf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Uperf Library
# https://github.com/yc9559/
# Author: Matt Yang
# Version: 20200413
# Version: 20200418

BASEDIR="$(dirname "$0")"
. $BASEDIR/pathinfo.sh
Expand Down Expand Up @@ -47,18 +47,15 @@ uperf_stop()

uperf_start()
{
# CANNOT LINK EXECUTABLE ".../bin/uperf": "/apex/com.android.runtime/lib64/libc++.so" is 64-bit instead of 32-bit
# ...because LD_LIBRARY_PATH=":/apex/com.android.runtime/lib64"
# LD_LIBRARY_PATH=""

# raise inotify limit
lock_val "131072" /proc/sys/fs/inotify/max_queued_events
lock_val "131072" /proc/sys/fs/inotify/max_user_watches
lock_val "1024" /proc/sys/fs/inotify/max_user_instances

# pretend to be system binary
local uperf_bin_path
uperf_bin_path="$MODULE_PATH/$UPERF_REL/$UPERF_NAME"
[ -f "/system/bin/$UPERF_NAME" ] && uperf_bin_path="/system/bin/$UPERF_NAME"
"$uperf_bin_path" -o "$uperf_log_path" "$uperf_config_path" 2>> "$uperf_log_path"
# start uperf
"$MODULE_PATH/$UPERF_REL/$UPERF_NAME" -o "$uperf_log_path" "$uperf_config_path" 2>> "$uperf_log_path"
# waiting for uperf initialization
sleep 1
# uperf shouldn't preempt foreground tasks
change_task_cgroup "$UPERF_NAME" "background" "cpuset"
}
2 changes: 1 addition & 1 deletion magisk/script/powercfg_main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ save_panel()
write_panel ""
write_panel "Uperf https://github.com/yc9559/uperf/"
write_panel "Author: Matt Yang"
write_panel "Version: DEV 20200416"
write_panel "Version: DEV 20200419"
write_panel "Last performed: $(date '+%Y-%m-%d %H:%M:%S')"
write_panel ""
write_panel "[Uperf status]"
Expand Down
1 change: 0 additions & 1 deletion magisk/script/powercfg_once.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,3 @@ lock_val "25" $LPM/bias_hyst

# start uperf once only
uperf_start
sleep 1
8 changes: 4 additions & 4 deletions magisk/setup_uperf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Uperf Setup
# https://github.com/yc9559/
# Author: Matt Yang & cjybyjk ([email protected])
# Version: 20200416
# Version: 20200419

BASEDIR="$(dirname $(readlink -f "$0"))"

Expand Down Expand Up @@ -239,7 +239,7 @@ uperf_print_banner()
echo ""
echo "* Uperf https://github.com/yc9559/uperf/"
echo "* Author: Matt Yang"
echo "* Version: DEV 20200416"
echo "* Version: DEV 20200419"
echo ""
}

Expand All @@ -258,8 +258,8 @@ uperf_install()
if [ "$cfgname" != "unsupported" ]; then
echo "- The platform name is $target. Use $cfgname.json"
_setup_platform_file "$cfgname"
_set_perm_recursive $BASEDIR 0 0 0755 0644 u:object_r:rootfs:s0
_set_perm_recursive $BASEDIR/bin 0 0 0755 0755 u:object_r:rootfs:s0
_set_perm_recursive $BASEDIR 0 0 0755 0644
_set_perm_recursive $BASEDIR/bin 0 0 0755 0755
# in case of set_perm_recursive is broken
chmod 0755 $BASEDIR/bin/*
else
Expand Down

0 comments on commit b39cf6a

Please sign in to comment.