On Tue, 31 May 2011, Soho Soho123 wrote: > Dear Alan, > > Thanks a lot for your comments! > In advance, we have further question about scan_periodic(). we can see > several time for "restart" label. The count is about 11 ~ 23. As your > comment, "it should run only twice" ===> does it mean: the first time > "modified" is true, then goto restart, in 2nd, "modified" is false > (all of itd has complete), then go next, right? > So, we can see the cpu cycle is very much when the count of restart is > increase. Do you have idea about this phenomenon? The big "for" loop iterates through microframes. In your test, each URB has 32 usb_iso_packet_descriptor structures and the interval is 1 microframe, which means the URB will take 32 microframes (or 4 frames) to execute. Each iTD can hold 8 transfer descriptions, but since the transfers don't start at a frame boundary, each URB must use 5 iTDs. There should be an interrupt every time an URB completes, that is, every 4 ms. While processing this interrupt, the Q_TYPE_ITD code will run approximately 40 times and itd_complete() will be called 5 times. But itd_complete() will return True for only one of those calls, the call that corresponds to the last transfer of the URB. This means the "goto restart" statement should be executed only once per interrupt, and the "restart" line itself should be executed about 41 times per interrupt. The uvcvideo callback is invoked when itd_complete() returns True. That's when most of the CPU time should be used up. Are there high-precision timestamps available on your platform? The usbmon output you posted did not have high-precision timestamps. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html