SPUG: $fd->sync on Win32

David Innes davidinnes at chicagoscience.com
Mon May 17 15:03:01 CDT 2004

Hi Stewart,


Disclaimer: I've never done drive testing and I'm ignorant of low-level
disk/file functions but.


According to Google, it looks as though the Win32 API call
FlushFileBuffers() might be equivalent to fsync.


You can also open a file with no buffering with no caching using the
the CreateFile() API call.


Recalling my previous disclaimer, Google also turns up a multi-platform tool
called dt at http://www.bit-net.com/~rmiller/dt.html.  It appears to require
cygwin for Windows platforms but I don't know whether that's for the test
machine only or for Windows targets as well.


Finally, depending on whether you want to run fsync only on the testing host
and not targets you may want to play around with Windows Services for UNIX,
which also lets you call fsync.  It looks like it's a free download but it
looks like it only works on Win2k, WinXP Pro, and Win 2003 Server.


Dave Roth's Windows NT/Win32 Perl Programming: The Standard Extensions book
(Powels: http://www.powells.com/cgi-bin/biblio?inkey=17-157870216x-0 or
1-2/ref=sr_1_2/102-3650323-2047354?v=glance&s=books> &s=books) goes into a
lot of detail about hacking around the Win32 APIs.


Hope one of those helps.

                        -- David Innes


-----Original Message-----
From: spug-list-bounces at mail.pm.org [mailto:spug-list-bounces at mail.pm.org]
On Behalf Of Stuart Poulin
Sent: Thursday, May 13, 2004 1:14 PM
To: spug-list at mail.pm.org
Subject: SPUG: $fd->sync on Win32


Hi Folks, 


I need to write some benchmark tools that will test various drive access to
local disks, network shares, etc. on Windows and Unix.


One part is to test fsync timing:


for ($j=0; $j<NNNN; $j++){
  unless ($fd->syswrite($buffer, MAXBUF)){
   die "Unable to write $ARGV[0] : $!";



$fd->sync Works fine on Unix but isn't implemented on Win32. $fd->sync is
really what I want in this case and not $fd->flush.


Other than using cygwin.dll - anybody have an idea for Win32?







Do you Yahoo!?
Yahoo! Movies - Buy <http://movies.yahoo.com/showtimes/movie?mid=1808405861>
advance tickets for 'Shrek 2' 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/spug-list/attachments/20040517/87aeb8cf/attachment.htm

More information about the spug-list mailing list