Driver resume times patch.

Chris Ball cjb at laptop.org
Fri Mar 2 18:25:37 EST 2007


Hi,

Dave Jones mentioned that he's been using a patch to debug driver resume
times.  On the system he was testihg, it produces output like:

   device i8042 resume took 1 jiffies
   device serio0 resume took 32 jiffies
   device serio1 resume took 730 jiffies
   device usb1 resume took 32 jiffies
   device usb2 resume took 32 jiffies
   ...
   
I asked him if he could send it to me, and here's the patch.  We're 
still working on suspend/resume for hardware right now, but are hoping
to start debugging drivers in the next few weeks.

- Chris.



diff --git a/drivers/base/power/resume.c b/drivers/base/power/resume.c
index 020be36..2a4c7fe 100644
--- a/drivers/base/power/resume.c
+++ b/drivers/base/power/resume.c
@@ -10,6 +10,7 @@
 
 #include <linux/device.h>
 #include <linux/resume-trace.h>
+#include <linux/jiffies.h>
 #include "../base.h"
 #include "power.h"
 
@@ -23,6 +24,7 @@
 int resume_device(struct device * dev)
 {
 	int error = 0;
+	unsigned long start;
 
 	TRACE_DEVICE(dev);
 	TRACE_RESUME(0);
@@ -36,11 +38,17 @@ int resume_device(struct device * dev)
 	}
 	if (dev->bus && dev->bus->resume) {
 		dev_dbg(dev,"resuming\n");
+		start=jiffies;
 		error = dev->bus->resume(dev);
+		if (jiffies-start > 0)
+			printk("device %s resume took %ld jiffies\n", dev->kobj.k_name, jiffies-start);
 	}
 	if (dev->class && dev->class->resume) {
 		dev_dbg(dev,"class resume\n");
+		start=jiffies;
 		error = dev->class->resume(dev);
+		if (jiffies-start > 0)
+			printk("class %s resume took %ld jiffies\n", dev->class->name, jiffies-start);
 	}
 	up(&dev->sem);
 	TRACE_RESUME(error);


-- 
Chris Ball   <cjb at laptop.org>



More information about the Devel mailing list