Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934107Ab3EAA3e (ORCPT ); Tue, 30 Apr 2013 20:29:34 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:49221 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933840Ab3EAA3b (ORCPT ); Tue, 30 Apr 2013 20:29:31 -0400 Date: Wed, 1 May 2013 02:29:29 +0200 From: Pavel Machek To: Zoran Markovic Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Colin Cross , Android Kernel Team , Todd Poynor , San Mehat , Benoit Goby , John Stultz , "Rafael J. Wysocki" , Len Brown Subject: Re: [RFC PATCH] power: Add option to log time spent in suspend Message-ID: <20130501002929.GA20042@amd.pavel.ucw.cz> References: <1367360914-23389-1-git-send-email-zoran.markovic@linaro.org> <1367360914-23389-2-git-send-email-zoran.markovic@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1367360914-23389-2-git-send-email-zoran.markovic@linaro.org> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3182 Lines: 87 Hi! > From: Colin Cross > > Below is a patch from android kernel that maintains a histogram of > suspend times. Please review and provide feedback. > > Prints the time spent in suspend in the kernel log, and keeps statistics > on the time spent in suspend in /sys/kernel/debug/suspend_time > > Cc: Android Kernel Team > Cc: Colin Cross > Cc: Todd Poynor > Cc: San Mehat > Cc: Benoit Goby > Cc: John Stultz > Cc: Pavel Machek > Cc: Rafael J. Wysocki > Cc: Len Brown > Signed-off-by: Colin Cross > Signed-off-by: Todd Poynor > [zoran.markovic@linaro.org: Re-formatted suspend time table to better fit > expected values, tweaked commit message] > Signed-off-by: Zoran Markovic > +++ b/kernel/power/suspend_time.c > @@ -0,0 +1,111 @@ > +/* > + * debugfs file to track time spent in suspend > + * > + * Copyright (c) 2011, Google, Inc. > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +static struct timespec suspend_time_before; > +static unsigned int time_in_suspend_bins[32]; > + > +#ifdef CONFIG_DEBUG_FS > +static int suspend_time_debug_show(struct seq_file *s, void *data) > +{ > + unsigned int bin; > + seq_printf(s, " time (secs) count\n"); > + seq_printf(s, "------------------------------\n"); > + for (bin = 0; bin < 32; bin++) { > + if (time_in_suspend_bins[bin] == 0) > + continue; > + seq_printf(s, "%10u - %-10u %4u\n", > + bin ? 1 << (bin - 1) : 0, 1 << bin, > + time_in_suspend_bins[bin]); > + } > + return 0; > +} > + > +static int suspend_time_debug_open(struct inode *inode, struct file *file) > +{ > + return single_open(file, suspend_time_debug_show, NULL); > +} Ok, whole new driver to get timing info... As we already have times in printk, can't existing printks() get the same info? Maybe Documentation/ file describing how to get that info from dmesg would be enough? -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/