mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Kobo/Elipsa: More fine-grained control over the amount of online CPU
cores * Only keep a single core online most of the time. * Device: Add an enableCPUCores method to allow controlling the amount of online CPU cores. * Move the initial core onlining setup to Kobo:init, instead of the startup script. * Enable two CPU cores while hinting new (e.g., cache miss) pages in PDF land. * Enable two CPU cores while processing book metadata. * Drive-by fix to isolate the DocCache pressure check to KoptInterface and actually apply it when it matters most (e.g., k2pdfopt stuff).
This commit is contained in:
@@ -659,6 +659,9 @@ function BookInfoManager:collectSubprocesses()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- We're done, back to a single core
|
||||
Device:enableCPUCores(1)
|
||||
end
|
||||
|
||||
function BookInfoManager:terminateBackgroundJobs()
|
||||
@@ -698,6 +701,11 @@ function BookInfoManager:extractInBackground(files)
|
||||
|
||||
self.cleanup_needed = true -- so we will remove temporary cache directory created by subprocess
|
||||
|
||||
-- If it's the first subprocess we're launching, enable 2 CPU cores
|
||||
if #self.subprocesses_pids == 0 then
|
||||
Device:enableCPUCores(2)
|
||||
end
|
||||
|
||||
-- Run task in sub-process, and remember its pid
|
||||
local task_pid = FFIUtil.runInSubProcess(task)
|
||||
if not task_pid then
|
||||
|
||||
Reference in New Issue
Block a user