mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: Ming Lei <tom.leiming@gmail.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	linux-pm@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pm: Add runtime PM statistics to sysfs
Date: Fri, 9 Jul 2010 04:22:56 -0700	[thread overview]
Message-ID: <20100709042256.56e4b82f@infradead.org> (raw)
In-Reply-To: <AANLkTinJSHiDbAZJ6ga3AGNoZEFzyVPSrHkEocxa8M6N@mail.gmail.com>

On Fri, 9 Jul 2010 15:04:59 +0800
Ming Lei <tom.leiming@gmail.com> wrote:

> 2010/7/9 Arjan van de Ven <arjan@infradead.org>:
> > From: Arjan van de Ven <arjan@linux.intel.com>
> > diff --git a/include/linux/pm.h b/include/linux/pm.h
> > index 8e258c7..dca597f 100644
> > --- a/include/linux/pm.h
> > +++ b/include/linux/pm.h
> > @@ -476,9 +476,15 @@ struct dev_pm_info {
> >        enum rpm_request        request;
> >        enum rpm_status         runtime_status;
> >        int                     runtime_error;
> > +       unsigned long           active_jiffies;
> > +       unsigned long           suspended_jiffies;
> > +       unsigned long           accounting_timestamp;
> >  #endif
> >  };
> 
> USB subsystem has implemented the function already, and only two
> variables are enough to do the statistics. Suggest you to make a
> reference to usb implementation, maybe sizeof(unsigned long) bytes
> per device can be saved.
> 

I did look at the USB implementation, and it is very clever. But it's
more complex at the same time, because you no longer can just read out
the time stamps, you need to look at the current device state each time
to either subtract jiffies or not. 

by having the timestamp as a separate variable all the code gets
a lot simpler..... sometimes simple over clever is the right thing to
do.


-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

  reply	other threads:[~2010-07-09 11:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-09  5:48 Arjan van de Ven
2010-07-09  7:04 ` Ming Lei
2010-07-09 11:22   ` Arjan van de Ven [this message]
2010-07-09 15:00 ` [linux-pm] " Alan Stern
2010-07-09 15:11   ` Alan Stern
2010-07-10 16:00     ` Arjan van de Ven
2010-07-10 16:29     ` Arjan van de Ven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100709042256.56e4b82f@infradead.org \
    --to=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=rjw@sisk.pl \
    --cc=tom.leiming@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®