Skip to content

Latest commit

 

History

History
129 lines (91 loc) · 2.92 KB

README.md

File metadata and controls

129 lines (91 loc) · 2.92 KB

Observer

A dynamic CPU core manager for Linux systems that "intelligently" manages CPU cores based on system load and power state to help reduce power consumption.

Features

  • Dynamic core management:

    • Automatically reduces active cores when running on battery
    • Scales cores up/down based on real-time CPU load
    • Proper handling of CPU HyperThreading pairs
    • Smooth transitions between states
    • Always maintains system responsiveness with minimum core count
  • Configurable settings:

    • Battery mode core percentage
    • CPU load thresholds for scaling
    • Minimum core count
    • Check intervals
    • Core transition delays
  • System integration:

    • Runs as a systemd service
    • Graceful shutdown handling
    • Proper logging with different verbosity levels
    • Configuration file in TOML format

Installation

Quick Install

curl -sL "https://github.com/voioo/observer/releases/latest/download/observer-linux-amd64.tar.gz" | sudo bash -c 'tar xz -C /tmp && bash /tmp/install.sh'

Uninstall

curl -sL "https://raw.githubusercontent.com/voioo/observer/main/uninstall.sh" | sudo bash

Arch Linux (AUR)

yay -S observer

Manual Installation

  1. Download the appropriate archive for your architecture from the releases page
  2. Extract and install:
tar xzf observer-linux-*.tar.gz
sudo chmod +x install.sh && sudo ./install.sh

Configuration

The configuration file is located at /etc/observer/config.toml:

# Percentage of cores to enable when on battery (1-100)
battery_core_percentage = 50

# Delay in milliseconds between enabling/disabling each core
transition_delay_ms = 500

# How often to check power state and CPU load (in seconds)
check_interval_sec = 5

# CPU load threshold percentage to trigger core count adjustment
cpu_load_threshold = 40.0

# Minimum number of cores to keep enabled
min_cores = 2

Usage

Observer runs as a systemd service. Control it using:

# Start the service
sudo systemctl start observer

# Enable on boot
sudo systemctl enable observer

# Check status
sudo systemctl status observer

# View logs
sudo journalctl -u observer -f

Building from Source

Prerequisites

  • Rust toolchain (1.70.0 or newer)
  • Cargo

Build Steps

# Clone the repository
git clone https://github.com/voioo/observer.git
cd observer

# Build
cargo build --release

# Install (optional)
sudo chmod +x install.sh && sudo ./install.sh

Architecture Support

  • x86_64 (AMD64)
  • aarch64 (ARM64)
  • armv7 (32-bit ARM)

Contributing

Contributions are welcome! Check the contributing guide and feel free to submit a PR.

License

This project is licensed under the 0BSD License.

Acknowledgments

  • Inspired by various power management tools and CPU governors
  • Thanks to the Rust community for excellent crates