<DIV>Thanks David!</DIV>
<DIV>Good Googlin' ;-)</DIV>
<DIV>I wish I could have found this info&nbsp;a few days back.</DIV>
<DIV>I did end up writing it in C and using cygwin.&nbsp; I'm not sure how cygwin actually implements it, but it appears to work the same as on Unix systems.&nbsp; Maybe&nbsp;I could do a little "Inline" thing for Win32.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Nice thing is Perl 5 can sometimes look like C so porting to C can be easy at times.&nbsp; Long live Perl 5.</DIV>
<DIV>&nbsp;</DIV>
<DIV>thanks,</DIV>
<DIV>&nbsp; Stu<BR><BR><B><I>David Innes &lt;davidinnes@chicagoscience.com&gt;</I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">
<META content="Microsoft Word 10 (filtered)" name=Generator>
<STYLE>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {margin-right:0in;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle18
        {font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</STYLE>

<DIV class=Section1>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Hi Stewart,</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT>&nbsp;</P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Disclaimer: I’ve never done drive testing and I’m ignorant of low-level disk/file functions but…</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT>&nbsp;</P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">According to Google, it looks as though the Win32 API call FlushFileBuffers() might be equivalent to fsync.&nbsp; (<A href="http://support.microsoft.com/default.aspx?scid=kb;en-us;66052">http://support.microsoft.com/default.aspx?scid=kb;en-us;66052</A>)</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT>&nbsp;</P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">You can also open a file with no buffering with no caching using the FILE_FLAG_WRITE_THROUGH or the even deeper FILE_FLAG_NO_BUFFERING flags on the CreateFile() API call.&nbsp; (<A href="http://support.microsoft.com/default.aspx?scid=kb;en-us;99794">http://support.microsoft.com/default.aspx?scid=kb;en-us;99794</A>)</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT>&nbsp;</P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Recalling my previous disclaimer, Google also turns up a multi-platform tool called <I><SPAN style="FONT-STYLE: italic">dt</SPAN></I> at <A href="http://www.bit-net.com/~rmiller/dt.html">http://www.bit-net.com/~rmiller/dt.html</A>. &nbsp;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.</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT>&nbsp;</P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">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.&nbsp; It looks like it’s a free download but it looks like it only works on Win2k, WinXP Pro, and Win 2003 Server.&nbsp; (</SPAN></FONT><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><A href="http://www.microsoft.com/windows/sfu/productinfo/features/default.asp">http://www.microsoft.com/windows/sfu/productinfo/features/default.asp</A>) </SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT>&nbsp;</P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Dave Roth’s Windows NT/Win32 Perl Programming: The Standard Extensions book (Powels: <A href="http://www.powells.com/cgi-bin/biblio?inkey=17-157870216x-0">http://www.powells.com/cgi-bin/biblio?inkey=17-157870216x-0</A> or Amazon: <A href="http://www.amazon.com/exec/obidos/tg/detail/-/157870216X/qid=1084823355/sr=1-2/ref=sr_1_2/102-3650323-2047354?v=glance&amp;s=books">http://www.amazon.com/exec/obidos/tg/detail/-/157870216X/qid=1084823355/sr=1-2/ref=sr_1_2/102-3650323-2047354?v=glance&amp;s=books</A>) goes into a lot of detail about hacking around the Win32 APIs.</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT>&nbsp;</P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Hope one of those helps.</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- David Innes</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT>&nbsp;</P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">-----Original Message-----<BR><B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> spug-list-bounces@mail.pm.org [mailto:spug-list-bounces@mail.pm.org] <B><SPAN style="FONT-WEIGHT: bold">On Behalf Of </SPAN></B>Stuart Poulin<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Thursday, May 13, 2004 1:14 PM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> spug-list@mail.pm.org<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> SPUG: $fd-&gt;sync on Win32</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT>&nbsp;</P>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Verdana size=1><SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: Verdana">Hi Folks, </SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT>&nbsp;</P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Verdana size=1><SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: Verdana">I need to write some benchmark tools that will test various drive access to&nbsp;local disks,&nbsp;network shares, etc. on Windows and Unix.</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT>&nbsp;</P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">One part is to test fsync timing:</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT>&nbsp;</P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Verdana size=1><SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: Verdana">for ($j=0; $j&lt;NNNN; $j++){<BR>&nbsp;&nbsp;unless ($fd-&gt;syswrite($buffer, MAXBUF)){<BR>&nbsp;&nbsp;&nbsp;die "Unable to write $ARGV[0] : $!";<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;$fd-&gt;sync();</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Verdana size=1><SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: Verdana">&nbsp;}</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT>&nbsp;</P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Verdana size=1><SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: Verdana">$fd-&gt;sync Works fine on Unix but isn't implemented on Win32. $fd-&gt;sync is really what I want in this case and not $fd-&gt;flush.</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT>&nbsp;</P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Verdana size=1><SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: Verdana">Other than using cygwin.dll - anybody have an idea for Win32?</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT>&nbsp;</P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT>&nbsp;</P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Verdana size=1><SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: Verdana">Thanks,</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Verdana size=1><SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: Verdana">&nbsp;&nbsp; Stu</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT>&nbsp;</P></DIV>
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center" align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR align=center width="100%" SIZE=1>
</SPAN></FONT></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Do you Yahoo!?<BR>Yahoo! Movies - <A href="http://movies.yahoo.com/showtimes/movie?mid=1808405861">Buy advance tickets for 'Shrek 2' </A></SPAN></FONT></P></DIV></BLOCKQUOTE><p>
                <hr size=1><font face=arial size=-1>Do you Yahoo!?<br><a href="http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=24311/*http://promo.yahoo.com/sbc/">SBC Yahoo!</a> - Internet access at a great low price.