| || |
Hig CPU Load Generator on Windows7 (Virtual Machine)
I have a requirement to test some alarm mechanizm that gets triggered when CPU utilization is 90% consistently for atleast 1 hour.
I tried many ways in order to burn the CPU to 90% but no luck
-> downladed free utilities from internet but none of them found to be useful as cpu% utilization is fluctuating between 20% -50% and that too for a short duration around 10 minutes
-> written some indefinite loops inside a .bat to run but still able to get a max of 30% cpu consistently (short duration again)
My PC has 2 processors in it. Please can someone suggest me how to mitigate this.
Prefer to make multithreaded java program with disk operation.
But quick bit ;
Step1: create a textfile with huge text in it at "C:\Test\myFile.txt". Copy the below code in systemDie.vbs (anywhere) and double click on that.
Hope it will kick your condition.
startTimer = Timer
Const ForReading = 1
Dim fso, MyFile
For i = 1 To 1000000 Step 1
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile =fso.OpenTextFile("C:\Test\myFile.txt", ForReading, True)
Set MyFile2 =fso.OpenTextFile("C:\Test\myFile.txt", 8, True)
Do While MyFile.AtEndOfStream <> True
retstring = MyFile.ReadLine
mystr= split(retstring," ")
mystr(0) = retstring & mystr(0)
Yogi, thank you for your quick reply.
However i am facing an error (unable to attach).
Error: Subscript out of range: [number:0]
Source: Microsoft VBScript runtime error
Code working for me.
Text in file "This is test this is test ...."
You can also start system virus scan , with running this program. and also invoke same replica of program with multiple instances.
Its working fine but the utilisation associated to this process is not going beyond 50% (fluctuating often). my requiriment is to generate a single process (not multiple processes to sum up 90%) utilization for atelast 1 hour.
myFile2.txt and systemDie2.vbs
myFile3.txt and systemDie3.vbs
myFile4.txt and systemDie4.vbs
myFile5.txt and systemDie5.vbs
and run same time ...
but you may be out of memory as well , as this program leaking memory as well.
Test on a physical machine first, before you move it to a virtual machine. You will have issues if you first test on the VM depending upon how the CPU affinity is set in the hypervisor, to pin to a specific processor or to float within a range of use. If you want an authoritative reference on CPU use in a virtual machine environment then you need to inquire to the hypervisor as to how much has been allocated to a virtual machine vs how much is in use - you won't get a solid reference value inside of the VM for your testing.
Last edited by jpulley3; 06-21-2013 at 06:22 AM.
Can't you just use empty transaction markers + vusers + pacing/think time to eat up the cpu? Just add on vusers running empty transaction marker script until it gets above 90 then leave it.
Thank you all for your inputs.