mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
move logMemoryUsage from koptinterface to document
This commit is contained in:
@@ -224,8 +224,6 @@ function KoptInterface:getRFPageDimensions(doc, pageno, zoom, rotation)
|
||||
end
|
||||
|
||||
function KoptInterface:renderPage(doc, pageno, rect, zoom, rotation, gamma, render_mode)
|
||||
--DEBUG("log memory usage at renderPage")
|
||||
--self:logMemoryUsage(pageno)
|
||||
if doc.configurable.text_wrap == 1 then
|
||||
return self:renderreflowedPage(doc, pageno, rect, zoom, rotation, render_mode)
|
||||
else
|
||||
@@ -878,26 +876,4 @@ function KoptInterface:logReflowDuration(pageno, dur)
|
||||
end
|
||||
end
|
||||
|
||||
function KoptInterface:logMemoryUsage(pageno)
|
||||
local status_file = io.open("/proc/self/status", "r")
|
||||
local log_file = io.open("reflow_mem_log.txt", "a+")
|
||||
local data = -1
|
||||
if status_file then
|
||||
for line in status_file:lines() do
|
||||
local s, n
|
||||
s, n = line:gsub("VmData:%s-(%d+) kB", "%1")
|
||||
if n ~= 0 then data = tonumber(s) end
|
||||
if data ~= -1 then break end
|
||||
end
|
||||
status_file:close()
|
||||
end
|
||||
if log_file then
|
||||
if log_file:seek("end") == 0 then -- write the header only once
|
||||
log_file:write("PAGE\tMEM\n")
|
||||
end
|
||||
log_file:write(string.format("%s\t%s\n", pageno, data))
|
||||
log_file:close()
|
||||
end
|
||||
end
|
||||
|
||||
return KoptInterface
|
||||
|
||||
Reference in New Issue
Block a user