Skip to content

Monitors CPU usage of a process and alerts the user with a sound when it reaches or exceeds the specified limit.

License

Notifications You must be signed in to change notification settings

mikuchi9/cpu_usage_alert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Description

If an executable exceeds the specified CPU usage limit, it will alert the user with a short sine wave at a frequency of 440 Hz

Installation

  1. Install the necessary libpulse-dev package:
  • On Ubuntu/Debian:
    sudo apt-get update; sudo apt-get install libpulse-dev
  • On CentOS/Red Hat:
    sudo yum install epel-release; sudo yum install pulseaudio-libs-devel
  1. Place both cpu_usage_alert.c and play_sound.c in the same directory, and then compile them

  2. Compilation: gcc cpu_usage_alert.c play_sound.c -o cpu_usage_alert `pkg-config --cflags --libs libpulse-simple` -lm

Usage

After successful compilation, you will get the cpu_usage_alert binary. Place it in your $PATH or run it directly from the directory.

Run the program as follows:

cpu_usage_alert  pid_of_executable  cpu_limit_in_decimal  polling_frequency_in_seconds

When the executable equals or exceeds the specified CPU usage limit, the program will produce a short sound and display the current usage percentage in the console.

About

Monitors CPU usage of a process and alerts the user with a sound when it reaches or exceeds the specified limit.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages