mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>,
	Arjan van de Ven <arjan@infradead.org>,
	"linux-pm@lists.linux-foundation.org" 
	<linux-pm@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Ming Lei <tom.leiming@gmail.com>
Subject: Re: [PATCH v2] pm: Add runtime PM statistics
Date: Fri, 6 Aug 2010 01:45:28 +0200	[thread overview]
Message-ID: <201008060145.28969.rjw@sisk.pl> (raw)
In-Reply-To: <87bp9gpryb.fsf@deeprootsystems.com>

On Friday, August 06, 2010, Kevin Hilman wrote:
> Arjan van de Ven <arjan@linux.intel.com> writes:
> 
> > +
> > +/**
> > + * update_pm_runtime_accounting - Update the time accounting of power
> > states
> > + * @dev: Device to update the accounting for
> > + *
> > + * In order to be able to have time accounting of the various power states
> > + * (as used by programs such as PowerTOP to show the effectiveness of
> > runtime
> > + * PM), we need to track the time spent in each state.
> > + * update_pm_runtime_accounting must be called each time before the
> > + * runtime_status field is updated, to account the time in the old state
> > + * correctly.
> > + */
> > +void update_pm_runtime_accounting(struct device *dev)
> > +{
> > +    unsigned long now = jiffies;
> > +    int delta;
> > +
> > +    delta = now - dev->power.accounting_timestamp;
> > +
> > +    if (delta < 0)
> > +        delta = 0;
> > +
> > +    dev->power.accounting_timestamp = now;
> > +
> > +    if (dev->power.disable_depth > 0)
> > +        return;
> > +
> > +    if (dev->power.runtime_status == RPM_SUSPENDED)
> > +        dev->power.suspended_jiffies += delta;
> > +    else
> > +        dev->power.active_jiffies += delta;
> > +}
> 
> By using jiffies, I think we might miss events in drivers that are doing
> runtime PM transitions in short bursts.  On embedded systems with slow
> HZ, there could potentially be lots of transitions between ticks.
> 
> It would be nicer to use clocksource-based time so transitions between
> jiffies could still be factored into the accounting.

Patch please?

Rafael

  reply	other threads:[~2010-08-05 23:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-10 16:52 Arjan van de Ven
2010-07-11 21:26 ` Rafael J. Wysocki
2010-07-12  5:16   ` Arjan van de Ven
2010-07-13 21:28     ` Rafael J. Wysocki
2010-07-15 15:44       ` Arjan van de Ven
2010-08-05 23:20         ` Kevin Hilman
2010-08-05 23:45           ` Rafael J. Wysocki [this message]
2010-08-05 23:59           ` Arjan van de Ven
2010-08-06 23:37             ` Kevin Hilman

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=201008060145.28969.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=arjan@infradead.org \
    --cc=arjan@linux.intel.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=stern@rowland.harvard.edu \
    --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

Powered by JetHome