From patchwork Sun Dec 6 20:35:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arjan van de Ven X-Patchwork-Id: 65227 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nB6KXnf5031335 for ; Sun, 6 Dec 2009 20:33:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757607AbZLFUdl (ORCPT ); Sun, 6 Dec 2009 15:33:41 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757760AbZLFUdl (ORCPT ); Sun, 6 Dec 2009 15:33:41 -0500 Received: from casper.infradead.org ([85.118.1.10]:44763 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757607AbZLFUdk convert rfc822-to-8bit (ORCPT ); Sun, 6 Dec 2009 15:33:40 -0500 Received: from c-24-20-218-92.hsd1.or.comcast.net ([24.20.218.92] helo=localhost.localdomain) by casper.infradead.org with esmtpsa (Exim 4.69 #1 (Red Hat Linux)) id 1NHNnZ-000073-3Y; Sun, 06 Dec 2009 20:33:41 +0000 Date: Sun, 6 Dec 2009 12:35:52 -0800 From: Arjan van de Ven To: Linus Torvalds Cc: "Rafael J. Wysocki" , LKML , ACPI Devel Maling List , pm list , Alan Stern Subject: [PATCH] suspend: add initcall_debug style timing for suspend/resume Message-ID: <20091206123552.7be316b2@infradead.org> Organization: Intel X-Mailer: Claws Mail 3.7.3 (GTK+ 2.16.6; i586-redhat-linux-gnu) Mime-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org See http://www.infradead.org/rpr.html Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 8aa2443..2ad345c 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "../base.h" #include "power.h" @@ -172,6 +173,12 @@ static int pm_op(struct device *dev, pm_message_t state) { int error = 0; + ktime_t calltime, delta, rettime; + + if (initcall_debug) { + printk("calling %s+ @ %i\n", dev_name(dev), task_pid_nr(current)); + calltime = ktime_get(); + } switch (state.event) { #ifdef CONFIG_SUSPEND @@ -219,6 +226,14 @@ static int pm_op(struct device *dev, default: error = -EINVAL; } + + if (initcall_debug) { + rettime = ktime_get(); + delta = ktime_sub(rettime, calltime); + printk("initcall %s+ returned %d after %Ld usecs\n", dev_name(dev), + error, (unsigned long long) ktime_to_ns(delta) >> 10); + } + return error; } @@ -236,6 +251,12 @@ static int pm_noirq_op(struct device *dev, pm_message_t state) { int error = 0; + ktime_t calltime, delta, rettime; + + if (initcall_debug) { + printk("calling %s_i+ @ %i\n", dev_name(dev), task_pid_nr(current)); + calltime = ktime_get(); + } switch (state.event) { #ifdef CONFIG_SUSPEND @@ -283,6 +304,14 @@ static int pm_noirq_op(struct device *dev, default: error = -EINVAL; } + + if (initcall_debug) { + rettime = ktime_get(); + delta = ktime_sub(rettime, calltime); + printk("initcall %s_i+ returned %d after %Ld usecs\n", dev_name(dev), + error, (unsigned long long) ktime_to_ns(delta) >> 10); + } + return error; } diff --git a/include/linux/init.h b/include/linux/init.h index ff8bde5..ab1d31f 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -149,6 +149,8 @@ void prepare_namespace(void); extern void (*late_time_init)(void); +extern int initcall_debug; + #endif #ifndef MODULE