Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results


More Info on Driver Writing and Debugging

The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.

Check out The OSR Learning Library at:

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

minifilter IRP_MJ_READ has unstable performance

stevezhougsstevezhougs Member Posts: 8
edited July 2020 in NTFSD

In my driver,IRP_MJ_READ is like:

if(BooleanFlagOn(IrpFlags, IRP_PAGING_IO))
fltStatus = FltCheckOplock( &Fcb->Oplock, Data, NULL, NULL, NULL);
BytesToRead = ALIGNED(ULONG, Length, Fcb->SectorSize); //SectorSize = 512
Buffer = MapUserBuffer(Data);
Status = FsRtlCopyRead();

In user mode test code,like:

DWORD start = timeGetTime();
HANDLE target = CreateFileA("1G.txt");
file_size = GetFileSize(target,NULL);
do {
ReadFile(out_buffer, ONE_M,);//ONE_M = 1M
} while (read_len < file_size);
DWORD end = timeGetTime();
float speed = (file_size / ONE_M) / ((end - start) / 1000.00);

Every record is first test after computer just started.
You can see unstable performance for reading,but write has stable performance.
Why write is stable and read is so unstable?

read 1024MB need 14.05s 72.91MB/S
read 1024MB need 8.37s 122.28MB/S
read 1024MB need 7.01s 145.97MB/S
read 1024MB need 25.92s 39.51MB/S very slowly
read 1024MB need 7.28s 140.66MB/S
read 1024MB need 6.31s 162.23MB/S
read 1024MB need 23.95s 42.75MB/S very slowly
read 1024MB need 37.81s 27.08MB/S very slowly
read 1024MB need 30.85s 33.19MB/S very slowly
read 1024MB need 9.72s 105.37MB/S

write 1024MB need 10.37s 98.71MB/S
write 1024MB need 10.19s 100.53MB/S
write 1024MB need 10.50s 97.53MB/S
write 1024MB need 11.48s 89.18MB/S
write 1024MB need 11.40s 89.79MB/S
write 1024MB need 10.09s 101.46MB/S
write 1024MB need 10.09s 101.46MB/S
write 1024MB need 9.78s 104.70MB/S
write 1024MB need 11.50s 89.05MB/S

Post edited by Peter_Viscarola_(OSR) on


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Developing Minifilters 24 May 2021 Live, Online
Writing WDF Drivers 14 June 2021 Live, Online
Internals & Software Drivers 27 September 2021 Live, Online
Kernel Debugging 15 November 2021 Live, Online