Google
  Web www.spinics.net

Re: [PATCH] Export URB statistics for powertop.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Thu, Oct 04, 2007 at 10:04:21AM -0400, Alan Stern wrote:
> On Wed, 3 Oct 2007, Sarah Sharp wrote:
> 
> > powertop currently tracks interrupts generated by uhci and ehci,
> > but it has no way of telling which USB device to blame interrupts on.
> > This patch exports the number of URBs that complete for a given device.
> > Cat the file 'urbnum' in /sys/bus/usb/devices/.../
> > 
> > Signed-off-by: Sarah Sharp <sarah.a.sharp@xxxxxxxxx>
> > ---
> >  drivers/usb/core/driver.c |    1 +
> >  drivers/usb/core/hcd.c    |    1 +
> >  drivers/usb/core/sysfs.c  |   11 +++++++++++
> >  include/linux/usb.h       |    1 +
> >  4 files changed, 14 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
> > index 63b1243..125406a 100644
> > --- a/drivers/usb/core/driver.c
> > +++ b/drivers/usb/core/driver.c
> > @@ -170,6 +170,7 @@ static int usb_probe_device(struct device *dev)
> >  	 * unless the driver suports autosuspend.
> >  	 */
> >  	udev->pm_usage_cnt = !(udriver->supports_autosuspend);
> > +	atomic_set(&udev->urb_cnt, 0);
> 
> This line belongs in usb_alloc_dev() in usb.c.  Putting it where you 
> did means the field will be used before it is initialized.
> 
> Did you have some particular reason for wanting to zero the counter 
> by rebinding the device?  If yes, you could keep the line here as well.

Nope, I just put the initialization in the wrong function.  I'll send an
updated patch in a bit that also incorporates Oliver's suggestion to put
the increment in usb_submit_urb().

Sarah

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
linux-usb-devel@xxxxxxxxxxxxxxxxxxxxx
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

[Home]     [Video for Linux]     [Photo]     [Yosemite Forum]     [Yosemite Photos]    [Video Projectors]     [PDAs]     [Hacking TiVo]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Devices]     [Big List of Linux Books]     [Free Dating]

  Powered by Linux