[libhid-discuss] Performance of libhid

shivaprasad javali jbsp72 at gmail.com
Wed Apr 29 13:34:12 UTC 2009


I open and close the handles continuously in my test because that is how my
application behaves. While running the application the user can plug and
unplug the USB devices which have to be reflected in my application
immediately( there is a visual indicator as to how many USB devices are
plugged in). So I open new handles to the USB devices once every second.

My target platform is the OLPC(it is a small $100 Linux based laptop). In my
application a Motion sensor can be connected to the computer through the USB
device and when it is connected I read from the sensor every 5ms so that I
can detect any sort of movement across the motion sensor. The OLPC in itself
is very slow and that coupled with my requirement on the USB driver has led
the motion sensor to be very sluggish in its response.

Thanks
Shivaprasad

On Wed, Apr 29, 2009 at 5:32 PM, Charles Lepple <clepple at ghz.cc> wrote:

> On Apr 29, 2009, at 1:50 AM, shivaprasad javali wrote:
>
>  I did a small test of Opening the handles to my USB device , reading from
>> them and closing the handles 1000 times in a loop to see how long it takes.
>> The test took around 36-37 seconds on Linux where as it took around 12-13
>> seconds on the Mac. On the mac I am using the IOKit framework that mac
>> provides for the driver. As far as I can tell I am using the libhid
>> correctly and making no unnecessary calls which would slow down the driver.
>>
>
> I would consider opening and closing the handles in the loop to be
> unnecessary when benchmarking. A typical application only needs to open the
> interface one at the beginning.
>
> You should also be able to run the test using libhid on OS X, which removes
> variables related to the platform.
>
> libhid is implemented on top of libusb, which calls IOKit on OS X. That's
> an extra two layers of indirection right there - if you want direct access
> to either IOKit or the Linux hiddev API, it shouldn't be too hard to add to
> libhid.
>
> Also, the HID protocol is not necessarily high-performance to begin with,
> and you are limited by the number of USB transactions that you can initiate
> per second.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20090429/f8842b89/attachment.htm>


More information about the libhid-discuss mailing list