Skip to content

touchy: stop pegging the X server with redundant button relayouts#4079

Open
grandixximo wants to merge 1 commit into
LinuxCNC:masterfrom
grandixximo:fix/touchy-redraw-flood
Open

touchy: stop pegging the X server with redundant button relayouts#4079
grandixximo wants to merge 1 commit into
LinuxCNC:masterfrom
grandixximo:fix/touchy-redraw-flood

Conversation

@grandixximo
Copy link
Copy Markdown
Contributor

Fixes #4070.

touchy's periodic_radiobuttons() runs at 10 Hz and called set_label() directly on six buttons (wheelinc1-3, fo, so, mv) every cycle. gtk_button_set_label() unconditionally rebuilds the button's label child and queues a resize, so even when the text is unchanged each cycle forces a full window relayout and redraw. Headless under Xvfb this pegged the X server while touchy's own Python sat idle in the GTK main loop, which is the 100%-of-one-core behaviour reported in #4070.

The fix routes those six calls through the set_label() helper that already exists in the file, which skips the call when the label is unchanged (the same guard set_text()/set_active() already use everywhere else).

Measured on a uspace RIP build, touchy sim under xvfb, idle:

before after
Xvfb CPU ~96-110% <2%
touchy CPU ~10% <2%

Behaviour is unchanged: the increment and override labels still update whenever their values actually change; only the redundant same-value writes are dropped.

periodic_radiobuttons() runs at 10 Hz and called set_label() directly on
six buttons (wheelinc1-3, fo, so, mv) every cycle. gtk_button_set_label()
unconditionally rebuilds the button's label child and queues a resize, so
even when the text is unchanged each cycle forces a full window relayout
and redraw. Headless under Xvfb this pegged the X server at ~95-110% CPU
while touchy's own Python sat idle in the GTK main loop.

Route these through the existing guarded set_label() helper, which skips
the call when the label is unchanged. Idle touchy now leaves the X server
near 0% with no change in displayed behaviour; the labels still update
when the increment or override values actually change.

Fixes LinuxCNC#4070
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

touchy: pegs one CPU core via continuous X redraw traffic at idle

1 participant