For windows, you should look at CreateFile function, with flags FILE_FLAG_NO_BUFFERING and FILE_FLAG_WRITE_THROUGH. ( msdn.microsoft.com/en-us/library/aa36385...).aspx ). But then you'll have to use windows functions for reading and writing : SetFilePointer, WriteFile, ReadFile.
For windows, you should look at CreateFile function, with flags FILE_FLAG_NO_BUFFERING and FILE_FLAG_WRITE_THROUGH. ( msdn.microsoft.com/en-us/library/aa36385...).aspx ). But then you'll have to use windows functions for reading and writing : SetFilePointer, WriteFile, ReadFile...
O_DIRECT doesn't even exist on Mac OS X (I just grep'd for it in /usr/include and it wasn't there). As for Linux, what will your tool do that hdparm doesn't?
Thanks. Hdparm is useful ("hdparm --direct -t" and "hdparm --direct -T" give the drive's sequential and burst transfer rates respectively), but I would also like to test random I/O patterns. – cheduardo May 29 '09 at 9:25.
I don't think it is supported by Windows - at least I can find no mention in the MSDN. This means that it presumably can;'t be supported by Cygwin either, as Cygwin needs to use the underlying Windows OS.
For future Google searches, this question is answered by this other StackOverflow question: stackoverflow.com/questions/2299402/how-....
In C file I/O, the O_DIRECT flag can be used to minimize cache effects for a file being open()ed. I understand that this is not a POSIX feature, has been present in the Linux kernel since version 2.4.10, and that Linus is opposed to the interface in general. Under NetBSD, it seems to work as advertised.
I am attempting to write some low-level disk benchmarking utilities, and using O_DIRECT looks to be a potentially good way of measuring the disk and drive performance without the effects of the OS filesystem/block cache. Ideally, I would like to be able to run the benchmark on Linux, Windows (Cygwin is OK), Mac OS X, and BSD systems. Is O_DIRECT the best way to bypass the OS disk caches, in terms of portability and reliability for benchmarking?
Are there alternatives?
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.