touchy: stop pegging the X server with redundant button relayouts#4079
Open
grandixximo wants to merge 1 commit into
Open
touchy: stop pegging the X server with redundant button relayouts#4079grandixximo wants to merge 1 commit into
grandixximo wants to merge 1 commit into
Conversation
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
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.
Fixes #4070.
touchy's
periodic_radiobuttons()runs at 10 Hz and calledset_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 guardset_text()/set_active()already use everywhere else).Measured on a uspace RIP build, touchy sim under xvfb, idle:
Behaviour is unchanged: the increment and override labels still update whenever their values actually change; only the redundant same-value writes are dropped.