Skip to content

Cache memory-chart colors, add theme changed event - #1060

Draft
tomk-amd wants to merge 4 commits into
mainfrom
tkarczew/memchart_improve
Draft

tomk-amd wants to merge 4 commits into
mainfrom
tkarczew/memchart_improve

Conversation

@tomk-amd

Copy link
Copy Markdown
Collaborator

Motivation

The memory chart would re-create a color look up structure multiple time per-frame, every time the previous C() function was called. It also would do a string look up every time to assign a color. The colors and mappings do not change unless new memory chart data is loaded. Pre-calculate all of this once, and update the colors when the theme changes.

Bonus: fix mini-map bug where colors on plot are not updated when theme changes.

Technical Details

Summary

  • Add RocEvents::kThemeChanged, emitted from ApplyUserDisplaySettings when use_dark_mode flips, so widgets that cache a palette can rebuild instead of going stale.
  • Stop rebuilding the memory-chart palette on every C() access. Keep a theme-owned palette on the view, classify arrows/items once into a color slot, and resolve ImU32s from that slot on layout/fetch and on theme change.
  • Unlabeled arrows no longer draw "N/A"; unrecognized/empty categories use a neutral (text_main) color instead of defaulting to read.
  • Rebuild the minimap event/counter bin cache on kThemeChanged so it tracks dark/light instead of staying on the startup theme.

Test plan

  • Open kernel details Memory Chart: labeled arrows still show Title: value; arrows with an empty title draw the line with no caption.
  • Confirm read/write/atomic/util/hit/stall colors still match the legend; unlabeled / uncategorized arrows use the neutral text color, not cyan read.
  • Toggle dark/light with the memory chart visible: block, arrow, label, and legend colors update without a restart.
  • Toggle dark/light with the timeline minimap visible: heatmap bins and legend update to the new theme.
  • Switch kernels / wait for metric fetch: chart values update, and missing values still show N/A on titled rows (not on unlabeled arrows).

Cache memory-chart colors instead of rebuilding the palette on every C() call.

Keep a theme-owned palette on the view and resolved colors on arrows/items,
refreshing them on kThemeChanged.

Allow arrows to have a neutral color.

Unlabeled arrows no longer draw "N/A".
…hild can be panned using scrollwheel and track pad gestures
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.

1 participant