Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there an application designed to consume a user defined amount of CPU time? For testing purposes?

For instance, it could be set to consume 57% of available CPU time to slow down some other application sufficiently, but not too much, in order to acquire a screenshot of a transient phenomenon.

For Unix systems there is stress, "workload generator for POSIX systems. It imposes a configurable amount of CPU, memory, I/O, and disk stress on the system.".

Platform: Windows.

share|improve this question
    
If you wanted to take a slo-mo screenshot, you could just pull a frame out of a screencast using CamStudio or the like. –  digitxp Aug 27 '10 at 20:38

3 Answers 3

up vote 1 down vote accepted

There's a piece of software called Battle Encoder Shirase which is designed to do exactly this.

It functions not by consuming excess CPU time, but by rapidly suspending and resuming the target progress. It works much like a cheap dimmer switch. The result is much more consistent and predictable than something like stress, but in any case the results are pretty much the same.

Imagine 'voltage' means resumed at high, and suspended at low. If you set it to throttle the CPU of a particular process down to 25%, the process would run like so:

pulse width modulation

share|improve this answer
    
Yes, this (almost) work. Running "stress" in Cygwin with 1 process on a quad core system and limit set in Battle Encoder Shirase to 80% (20% left for the "stress" process) resulted in close to the expected CPU load of 25% x 0.2 = 3.75%. But "stress" is not suitable for this purpose as it starts a separate process for each CPU: There are only 3 targets in Battle Encoder Shirase and it can not limit for the 4th CPU on a quad core system. Battle Encoder Shirase remains the key to the solution, a program that uses 4 threads instead of 4 processes to load the CPUs is needed. –  Peter Mortensen Sep 4 '10 at 16:24
1  
I bet there are dozens of stress replacements if you look around. For example here's one: weblogs.asp.net/kennykerr/archive/2005/10/22/… –  zildjohn01 Sep 4 '10 at 16:48

The question seems difficult. I don't know of any tools which track CPU utilization and control their load according to it. I know that this was a problem for SETI@home project. They solved it by taking a time unit (can't remember if it was a second or a minute...) and have CPU loaded at 100% for one portion of it. So when user sets CPU load a 50%, half of the time unit CPU would run at 100% and other half at 0%. You can try with S@H and see if it will work for you. Link: http://setiathome.berkeley.edu

There is also Mo'Slo, but I haven't used it since DOS days and I don't know how good it works under windows. It seems it works by making the target program use less CPU time, so it isn't what you need.

share|improve this answer

CPU Burn tools usually focus on taking up all cycles.
Your requirement is interesting and I wonder if this can be done with a controlled version of the tool that will look its own CPU utilization and tune itself up or down to match a configured setting.

The classic form of the CPU burning tool is the Mersenne Prime Search.
This is the place to get its source versions.


Rambling on ideas.
As an example of self tuning I recall writing a curve-plotting tool some time back that used an approximate curve plot with increasing accuracy (more iterations/recursion to get better curves). I converted it into a 'benchmark' of sorts by measuring the time taken to compute each iteration of the curve. I wanted to keep moving the curve (think screen savers) on the screen after drawing it with a sufficient accuracy. Based on the speed of the system under test, I tuned the movement (animation) to work at something like a 25 frame rate. So, faster systems showed better curves!

What you would do with the prime search code is to add in a CPU utilization 'sensor' and use it to slow down or increase the computation rate (to approximate configured CPU utilization).

This part of the answer would probably better suit on Stackoverflow :-)
Seeing you are active there too, maybe this would interest you.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.