Repository navigation
Drawing: log pen mode waits, full redraws and memory per Kindle - #346
Merged
Merged
Conversation
Diagnostics only, no behaviour change, so the drawing screen can be tuned on the Kindle Scribe, Colorsoft and K3 from real logs:
- pen mode (gzreader_penmode): each wait before ink (for the last ordinary update) and after it (QUIET) counted with its longest and a histogram (<50, 50-150, 150-300, >=300 ms); waits before ink with how long before the ordinary update and the last pause clean-up (settle) were sent; waits of 200 ms or more written as they happen, at most 20 per drawing session; one summary line at close (before the existing pen mode line).
- full redraws (repaintCanvas): timed; the first 5 written with strokes, rotation, canvas type and size, zoom; count/total/longest at close.
- each page shown: collectgarbage("count") (only read), at most 50 lines; the highest at close.
- opening: rotation and canvas type once.
Nothing is measured or built while diagnostic logging is off.
Made with goose (AI agent).
Contributor
|
This pull request is labelled
It stays out of the test builds until that is settled (rebase onto main, or onto the pull request it clashes with). |
github-actions Bot
added a commit
that referenced
this pull request
Nov 21, 2026
# Conflicts: # plugins/gzreader.koplugin/gzreader_changelog.lua
github-actions Bot
added a commit
that referenced
this pull request
Nov 21, 2026
# Conflicts: # plugins/gzreader.koplugin/gzreader_changelog.lua
github-actions Bot
added a commit
that referenced
this pull request
Nov 22, 2026
# Conflicts: # plugins/gzreader.koplugin/gzreader_changelog.lua
github-actions Bot
added a commit
that referenced
this pull request
Nov 22, 2026
# Conflicts: # plugins/gzreader.koplugin/gzreader_changelog.lua
github-actions Bot
added a commit
that referenced
this pull request
Nov 22, 2026
# Conflicts: # plugins/gzreader.koplugin/gzreader_changelog.lua
github-actions Bot
added a commit
that referenced
this pull request
Nov 22, 2026
# Conflicts: # plugins/gzreader.koplugin/gzreader_changelog.lua
github-actions Bot
added a commit
that referenced
this pull request
Nov 22, 2026
# Conflicts: # plugins/gzreader.koplugin/gzreader_changelog.lua
github-actions Bot
added a commit
that referenced
this pull request
Nov 22, 2026
# Conflicts: # plugins/gzreader.koplugin/gzreader_changelog.lua
github-actions Bot
added a commit
that referenced
this pull request
Nov 22, 2026
# Conflicts: # plugins/gzreader.koplugin/gzreader_changelog.lua
github-actions Bot
added a commit
that referenced
this pull request
Nov 22, 2026
# Conflicts: # plugins/gzreader.koplugin/gzreader_changelog.lua
github-actions Bot
added a commit
that referenced
this pull request
Nov 23, 2026
# Conflicts: # plugins/gzreader.koplugin/gzreader_changelog.lua
github-actions Bot
added a commit
that referenced
this pull request
Nov 23, 2026
# Conflicts: # plugins/gzreader.koplugin/gzreader_changelog.lua
github-actions Bot
added a commit
that referenced
this pull request
Nov 23, 2026
# Conflicts: # plugins/gzreader.koplugin/gzreader_changelog.lua
github-actions Bot
added a commit
that referenced
this pull request
Nov 23, 2026
# Conflicts: # plugins/gzreader.koplugin/gzreader_changelog.lua
github-actions Bot
added a commit
that referenced
this pull request
Nov 23, 2026
# Conflicts: # plugins/gzreader.koplugin/gzreader_changelog.lua
github-actions Bot
added a commit
that referenced
this pull request
Nov 23, 2026
# Conflicts: # plugins/gzreader.koplugin/gzreader_changelog.lua
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Diagnostics only: before the bigger drawing changes, this adds log lines that show what really happens on the drawing screen on a real Kindle Scribe, Colorsoft and K3. No behaviour change: only numbers are written (never what's drawn or written), and only while diagnostic logging is on.
What changes
All lines go through
gzreader_log(Log.info), as the existingdrawing: pen mode: …line does.1. Pen mode waits (
gzreader_penmode.lua, Scribe with Fast ink)PenMode.enter(wait for the last ordinary update before ink) andPenMode.leave(sleep up toQUIETafter ink) now also keep, for each kind: the count, the longest and a histogram (<50, 50–150, 150–300, ≥300 ms). For waits before ink they also keep how long before it the ordinary update was sent (average, min–max) and how long before it the last pause clean-up (DrawScreen:settle) ran (average). The old totals (waited_before,waited_after) don't change.drawing: pen mode: waited 250 ms before ink for an ordinary update (sent 100 ms before; the last pause clean-up 130 ms before)(or… clean-up not yet))drawing: pen mode: waited 250 ms after ink before an ordinary update(no more of these lines this time).drawing: pen mode: on …line (a separate statement, so Pen mode: a pause's update waits until the pen is away #336's line after it isn't touched):drawing: pen mode waits: before ink 28, longest 400 ms (ms: <50 1, 50-150 0, 150-300 26, >=300 1), the ordinary update sent 104 ms before on average (100-200), the last pause clean-up 900 ms before on average; after ink 1, longest 250 ms (ms: <50 0, 50-150 0, 150-300 1, >=300 0); 28 of 200 ms or moreDrawScreen:settlemarks the time (PenMode.settled()) as its first line. Nothing else insettleor inDrawScreen:applychanges.2. Full redraws (
DrawScreen:repaintCanvas)ui/time, and only while logging is on. The first 5 per session are written:drawing: full redraw 1: 40 ms, 3 strokes, rotation 0 (upright), canvas BB8 1860x2480, zoom 2.00x(zoom only when zoomed; the 5th ends with(the rest only counted))drawing: full redraws: 7, 280 ms in all, longest 40 ms; pages shown 3; Lua memory at most 23456 KBdrawing: opened, 3 pages, rotation 0 (upright), canvas BBRGB32 1860x2480, pen mode(orno pen mode)Screen:getRotationMode(). The canvas type isbb:getType(), named by matchingBlitbuffer.TYPE_*. Both are wrapped inpcall, so a value nobody can read shows as?and nothing breaks.3. Lua memory on each page shown (
DrawScreen:showPage)drawing: page 2 of 3 shown, Lua memory 23456 KB, with(opening)for the first page. At most 50 lines per session (the 50th says so). The highest value goes in the close line above.collectgarbage("count"). Nothing is collected.Files:
gzreader_penmode.lua,gzreader_drawscreen.lua,gzreader_changelog.lua("next"),tools/gzreader/tests/penmode_test.lua,tools/gzreader/tests/run_tests.lua. A trial merge with #336 (git merge-tree) clashes only in the changelog, which the beta combine settles.Tests
I haven't run the tests locally (no luajit here). CI is the check.
penmode_test.lua, a new block after the existing pen mode tests. It uses a fixed fake clock and stands in forwait,sleep,sendandreport. It checks:LONG_MAX(20), the last one marked;reportwrites nothing whileLog.enabledis false.run_tests.lua, a new block right after "a long stroke keeps up with the pen" (away from Pen mode: a pause's update waits until the pen is away #336's lines). It uses a fake screen object and a fixedDrawScreen.clock, and checks:repaintCanvasis timed and counted, and only the first 5 are written; the line has the strokes,rotation,canvas BBRGB32 1860x2480andzoom 2.00x;showPagewrites the memory line ((opening)for the first page), capped at 50;screenInfogives?when the screen has nogetRotationMode, the canvas has nogetType, either one throws an error, or either is nil;collectgarbage("collect"), and the unhook and settle lines are there.On a device
Install the test build (Settings → Updates → Test builds). Keep diagnostic logging on (the default).
Kindle Scribe (and the Colorsoft)
GZreader/app/gzreader.log).Kindle 3 (or another Kindle without a pen): open a drawing, draw a few strokes, erase one, switch pages 3 times, close, and send the log the same way. There won't be any pen mode lines there; the redraw and memory lines are what's wanted.
Lines to send back (or the whole log):
That covers:
drawing: opened, …drawing: full redraw N: …drawing: full redraws: …drawing: page N of M shown, Lua memory … KBdrawing: pen mode: waited …(Scribe only)drawing: pen mode waits: …(Scribe only)drawing: pen mode: on …anddrawing: closed; …Please also say which Kindle it was and roughly how the ink felt (late first stroke, chunks).