Skip to content

Feature: relative cpu, config defaults, docs#1

Merged
owaindjones merged 11 commits into
mainfrom
feature/relative-cpu-config-defaults-docs
Apr 28, 2026
Merged

Feature: relative cpu, config defaults, docs#1
owaindjones merged 11 commits into
mainfrom
feature/relative-cpu-config-defaults-docs

Conversation

@owaindjones
Copy link
Copy Markdown
Owner

No description provided.

- Rewrite CpuCollector to use per-core sysfs cpufreq data for
  frequency-weighted usage calculation (raw_usage * min(cur_freq, max_freq) /
  max_freq), returning both per_core_max and total_average instead of single f64
- Replace single CPU threshold with dual thresholds: per_core_threshold (80%)
  and total_threshold (50%)
- Embed config/rouser.toml into binary at compile time via include_str! macros;
  parse embedded TOML for fallback defaults when no config file exists
- Add --print-config CLI argument to print the embedded default configuration
- Fix inverted has_gpus() logic in DataManager initialization
- Remove dead code: unused default_update_interval/default_log_level helpers
…icate and simplify

- Fix broken logo path in docs/index.md (../docs → ./)
- Remove all Wake-on-LAN references from README.md and docs/introduction.md
  (rouser does not implement WOL functionality)
- Simplify README from ~384 lines to overview + quick start; remove duplicate
  inhibition flow, outdated config example, and detailed architecture sections
  that belong in docs/
- Update docs/configuration.md defaults to match embedded config/rouser.toml:
  per_core_threshold + total_threshold for CPU, updated EMA alphas (0.7/0.5),
  lower thresholds matching actual embedded values
- Add CONTRIBUTING.md documentation sync rule requiring docs update when
  default config changes
- Add AGENTS.md core principle to read CONTRIBUTING.md before making changes
- Remove inline TOML heredocs from both FROM_REPO and release download
  code paths in install.sh (42 lines of duplicated config removed)
- Use `rouser --print-config` to generate default config at install time,
  ensuring the installed config always matches the binary's embedded defaults
…module

- Convert test_first_collect_does_not_panic_on_none_last_stats and
  test_consecutive_collects_produce_nonzero_after_warmup from sync
  #[test] to async #[tokio::test] with .await calls
- Replace std::thread::sleep with tokio::time::sleep in warmup test
- Add "macros" feature (via full) to tokio dev-deps for #[tokio::test] support
- Remove duplicate enumerate_tests module from cpu.rs (GPU tests already
  exist properly in gpu.rs)
- Replace incorrect .min(cur, base_max) with spec-compliant
  max(current_freq, base_max_freq, peak_observed_since_startup)
- Cache all cpufreq cpuinfo_max_freq values at startup (one-time),
  eliminating ~4 file opens per core every tick that caused 'Too many
  open files' crashes on systems with many cores + NVML handles
- Add peak frequency tracking per core via peak_freqs_since_startup
- Remove unnecessary comments and fix unused import
…allback chain

- Replace Path::exists() calls in cache_base_frequencies() with direct
  reads — the read itself returns 0 on failure, making existence check
  redundant (each exists() was opening a separate stat call)
- Simplify read_runtime_cur_freq() to single sysfs file read per tick
  instead of cascading through 3 fallback paths (scaling → cpuinfo →
  non-cpufreq). Each core now opens exactly ONE file per tick.
- Remove unused std::path::Path import
- Remove non-existent 'name' field from example configs across docs
- Fix old [metrics.cpu] threshold to per_core_threshold + total_threshold format
- Update stale default value comments in quickstart, systemd-user-service, metrics-overview
- Fix configuration.md description to reference TOML (not src/config.rs) defaults
- Remove name='rouser' from averaging.md example configurations

Verified: clippy clean, 57 tests pass
Use arrays instead of vec![] for single-element containers that are
only indexed (never pushed). These only appeared with --all-targets,
matching the CI lint check exactly.
Fix the Build & CI Checklist and core principles section to always use
--all-targets, matching .github/workflows/ci.yml exactly. Prevents
future divergence where local lint misses test-code warnings.
@owaindjones owaindjones merged commit 49ffc1a into main Apr 28, 2026
9 checks passed
@owaindjones owaindjones deleted the feature/relative-cpu-config-defaults-docs branch April 28, 2026 21:08
owaindjones added a commit that referenced this pull request May 2, 2026
Bug #1: 'Predictive cooldown extension' info log fired on every tick
while extended cooldown was active because predicted_additional_time
was already set from a previous tick. Added check for
predicted_additional_time.is_zero() so the message only logs once per
transition into below-threshold state, matching how 'Sleep inhibited'
logs only fire on state transitions.

Bug #2: Predictive cooldown extension had no effect — inhibition was
released after base cooldown_duration (10s) instead of respecting the
predicted +1028s extension. The release logic checked plain
cooldown_duration first and released before reaching the predictive
branch. Replaced two-branch logic with single path using
std::cmp::max(cooldown_duration, predicted_additional_time) so the
prediction always extends (not replaces) the base cooldown period.
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