Memory Stress Testing
Posted: Wed May 16, 2007 1:12 pm
For testing some hard&software problems,
these small util comes very handy.
You can specify the memory in Mbyte,
it will be continously written and
randomly Read.
The Code is too easy, that i post only the sourcecode here:
Should be Compatible with all PB plattform Versions (Win,Lin and OSX)
but only tested with the Windows one.
Could someone test on other plattforms ?
ok, for all gurus, yes you can start Office twice,
should be the same effect
these small util comes very handy.
You can specify the memory in Mbyte,
it will be continously written and
randomly Read.
The Code is too easy, that i post only the sourcecode here:
Should be Compatible with all PB plattform Versions (Win,Lin and OSX)
but only tested with the Windows one.
Could someone test on other plattforms ?
Code: Select all
;Mem-Stress Test, By Siegfried Rings
;
Global Abort
Procedure Stress(MB)
SizeInBytes=MB * 1024 *1024
If SizeInBytes>0
mem=AllocateMemory(SizeInBytes)
*pByte.byte
If mem
PrintN("MemoryblockSize="+Str(SizeInBytes)+" bytes")
Repeat
c+1
If c>(1024*100):C=0:EndIf
ConsoleLocate(10, 6) : PrintN("Count:" +Str(c))
ConsoleLocate(20, 10): PrintN("Key To abort")
For I=0 To SizeInBytes -1
*pByte= Mem + I
wert=Random(255)
*pByte\b=wert
If abort=1
Break
EndIf
wert=PeekB(mem + (Random(Sizeinbytes-1)) )
p+1
If P>(1024*1024 )
t+1
P=0
ConsoleLocate(10, 10)
Select t
Case 1
PrintN("|")
Case 2
PrintN("/")
Case 3
PrintN("-")
Case 4
PrintN("\")
Case 5
PrintN("|")
Case 6
PrintN("/")
Case 7
PrintN("-")
Case 8
PrintN("\")
t=0
EndSelect
EndIf
Next i
Until Abort=1
Else
PrintN("Cannot alloc " + Str(MB) + " mb memory")
EndIf
PrintN("end of stress-thread")
EndIf
EndProcedure
OpenConsole()
EnableGraphicalConsole(1)
swert.s=ProgramParameter(0)
If swert=""
PrintN("Memstress.exe SizeInMByte" )
Else
sizeinMB=Val(swert )
If sizeinmb>2046
sizeinmb=2046
EndIf
ClearConsole()
PrintN("Memstress V1.0 by S.Rings " )
CreateThread(@Stress(),sizeinMB)
Delay(1000)
Repeat
If Inkey()<>""
PrintN("Aborting..")
Abort=1
EndIf
Delay(1)
Until Abort=1
EndIf
CloseConsole()
should be the same effect
