How can I produce high CPU load on Windows?

79

22

For testing purposes I need to generate high CPU load on a Windows Server 2003. I cannot install any software but have to make do with what Windows provides.

What would be the best way to achieve that?

Morgon

Posted 2012-03-03T13:18:23.980

Reputation: 791

4I usually just launch a bunch of cmd.exe instances with dir /s C:. Get 10 or so of those running at once and you get very high CPU use (70%+ across all cores of my i7-2600k) in addition to lots of disk I/O. Not perfect, but it gets the job done. – Andrew Lambert – 2012-03-04T10:59:18.823

Answers

68

consume.exe from the Windows Server 2003 Resource Toolkit can do this easily.

C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\x64>consume -cpu-time -time 5
Consume: Message: Time out after 5 seconds.
Consume: Message: Successfully assigned process to a job object.
Consume: Message: Attempting to start 256 threads ...
................................................................................
................................................................................
................................................................................
................
Consume: Message: Sleeping...

Uses 100% CPU time on all cores as long as it runs. It can also consume other resources (as the name implies).

Der Hochstapler

Posted 2012-03-03T13:18:23.980

Reputation: 77 228

The consume.exe can also be used to consume all your disk space using consume -disk-space -time 60. It's a very handy tool! When installing it as part of the Resource Toolkit, then it will be installed to C:\Program Files (x86)\Windows Resource Kits\Tools by default. – Benny Neugebauer – 2018-11-19T14:58:20.493

Nice tool, but be aware that it always starts its threads at normal priority, even if the EXE itself is started at "below normal". – EM0 – 2019-07-23T11:57:15.327

20The Resource Toolkit isn't installed by default. – HaydnWVN – 2012-03-09T13:44:59.687

What about a 2008 server ? – Jonathan Rioux – 2013-11-04T21:30:24.417

@JonathanRioux: Same solution, download the resource toolkit linked in the answer and use consume.exe. The application isn't included in any version of Windows Server by default. – Der Hochstapler – 2013-11-04T21:42:00.727

41

The following batch file does it:

@echo off
:loop
goto loop

However, if you have multiple cores, you have start multiple instances.

To stop, press Ctrl+C in the console.

quantum

Posted 2012-03-03T13:18:23.980

Reputation: 647

That was perfect. Just one execution per core. Best solutions remains simple. Thank you. BUT, i can't figure out how to check for n cores not watching for 1st loop instance %, because i got physical and cores, but not threads counter on my Windows7. (wmic cpu get NumberOfCores would be 2, and i have 4 threads, 2 cores). Im guessing to create an auto batch that fully fit the 100% CPU capacity. Best regards. – m3nda – 2015-04-05T23:53:50.077

34

IntelBurnTest and Prime95 are known for doing just this. They don't really require installation, as they can be run by unpacking their respective zips, but it doesn't fulfill your "must be native" requirement. I'm an overclocker, and these are the tools I use to ensure absolute system stability, they will generate the utmost load from your computer.

As for your want for it to be a native piece of software - windows doesn't really come with the tools to do such a thing, except for maybe the above batch file, which is going to be a mess to handle if it goes haywire. (Infinite loops can be messy.)

xenithorb

Posted 2012-03-03T13:18:23.980

Reputation: 475

1As for your want for it to be a native piece of software - windows doesn't really come with the tools to do such a thing But that’s the requirement of the question. The tools you suggested don’t fit that and so should be comments, not an answer. except for maybe the above batch file, which is going to be a mess to handle if it goes haywire. (Infinite loops can be messy Hardly. Windows includes several programming options which could easily be made to consume CPU cycles while still providing control. – Synetech – 2014-03-28T16:01:01.527

29

A tight loop in VBS with no I/O will do it. You'll need as many processes as cores. The following will use 100% on my Win2k3 VM, or 50% on my dual-core host (100% if I launch 2)

c:\test\>copy con thing.vbs
While True
Wend
^z
c:\test\>thing.vbs

You'll have to kill wscript.exe in the task manager to end it.

mgjk

Posted 2012-03-03T13:18:23.980

Reputation: 1 337

I really don't understand the code you put. Did u test it before test it? How do i need to test it. You put no so much info. I like that way, but explain a bit. No prize for laziness. – m3nda – 2015-04-05T23:44:11.020

That's the output of creating the script and running it. – mgjk – 2015-04-06T13:12:34.860

And where is the script? – m3nda – 2015-04-06T22:58:33.533

It's line 2 and 3. – mgjk – 2015-04-07T01:33:01.703

Im sorry, this is vbs not bat. My fail. This wscript takes exactly 1 thread. You'll need to run multiple instances like the bat :goto script. It's the vbs counterpart. Nice. thanks. – m3nda – 2015-04-08T06:56:44.670

9

CPUSTRES.EXE

There is an old SysInternals tool from 1996 called "CPU Stress" that still works. (I just tried it on my Windows 10 laptop.)

Custom CPU load

It's GUI based and allows you to run up to four threads at custom intensities. This allows you to tune the desired CPU load. As a rule of thumb: One thread with Activity set to Maximum will consume about 25% CPU. So as an example: If you run three threads at Maximum, your CPU load goes to about 75%.

Portable

CPUSTRES.EXE is a portable download and does not require installation.

StackzOfZtuff

Posted 2012-03-03T13:18:23.980

Reputation: 1 185

1

CPUSTRES.EXE is also recommended by Microsoft: https://blogs.msdn.microsoft.com/vijaysk/2012/10/26/tools-to-simulate-cpu-memory-disk-load/ - Very good tool!

– Benny Neugebauer – 2015-12-18T22:12:14.680

It's a nice tool, but unfortunately only allows starting 4 threads, which isn't enough to max out a modern processor (quad-core with hyper-threading). – EM0 – 2019-07-23T11:46:42.567

5

Running for /l %a in (0,0,1) do echo a in a command prompt (infinite loop printing a) has the observed effect of starting a conhost.exe running at 10-20% CPU load on Windows 7 on a low-end mobile i5. You could try running several of these in parallel, for example the following in a batch file:

start for /l %%a in (0,0,1) do echo a
start for /l %%a in (0,0,1) do echo a
start for /l %%a in (0,0,1) do echo a
start for /l %%a in (0,0,1) do echo a
start for /l %%a in (0,0,1) do echo a
start for /l %%a in (0,0,1) do echo a
start for /l %%a in (0,0,1) do echo a
start for /l %%a in (0,0,1) do echo a
start for /l %%a in (0,0,1) do echo a
start for /l %%a in (0,0,1) do echo a

That could have your CPU running at 100%. Lines can be added/removed to adjust.
Warning: Those are infinite loops, which you may have trouble closing. The numbers inside the parentheses can be replaced, e.g. (0,1,10000), for a finite loop. The last number (in the finite loop) can be adjusted to adjust the running time. In case you are wondering, it basically means "start at number 0, increment by 1 until it reaches 10000", which translates to 10000 loop cycles.

Bob

Posted 2012-03-03T13:18:23.980

Reputation: 51 526

Have you tested this? This is IO bound so I think it probably won't reach 100% CPU utilization, no matter how many instances you launch. – Ben Richards – 2012-03-03T16:18:19.623

1It could very well be system dependent. For me, it was consistently above 97% total, though with dwm.exe at 25% and all the conhosts hovering about 5-10%. In any case, mgjk's vbscript solution is more elegant. – Bob – 2012-03-03T16:29:09.870

The windows console is exceptionally slow when it comes to flooding the console. It also cause significant GUI lag that might not allow you to kill it with task manager. Note that Ctrl-C or Ctrl-Break won't work because of the data that's already out. – quantum – 2012-07-12T15:38:30.930

5

HyperPi (GUI to run SuperPi on multiple cores) can be run without installing just copy it to the server and run it from any location. Even on something fast you can load up all the cores for few hours doing say 16 simultaneous 32M place calculations.

JTotham

Posted 2012-03-03T13:18:23.980

Reputation: 111

1HyperPi (GUI to run SuperPi on multiple cores) can be run without installing just copy it to the server and run it from any location. That’s a technicality and a nitpick. When someone says “cannot install anything”, that doesn’t necessarily mean actually installing, they may not be able to run anything new. For example, there may be a system policy that blocks all programs except for those on a white-list. That would prevent even “portable” apps from running, so saying that you don’t have to install it doesn’t work. – Synetech – 2014-03-28T16:03:02.523

4

I have recently discovered and can recommend the free version of HeavyLoad:

http://www.jam-software.com/heavyload/

Does an effective job at pumping up the CPU levels to see how applications cope under duress.

AndyUK

Posted 2012-03-03T13:18:23.980

Reputation: 149

I found that prograt program very interesting. It simply works and you can also get 100% CPU using only 256Mb of ram (I do on a i5 4gb ram to your reference). The only option i miss is the GPU stress that the software promises. @AndyUK, did u found that option? – m3nda – 2015-04-06T00:24:11.453

Like they said: can’t install/run any third-party software; only built into Windows – Synetech – 2014-03-28T16:08:53.893

1

Quick, easy, PowerShell

while ($true){}

An infinite loop with no inputs or outputs; similar to Quantum's answer, if you have multiple cores, you have to start multiple instances of PowerShell running this script

ShaneC

Posted 2012-03-03T13:18:23.980

Reputation: 131

1

The way most people do it is to run something that does a load of processing - I was recommended superpi, though hyperpi might work better for a modern system. Calculate absurdly large value of pi, and it'll effectively run the processor at full load.

Alternatively you can run StressCPU which is based off folding@home

If you need to keep high loads for longer periods of time, consider something like folding@home

Journeyman Geek

Posted 2012-03-03T13:18:23.980

Reputation: 119 122

Same thing – Synetech – 2014-03-28T16:03:29.417

1

If you have no internet for that pc or can't remember the website for that cpu test, and you don't feel like scripting you can use the windows built in zip feature to compress a bunch of files or folders a bunch of times simultaneously.

Right-click the file or folder, point to Send To, and then click Compressed (zipped) Folder

You can do the same files/folder multiple times at the same time, I suggest using the windows or program files folders.

You can then unzip the files to another location and do a file compare with the fc command to check to see that all calculations occurred correctly. Though I would suggest that you use a single big file for this as the command syntax for file comparison of a lot of files with standard windows tools is annoying.

BeowulfNode42

Posted 2012-03-03T13:18:23.980

Reputation: 1 629

Impressed with that. The :goto loop on a bat sounds so much easier. And avoid the nonsense I/O usage. – m3nda – 2015-04-06T00:31:48.467

0

I publish such a tool named MultiCpuLoad.

  • Selectable load from 20% up to 90%.
  • Selectable CPUs.
  • No installation.
  • No admin rights required.

Requires .NET Framework 2.0, 3.5, or 4.5.

http://www.ristaino.net/Software/MultiCpuLoad

figolu

Posted 2012-03-03T13:18:23.980

Reputation: 111

0

Use the built-in "calc" to calculate 10000! (10000 factorial). Use two or three instances to max out a Multi-core.

awayand

Posted 2012-03-03T13:18:23.980

Reputation: 17

@Synetech Mine overflowed, using Windows 7 64 bit. I used a biginteger calculator and got this as an answer though: http://pastebin.com/AeCf1s9c

– starbeamrainbowlabs – 2014-09-04T18:36:00.593

Actually it will overflow calc.... there is a maximum value that calc would calculate, it is less than 10000 but more than 1000. – Diogo – 2012-03-06T22:19:31.637

@DiogoRocha Didn't overflow: I got 2.8462596809170545189064132121199e+35659. However, did it in less than a second on my computer. – quantum – 2012-04-08T20:39:31.177

hmmm. Mine did overflow, actually a factorial on a digital calc is made matemathically reducing to a truncated series... it is an aproximation that will reduce cpu loads. this is thee reason because you left less than 1 sec of processing.. – Diogo – 2012-04-09T00:50:30.540

I suspect whether it overflows or not may depend on whether the CPU is 32-bit or 64-bit. Either way, I don’t see how that would take up much CPU cycles. I just performed several factorials and the highest I could go was 3248!, but none of them made even a blip on Task Manager’s CPU graph, and why should it? Factorials are a very easy, very cheap mathematical operation. – Synetech – 2014-03-28T16:07:54.870