1. Home
  2. Blog
  3. Blog Post
Santanu
Santanu

General

load cpu & memory shell script c program for quick and dirty benchmark

Another TechNote

A description of cover image.

Headline: CPU Stress Test: Unveiling the Power of a Simple Script

Ever wondered about your CPU’s limits? Testing your CPU’s performance is a breeze with a straightforward script. Let’s delve into a simple empty while loop designed to load or increase your CPU usage. It’s a great way to push your CPU to its boundaries, and you can check the results using various monitoring tools.

Terminal window
while :
> do :
> done
/home/sanmisra>more memory.c
main ()
{
while ( 1 ) {
malloc (10240) ;
}
}

This script comprises an uncomplicated infinite while loop that continuously loads or spikes your CPU usage. For those curious about their CPU’s capabilities, this script serves as an effective test. Monitor and analyze your CPU’s performance with different tools to gain valuable insights. The provided code snippets showcase the simplicity and power behind this script.

In this C code, a perpetual loop allocates memory in chunks, offering another perspective on pushing the CPU’s boundaries. Feel free to experiment and see how your CPU responds to this stress test.

Read Next

12 May   2006

Friday 12th May

Blooming Boulevards and Joyful Moments in Paris

22 May   2006

Uddan - Flight

Qatar - Doha getting ready as an Aviation hub