public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Arjan van de Ven <arjan@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ftrace: Add a C-state tracer to help power optimization
Date: Mon, 06 Oct 2008 18:52:39 +0200	[thread overview]
Message-ID: <1223311960.12409.28.camel@lappy.programming.kicks-ass.net> (raw)
In-Reply-To: <20081004112915.7c2b45ea@infradead.org>

On Sat, 2008-10-04 at 11:29 -0700, Arjan van de Ven wrote:

> @@ -100,6 +101,9 @@ static inline int hlt_use_halt(void)
>  void default_idle(void)
>  {
>  	if (hlt_use_halt()) {
> +		struct cstate_trace it;
> +
> +		trace_cstate_start(&it, 1);
>  		current_thread_info()->status &= ~TS_POLLING;
>  		/*
>  		 * TS_POLLING-cleared state must be visible before we
> @@ -112,6 +116,7 @@ void default_idle(void)
>  		else
>  			local_irq_enable();
>  		current_thread_info()->status |= TS_POLLING;
> +		trace_cstate_end(&it);
>  	} else {
>  		local_irq_enable();
>  		/* loop is done by the caller */

> @@ -232,6 +232,20 @@ static inline void start_boot_trace(void) { }
>  static inline void stop_boot_trace(void) { }
>  #endif
>  
> +struct cstate_trace {
> +	ktime_t			stamp;
> +	ktime_t			end;
> +	int			state;
> +};
> +
> +#ifdef CONFIG_CSTATE_TRACER
> +extern void trace_cstate_start(struct cstate_trace *it, unsigned int state);
> +extern void trace_cstate_end(struct cstate_trace *it);
> +#else
> +static inline void trace_cstate_start(struct cstate_trace *it, int state) { }
> +static inline void trace_cstate_end(struct cstate_trace *it) { }
> +#endif
> +
>  
> 
>  #endif /* _LINUX_FTRACE_H */

Why have the cstate_trace structure? If you just log start, stop you
could compute the time delta from the trace time stamps, no?

If you decide to keep the structure, perhaps declare it empty for !
CONFIG_CSTATE_TRACER so as to not bloat stack usage when its not
configured.


  reply	other threads:[~2008-10-06 16:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-04 17:54 [PATCH v2] ftrace: Add a C-state tracer to help power optimization Arjan van de Ven
2008-10-04 18:17 ` Steven Rostedt
2008-10-04 18:29   ` Arjan van de Ven
2008-10-06 16:52     ` Peter Zijlstra [this message]
2008-10-06 16:57       ` Arjan van de Ven
2008-10-05  9:53   ` Ingo Molnar

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=1223311960.12409.28.camel@lappy.programming.kicks-ass.net \
    --to=a.p.zijlstra@chello.nl \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    /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