Rank command providers by recorded cost in a recent time window

Open
#755 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
45/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
swift

Research direction

Start with ScriptWidget.record in Sources/StableBar/ScriptWidget.swift, ScriptDiagnostics in Sources/StableBar/ProviderConfiguration.swift, and the Settings → Status overview in Sources/StableBar/DiagnosticsView.swift; read the provider guide for measurement limits. Build a shared, bounded time-window aggregate from reported execution results and show its window, observation period, recorded CPU time, run counts and duration summary. Done means shared providers appear once, expired work drops out, and unavailable or unmeasured work is clearly identified.

Written by the indexing model from the issue text.

Description

enhancement needs-info

Problem

Status already shows cumulative completed-command CPU time and execution counts for each source. Those lifetime totals do not answer which user command provider has cost the most during the same recent period. A source that has run since login cannot be compared fairly with one enabled a few minutes ago, and last-run duration can miss a frequently repeated cheap command.

Users need a recent aggregate comparison of StableBar's own command sources, not another system-wide process monitor or a log of individual runs.

Proposal

Add a recent-cost ranking to the existing Settings → Status overview. Use one clearly labelled time window, such as the last 5 or 15 minutes, and show each command source's recorded completed-command CPU seconds, completed-run count/rate and duration summary for that window.

Use execution results already reported to the runner. Count a shared provider once and identify its consuming widgets. Do not poll the whole process list, add persistent traces, expose a per-run history, or introduce --logs/--follow.

Acceptance
  • All ranked sources use the same recent window, with the window and available observation period shown. Old work stops affecting the ranking once it leaves the window.
  • Ordering by recorded completed-command CPU time lets the user identify the largest recorded recent cost; run count/rate and a duration summary explain frequent or slow commands.
  • A shared provider appears once, regardless of its number of widgets or displays.
  • The UI names the metric “completed-command CPU time,” not live CPU percentage, battery impact or total source cost. Missing/unavailable accounting is explicit rather than presented as measured zero.
  • Long-running streams, native in-process work and deliberately detached descendants are not claimed to be fully measured. A stream's unrecorded live cost is not ranked as zero.
  • The feature needs no whole-process sampling or command stdout/stderr retention. Existing per-widget totals and actions remain available.

Possible today

Existing capability / workaround
  • ScriptWidget.record already accumulates CommandResult.cpuTime.
  • ScriptDiagnostics already exposes counters and duration information. Status technical details shows the cumulative CPU total and counters for one widget at a time.
  • The provider guide explicitly says that CPU time covers completed commands and is not a live meter for a running stream.
  • The performance guide explains measuring the bar and states that commands run in separate processes. Activity Monitor or Instruments can inspect those processes. A user can also take two runtime-query snapshots and compare the cumulative counters manually.

The missing capability is a same-window aggregate ranking of the recorded source costs. It is not generic CPU monitoring.

Reviewed main: 01bf12a1a67f6083342421efa090e48213fbe62e. Latest stable reviewed: 0.17.0. No CPU, battery or execution-cost measurement was performed for this request; no app interaction, build or test was run.

Related

  • #95 / #545 cover published whole-bar performance measurements and their method. They do not rank the user's command providers in the running app.
  • #233 / #234 add the system monitor's app/process CPU and memory list. That system-wide list does not attribute the runner's recorded recent work to shared provider IDs.
  • #307 was declined: the owner said Status and Send Feedback cover most debugging for now. It proposed per-run history, stderr, stream restarts/events/configuration loads, unified logging and --logs/--follow. This request excludes all of those. It is only a bounded recent aggregate of existing execution-cost counters, for comparing sources rather than replaying failures.

Triaged by OMP (closerouter/openai/gpt-6.1-sol).

Dominant language
Swift
Stars
184
Forks
12
Avg merge
3h 50m
Merged PRs (30d)
387

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Seb-GRAF/StableBar

All issues in Seb-GRAF/StableBar

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.