Skip to content

apps: Adds CPU, memory, and network usage graph dock-apps.#431

Open
ideasman42 wants to merge 2 commits intophkaeser:mainfrom
ideasman42:pr-graph
Open

apps: Adds CPU, memory, and network usage graph dock-apps.#431
ideasman42 wants to merge 2 commits intophkaeser:mainfrom
ideasman42:pr-graph

Conversation

@ideasman42
Copy link
Contributor

@ideasman42 ideasman42 commented Jan 29, 2026

Adds three dock-apps that display system usage graphs:

  • wlmcpugraph: Per-CPU usage with heat-map coloring
  • wlmmemgraph: Memory usage (used/buffers/cached) with stacked display
  • wlmnetgraph: Network activity (in/out/bidirectional) with auto-scaling

Other notes:

  • The CPU graph uses a heat map, making it useful to track both for single threaded tasks and operations on systems with many of cores.
  • Most graphing functionality is shared, the implementations themselves are quite minimal.
  • Support for scaling to higher resolutions.
  • Only tested on Linux.
screenshot screenshot

Implementation

  • Almost all the logic is in a shared C source file with a fairly simple API which the commands call, with their own callbacks.
  • Attempts to balance efficiency and flexibility with a generic API that is easy enough to integrate various graphs into
  • Avoids excessive work, with graph rendering tracking areas that need to be copied when redrawing.

Known Limitations

  • There is an upper line drawn above the graph to help highlight the "max" usage for any core.
    This line is always 1 pixel high, it doesn't support fractional scaling.
  • The graph sample drawing is pixel based, so a higher resolution would need a lower update interval for an equivilant speed.
  • Increasing the resolution at run-time is supported but will temporarily show a gap where samples have not yet been calculated.
  • It's possible to set the interval faster than wayland will re-display, moving the cursor will make it redraw, I didn't investigate if there is a way around this though.

@ideasman42 ideasman42 force-pushed the pr-graph branch 10 times, most recently from aa2c0cd to 9899e3a Compare January 29, 2026 14:15
@phkaeser
Copy link
Owner

Thanks for the pull request!

To manage expectations: It might take me a few days to find capacity to review this with the quality it deserves (it's good! it's also a lot of lines! :-) ).
But excited to have these extra dockapps contributed!

@ideasman42 ideasman42 force-pushed the pr-graph branch 2 times, most recently from f8342ce to 0e952f1 Compare January 30, 2026 00:32
Copy link
Owner

@phkaeser phkaeser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for the contribution! Code looks overall well readable, and consistent with style used throughout. I left a few comments where IMHO existing libbase functionality can be used (and shorten the code a bit); minor observations only.

Additionally: As extra tools, I believe the tools should also come with a .desktop file, similar to https://github.com/phkaeser/wlmaker/blob/main/share/wlmaker.wlmclock.desktop.in.
Can you please add one for each?

#define MIN2(a, b) ((a) < (b) ? (a) : (b))

/** Returns the maximum of two values. */
#define MAX2(a, b) ((a) > (b) ? (a) : (b))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same here)

- Replace fprintf(stderr, ...) with bs_log() for consistent logging.
- Remove panic_fn callback in favor of direct bs_log.
- Use BS_MIN/BS_MAX from libbase instead of local MIN2/MAX2 macros.
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.

2 participants