[Embedded Linux]: Performance measurement for USB device

Posted on 2011-04-26
Last Modified: 2012-08-13

I have a device connected to Ubuntu machine via USB port. Device is using embedded Linux as operating system and I can change the internals of device. I want to measure performance of the device on following terms:

Speed of transaction(s) over USB,
Power consumption of the device,
Time taken by device (specifically kernel) to loopback data

Can anyone please let me know what tool set I can use to measure performance of my device connected via USB port?


Question by:yogithite
    LVL 46

    Expert Comment

    time dd if=/dev/zero of=/dev/sdb  bs=64k   (substitute device name of the USB and cTRL-C after a minute or so).  This will give you write speed.
    For power consumption, you need to purchase an ammeter and put it inline.  Maybe $20.00 at a radio shack.

    Time for loopback??  N/A on USB.
    LVL 31

    Expert Comment

    First you need to mount usb, or it may be done automatically for you.

    Open shell.

    Go to the folder where your usb is mounted.

    Issue the following command
    time dd=/dev/zero of=file bs=1M count=10

    Open in new window

    This command transfers precisely 10MB size of file (size on disk varies).  You will also see the time it took, OS time, etc.

    With this you can make your calculations.
    LVL 46

    Accepted Solution

    Both mine and farzanjs techniques work, and bench different aspects.    Mine does raw I/O which is a pure write test.   Farzanj's test will do filesystem I/O.  This will run slower, as there will be a read component, and it will vary depending on file system parameters.

    Real-world, both are valid, and bench different aspects of performance.  You should run both.

    Expert Comment

    use the lsusb -v and it will mention the power consumption by the devices and mount sys file system and run the utility usbmon which will help to analyze the speed of transfer manually packetwise.
    LVL 12

    Expert Comment

    finegraded profiles can be achieved with linux kernel Kprobes. Also the linux kernel has many profiling options, see your kernel documentation.

    Author Comment


    Can you please let me know any examples for creating finegraded profiles?

    Also, if I want to do speed measurements then what are the methods I can look out for? Like speed during mass storage transfer etc.

    LVL 12

    Expert Comment

    You have two options: black box measurement, or internal measurement.
    The first one, you do not touch the measured device and use a good realtime environment with specifics programs to test the response. For example, take the absolute time (with us precision), send a request, wait for response and take the new absolute time.
    Another option is use an oscilloscope - this way you can test the right time without the sending/receiving overhead of your testing machine.
    With the internal measurement, you MUST "instrument" your kernel/device driver. There are none example I know of, but look carefully on google or in some book for "oprofile".
    For power consumption, you need a wattmeter or an amperometer to connect on your power supply. Better use a wattmeter, because power consumption varies with device operations.
    Maximum power consumption can also be estimated by the single chip datasheets.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    In this article we have discussed the manual scenarios to recover data from Windows 10 through some backup and recovery tools which are offered by it.
    Great sound, comfort and fit, excellent build quality, versatility, compatibility. These are just some of the many reasons for choosing a headset from Sennheiser.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now