From: John Mathew <john.mathew@intel.com>
To: linux-kernel@vger.kernel.org
Cc: len.brown@intel.com, pierre.tardy@intel.com, trenn@suse.de,
rostedt@goodmis.org, fweisbec@gmail.com, mingo@redhat.com,
John Mathew <john.mathew@intel.com>
Subject: [PATCH] cpuidle: Add an addtional trace for demoted c-states
Date: Fri, 21 Oct 2011 14:46:07 +0300 [thread overview]
Message-ID: <1319197567-8573-1-git-send-email-john.mathew@intel.com> (raw)
This patch enables tracing of c-states that the device
eventually goes in to, which might be different from what
the governor had retuned. This scenario occurs in platforms
like Intel Medfield. Power tools like pytimechart will be
able to display accurate c-state transitions with the help of
this trace.
Signed-off-by: John Mathew <john.mathew@intel.com>
---
drivers/cpuidle/cpuidle.c | 3 +++
include/trace/events/power.h | 23 +++++++++++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index d4c5423..3d787ef 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -110,6 +110,9 @@ int cpuidle_idle_call(void)
dev->last_residency = target_state->enter(dev, target_state);
+ if (dev->last_state != target_state)
+ trace_power_demoted(POWER_CSTATE, dev->last_state->name, dev->cpu);
+
trace_power_end(dev->cpu);
trace_cpu_idle(PWR_EVENT_EXIT, dev->cpu);
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 1bcc2a8..941dc1a 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -101,6 +101,29 @@ DEFINE_EVENT(power, power_start,
TP_ARGS(type, state, cpu_id)
);
+TRACE_EVENT(power_demoted,
+
+ TP_PROTO(unsigned int type, char *state, unsigned int cpu_id),
+
+ TP_ARGS(type, state, cpu_id),
+
+ TP_STRUCT__entry(
+ __field( u64, type )
+ __string( state, state )
+ __field( u64, cpu_id )
+ ),
+
+ TP_fast_assign(
+ __entry->type = type;
+ __assign_str(state, state);
+ __entry->cpu_id = cpu_id;
+ ),
+
+ TP_printk("type=%lu state=%s cpu_id=%lu", (unsigned long)__entry->type,
+ __get_str(state), (unsigned long)__entry->cpu_id)
+
+);
+
DEFINE_EVENT(power, power_frequency,
TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
--
1.7.4.1
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki
Business Identity Code: 0357606 - 4
Domiciled in Helsinki
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
reply other threads:[~2011-10-21 11:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1319197567-8573-1-git-send-email-john.mathew@intel.com \
--to=john.mathew@intel.com \
--cc=fweisbec@gmail.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pierre.tardy@intel.com \
--cc=rostedt@goodmis.org \
--cc=trenn@suse.de \
/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®