Jump to content

Using _WinAPI_WriteFile for disk speed test


tbaror
 Share

Recommended Posts

Hello,

i am trying to figure out _WinAPI_WriteFile syntax ,my goal is to create a script that i can determine the write block size and and even throttle IO/SEC or Mbytes/sec ,finally measure disk throughput & latency .

each operation will be measured and calculated by TimerInit /TimerDiff

i wonder if _WinAPI_WriteFile is the right function to do ,if yes i would like to get help with examples.

please advice

Thanks

Edited by tbaror
Link to comment
Share on other sites

Example of writing 1 MB of random crap with WriteFile()

#include <winapi.au3>

$handle=_WinAPI_CreateFile("test.data",1,4)

$size=1024*1024
$buffer=DllStructCreate("int["&$size/4&"]")

For $i=0 To $size/4-1
    DllStructSetData($buffer,1,Random(0,2^31-1,1),$i+1)
Next

Local $written
_WinAPI_WriteFile($handle,DllStructGetPtr($buffer),DllStructGetSize($buffer),$written)

_WinAPI_CloseHandle($handle)

:P

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...