mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
Tweak/unbreak my CPUFreq experiment (#4119)
* Only switch to ondemand when we actually can, and when it's better than the current governor... This potentially leaves Mk.5 in the lurch, but there's no perfect solution there :/. * Switch to UI for the unmark event of navigation hints markers Might help on non-REAGL devices, and doesn't hurt there (re #3983). * Switch SQLite DBs to WAL Sounds nice in theory, behaves fine in practice.
This commit is contained in:
@@ -497,7 +497,7 @@ function ReaderRolling:onGotoXPointer(xp, marker_xp)
|
||||
-- documents): we drew our black marker in the margin, we
|
||||
-- can just draw a white one to make it disappear
|
||||
Screen.bb:paintRect(0, screen_y, marker_w, marker_h, Blitbuffer.COLOR_WHITE)
|
||||
Screen["refreshFast"](Screen, 0, screen_y, marker_w, marker_h)
|
||||
Screen["refreshUI"](Screen, 0, screen_y, marker_w, marker_h)
|
||||
end
|
||||
UIManager:scheduleIn(marker_setting, self.unmark_func)
|
||||
end
|
||||
|
||||
@@ -7,9 +7,21 @@ KOREADER_DIR="${0%/*}"
|
||||
# we're always starting from our working directory
|
||||
cd "${KOREADER_DIR}" || exit
|
||||
|
||||
# Switch to a sensible CPUFreq governor, even if the HW appears not to give an actual fuck about this...
|
||||
ORIG_CPUFREQ_GOV="$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)"
|
||||
echo "ondemand" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
|
||||
# Attempt to switch to a sensible CPUFreq governor when that's not already the case...
|
||||
current_cpufreq_gov="$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)"
|
||||
# NOTE: We're being fairly conservative here, because what's used and what's available varies depending on HW...
|
||||
if [ "${current_cpufreq_gov}" != "ondemand" ] && [ "${current_cpufreq_gov}" != "interactive" ]; then
|
||||
# NOTE: Go with ondemand, because it's likely to be the lowest common denominator.
|
||||
# Plus, interactive is hard to tune right, and only really interesting when it's a recent version,
|
||||
# which I somehow doubt is the case anywhere here...
|
||||
if grep -q ondemand /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors; then
|
||||
ORIG_CPUFREQ_GOV="${current_cpufreq_gov}"
|
||||
echo "ondemand" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
|
||||
fi
|
||||
fi
|
||||
# NOTE: That doesn't actually help us poor userspace plebs, but, short of switching to performance,
|
||||
# I don't really have a golden bullet here... (conservative's rubberbanding is terrible, so that's a hard pass).
|
||||
# All I can say is that userspace is a terrible idea and behaves *very* strangely (c.f., #4114).
|
||||
|
||||
# update to new version from OTA directory
|
||||
ko_update_check() {
|
||||
@@ -136,8 +148,10 @@ while [ $RETURN_VALUE -eq 85 ]; do
|
||||
RETURN_VALUE=$?
|
||||
done
|
||||
|
||||
# Restore original CPUFreq governor...
|
||||
echo "${ORIG_CPUFREQ_GOV}" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
|
||||
# Restore original CPUFreq governor if need be...
|
||||
if [ -n "${ORIG_CPUFREQ_GOV}" ]; then
|
||||
echo "${ORIG_CPUFREQ_GOV}" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
|
||||
fi
|
||||
|
||||
if [ "${FROM_NICKEL}" = "true" ]; then
|
||||
if [ "${FROM_KFMON}" != "true" ]; then
|
||||
|
||||
@@ -138,6 +138,8 @@ end
|
||||
|
||||
function BookInfoManager:createDB()
|
||||
local db_conn = SQ3.open(self.db_location)
|
||||
-- Make it WAL
|
||||
db_conn:exec("PRAGMA journal_mode=WAL;")
|
||||
-- Less error cases to check if we do it that way
|
||||
-- Create it (noop if already there)
|
||||
db_conn:exec(BOOKINFO_DB_SCHEMA)
|
||||
|
||||
@@ -266,6 +266,8 @@ function ReaderStatistics:partialMd5(file)
|
||||
end
|
||||
|
||||
function ReaderStatistics:createDB(conn)
|
||||
-- Make it WAL
|
||||
conn:exec("PRAGMA journal_mode=WAL;")
|
||||
local sql_stmt = [[
|
||||
CREATE TABLE IF NOT EXISTS book
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user