I'm still looking for a simple 3D test, some graphic which is GPU but not as CPU intensive were I can measure the frame rate, any ideas please post! I was thinking of something like the openGL cube example....
I'm also looking for an idea for a memory speed test, I was thinking of lots of alloc, frees and copies but I'm not sure if that will end up just being a CPU test...
Output screen now looks like this
Code: Select all
=====================================================================
| PureBench32 v1.0 |
| by Paul Dwyer |
| and the PB community |
=====================================================================
CPU Tests:
Single thread score: 32514
Multi thread iterations: 174669
Multi thread perf increase: 5.37x
Disk:
Cached Disk Writes: 1558
Disk Reads: 69361
Grphics:
2D Graphics Score: 44071
Code: Select all
Global gIterations.l
Global MtxIterates.l
Global TimeToRun.l
Global ThreadCount.l
Global Diskpath.s
Global CloseOnEnd.l
Declare CryptSpeed(MilliSecondsToRun)
Declare GFXTest(MillisecondsToRun.l)
Declare DiskWriteSpeed(MilliSecondsToRun.l, NoCache.l = #False)
Declare DiskReadSpeed(MilliSecondsToRun.l)
Declare.s GetCMDParam(Param.s)
Declare.l GetCMDSwitch(Switch.s)
Declare Main()
MtxIterates = CreateMutex()
Main()
Procedure.s GetCMDParam(Param.s)
Param = LCase(Param)
For i = 0 To CountProgramParameters() -1
If LCase(ProgramParameter(i)) = Param
ProcedureReturn ProgramParameter(i+1)
EndIf
Next
ProcedureReturn ""
EndProcedure
Procedure.l GetCMDSwitch(Switch.s)
Switch = LCase(Switch)
For i = 0 To CountProgramParameters() -1
If LCase(ProgramParameter(i)) = Switch
ProcedureReturn #True
EndIf
Next
ProcedureReturn #False
EndProcedure
Procedure Main()
;startup
Displayheader.s = "=====================================================================" + #CRLF$
Displayheader.s = Displayheader.s + "| PureBench32 v1.0 |" + #CRLF$
Displayheader.s = Displayheader.s + "| by Paul Dwyer |" + #CRLF$
Displayheader.s = Displayheader.s + "| and the PB community |" + #CRLF$
Displayheader.s = Displayheader.s + "=====================================================================" + #CRLF$
OpenConsole()
If GetCMDSwitch("/?") = #True ; Display help
PrintN(Displayheader)
PrintN("")
PrintN("/t Time (seconds to run per task, default = 5)")
PrintN("/p Path (location for disk read and write checks default = C:\)")
PrintN("/tc Count (thread count to use for multiple threads default = 24)")
PrintN("/c (close on finish, if not set then the dos screen will wait for a return key to end)")
PrintN("/? (this help information)")
Input()
End
EndIf
CloseOnEnd = GetCMDSwitch("/c")
TimeToRun = Val(GetCMDParam("/t"))
If TimeToRun = 0: TimeToRun = 5000: EndIf
ThreadCount = Val(GetCMDParam("/tc"))
If ThreadCount = 0: ThreadCount = 24: EndIf
Diskpath = GetCMDParam("/p")
If Len(Diskpath) < 1: Diskpath = "C:\": EndIf
If Right(diskpath,1) <> "\": Diskpath = Diskpath + "\": EndIf
;EnableGraphicalConsole(1)
PrintN(Displayheader)
PrintN("CPU Tests:")
CreateThread(@CryptSpeed(),TimeToRun)
Delay(TimeToRun + 100)
PrintN(" Single thread score: " + Str(gIterations))
TmpIterations = gIterations
Delay(20)
gIterations = 0
For i = 1 To ThreadCount
CreateThread(@CryptSpeed(),TimeToRun)
Delay(20)
Next
Delay(TimeToRun + 500)
PrintN(" Multi thread score: " + Str(gIterations))
PrintN(" Multi thread perf increase: "+ StrF((gIterations/TmpIterations ),2) + "x")
Delay(200)
PrintN("")
PrintN("Disk:")
DiskWriteSpeed(TimeToRun, #True)
PrintN(" Non Cached Disk Writes: " + Str(gIterations))
Delay(200)
DiskWriteSpeed(TimeToRun)
PrintN(" Cached Disk Writes: " + Str(gIterations))
Delay(200)
DiskReadSpeed(TimeToRun)
PrintN(" Disk Reads: " + Str(gIterations))
Delay(200)
CreateThread(@GFXTest(),TimeToRun)
Delay(TimeToRun + 200)
PrintN("")
PrintN("Grphics:")
PrintN(" 2D Graphics Score: " + Str(gIterations))
If CloseOnEnd = #False
Input()
EndIf
CloseConsole()
EndProcedure
Procedure CryptSpeed(MilliSecondsToRun.l)
BufferSize.l = 10240
*Buffer = AllocateMemory(BufferSize)
Protected IterationCount.l = 0
Protected Timer.l = ElapsedMilliseconds()
While ElapsedMilliseconds() < Timer + MilliSecondsToRun
IterationCount = IterationCount + 1
For i = 0 To BufferSize -1
PokeB(*Buffer + i,i % 255)
Next
Result = CRC32Fingerprint(*Buffer, BufferSize)
Results.s = MD5Fingerprint(*Buffer, BufferSize)
Results.s = DESFingerprint(PeekS(*Buffer), PeekS(*Buffer))
Wend
FreeMemory(*Buffer)
;MessageRequester("",Str(GetCurrentThreadId_()))
LockMutex(MtxIterates)
gIterations = gIterations + IterationCount
UnlockMutex(MtxIterates)
EndProcedure
Procedure DiskWriteSpeed(MilliSecondsToRun.l, NoCache.l = #False)
BufferSize.l = 500 * 1024
MaxFileSize.q = 10 * 1000 * 1024
Filename.s = Diskpath + "benchtempfile.tmp"
Debug Filename
*Buffer = AllocateMemory(BufferSize)
Protected IterationCount.l = 0
Protected Timer.l = ElapsedMilliseconds()
hfile.l = CreateFile(#PB_Any, Filename)
For i = 0 To BufferSize -1
PokeB(*Buffer + i,Random(255))
Next
If IsFile(hfile)
While ElapsedMilliseconds() < Timer + MilliSecondsToRun
IterationCount = IterationCount + 1
FileSeek(hfile, Random(MaxFileSize - 1) + 1)
WriteData(hfile, *Buffer, BufferSize)
If NoCache = #True
FlushFileBuffers(hfile)
EndIf
Wend
CloseFile(hfile)
DeleteFile(Filename)
EndIf
FreeMemory(*Buffer)
gIterations = IterationCount
EndProcedure
Procedure DiskReadSpeed(MilliSecondsToRun.l)
BufferSize.l = 500 * 1024
MaxFileSize.q = 10 * 1000 * 1024
Filename.s = Diskpath + "benchtempfile.tmp"
*Buffer = AllocateMemory(BufferSize)
Protected IterationCount.l = 0
hfile.l = CreateFile(#PB_Any, Filename)
FileBuffersSize(hfile, 0)
;build file
*WriteBuffer = AllocateMemory(MaxFileSize)
For i = 1 To MaxFileSize
PokeB(*WriteBuffer + i,Random(255))
Next
WriteData(hfile,*WriteBuffer,MaxFileSize)
FreeMemory(*WriteBuffer)
CloseFile(hfile)
Protected Timer.l = ElapsedMilliseconds()
hfile.l = OpenFile(#PB_Any, Filename)
If IsFile(hfile)
While ElapsedMilliseconds() < Timer + MilliSecondsToRun
IterationCount = IterationCount + 1
FileSeek(hfile, Random(MaxFileSize-BufferSize) + 1)
ReadData(hfile, *Buffer, Random(BufferSize))
Wend
CloseFile(hfile)
DeleteFile(Filename)
EndIf
FreeMemory(*Buffer)
gIterations = IterationCount
EndProcedure
Procedure GFXTest(MillisecondsToRun.l)
If OpenWindow(0, 100, 100, 640, 480, "Purebench32 Graphics test", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget)
SetActiveWindow(0)
StickyWindow(0, 1)
LoadFont(1, "Arial", 22)
StartDrawing(WindowOutput(0))
DrawingMode(#PB_2DDrawing_Transparent)
DrawingFont(FontID(1))
Protected Timer.l = ElapsedMilliseconds()
While ElapsedMilliseconds() < Timer + MilliSecondsToRun
IterationCount = IterationCount + 1
Box(Random(500)+1,Random(500)+1,Random(500)/3,Random(500)/3,Random(16777216))
Circle(Random(500)+1, Random(500)+1, Random(500)/5,Random(16777216))
DrawText(Random(450)+1, Random(450)+1, "PureBench32" , Random(16777216))
Wend
StopDrawing()
EndIf
gIterations = IterationCount
EndProcedure
