What is the best way of implementation ?

Hi all

I have a question about implementation . This is about driver performance
issue. I have a bus driver with child as Usb audio device.

Case 1 : If I just forward the request by creating a new Irp when ever there
is an Iso Out / In Irp for Usb audio device and send the new Irp to next
layer . ( peak cpu usage is 21 %)

Case 2 : Create a pool of Irp’s, buffers , Urb’s and a thread manages the
Iso Irp’s that are coming down from top layers, get a available Irp from the
free pool and fill it up with parameters when ever there is a request .
After sending the data the Irp’s are returned to free pool. (peak cpu usage
is 34 %)

In case of “case 1”, the Irp is created dynamically , in case of “Case 2” it
try to use the existing resources and manage the rest through a thread .

Can somebody let me know their opinion about which method is good one. “Case
2” was required to stop OS crashing on surprise removal on some conditions,
but this method is causing performance problems.

This problem is occuring on Windows XP OS, on Windows 2k there is not much
difference in cpu usage on either case.

Thanks in advance,
sri.

The only thing I could contribute is that according to a google search I did
IoAllocate/IoFreeIrp is probably already done from a lookasidelist, so you
would gain nothing by doing it yourself (except on 98/Me?):

“I doubt you will gain anything, compared to plain IoAllocateIrp/IoFreeIrp.
Most of the time these functions just return a preallocated IRP from a
lookaside list, which is very fast.”

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=%23uG9lUFYCHA.163
6%40tkmsftngp10&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DISO-8859-1%26q%
3DIoInitializeIrp%26btnG%3DGoogle%2BSearch%26meta%3Dgroup%253Dmicrosoft.publ
ic.development.device.drivers
----- Original Message -----
From: “Deevi, Srinivasa”
To: “NT Developers Interest List”
Sent: Tuesday, April 08, 2003 2:02 PM
Subject: [ntdev] What is the best way of implementation ?

> Hi all
>
> I have a question about implementation . This is about driver performance
> issue. I have a bus driver with child as Usb audio device.
>
> Case 1 : If I just forward the request by creating a new Irp when ever
there
> is an Iso Out / In Irp for Usb audio device and send the new Irp to next
> layer . ( peak cpu usage is 21 %)
>
> Case 2 : Create a pool of Irp’s, buffers , Urb’s and a thread manages the
> Iso Irp’s that are coming down from top layers, get a available Irp from
the
> free pool and fill it up with parameters when ever there is a request .
> After sending the data the Irp’s are returned to free pool. (peak cpu
usage
> is 34 %)
>
> In case of “case 1”, the Irp is created dynamically , in case of “Case 2”
it
> try to use the existing resources and manage the rest through a thread .
>
> Can somebody let me know their opinion about which method is good one.
“Case
> 2” was required to stop OS crashing on surprise removal on some
conditions,
> but this method is causing performance problems.
>
> This problem is occuring on Windows XP OS, on Windows 2k there is not much
> difference in cpu usage on either case.
>
> Thanks in advance,
> sri.
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@hotmail.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

> Case 2 : Create a pool of Irp’s, buffers , Urb’s and a thread
manages the

Iso Irp’s that are coming down from top layers, get a available Irp
from the
free pool and fill it up with parameters when ever there is a
request .
After sending the data the Irp’s are returned to free pool. (peak
cpu usage
is 34 %)

Looks like it is your additional thread which consumes the resources.
Try using state machine approach with IRPs submitted from another
IRP’s completion routine.

Max