linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kpark3469@gmail.com
To: linux-pm@vger.kernel.org
Cc: keun-o.park@windriver.com, len.brown@intel.com, rjw@sisk.pl,
	rostedt@goodmis.org
Subject: [PATCH 3/4] PM / tracing: Add dev_pm_qos_request tracepoints
Date: Thu, 20 Jun 2013 13:56:59 +0900	[thread overview]
Message-ID: <1371704220-7008-3-git-send-email-kpark3469@gmail.com> (raw)
In-Reply-To: <1371704220-7008-2-git-send-email-kpark3469@gmail.com>

From: Sahara <keun-o.park@windriver.com>

Adds tracepoints to dev_pm_qos_add_request, dev_pm_qos_update_request,
and dev_pm_qos_remove_request.  It's useful for checking device name,
dev_pm_qos_request_type, and value.

Signed-off-by: Sahara <keun-o.park@windriver.com>
---
 drivers/base/power/qos.c     |    6 +++++
 include/trace/events/power.h |   52 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
index 71671c4..5c1361a 100644
--- a/drivers/base/power/qos.c
+++ b/drivers/base/power/qos.c
@@ -42,6 +42,7 @@
 #include <linux/export.h>
 #include <linux/pm_runtime.h>
 #include <linux/err.h>
+#include <trace/events/power.h>
 
 #include "power.h"
 
@@ -305,6 +306,7 @@ int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req,
 	else if (!dev->power.qos)
 		ret = dev_pm_qos_constraints_allocate(dev);
 
+	trace_dev_pm_qos_add_request(dev_name(dev), type, value);
 	if (!ret) {
 		req->dev = dev;
 		req->type = type;
@@ -349,6 +351,8 @@ static int __dev_pm_qos_update_request(struct dev_pm_qos_request *req,
 		return -EINVAL;
 	}
 
+	trace_dev_pm_qos_update_request(dev_name(req->dev), req->type,
+					new_value);
 	if (curr_value != new_value)
 		ret = apply_constraint(req, PM_QOS_UPDATE_REQ, new_value);
 
@@ -398,6 +402,8 @@ static int __dev_pm_qos_remove_request(struct dev_pm_qos_request *req)
 	if (IS_ERR_OR_NULL(req->dev->power.qos))
 		return -ENODEV;
 
+	trace_dev_pm_qos_remove_request(dev_name(req->dev), req->type,
+					PM_QOS_DEFAULT_VALUE);
 	ret = apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE);
 	memset(req, 0, sizeof(*req));
 	return ret;
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 28b6645..19adcec 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -301,6 +301,58 @@ DEFINE_EVENT_PRINT(pm_qos_update, pm_qos_update_flags,
 		  (__entry->action == PM_QOS_REMOVE_REQ) ? "REMOVE_REQ" : "??",
 		  __entry->prev_value, __entry->curr_value)
 );
+
+DECLARE_EVENT_CLASS(dev_pm_qos_request,
+
+	TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
+		 s32 new_value),
+
+	TP_ARGS(name, type, new_value),
+
+	TP_STRUCT__entry(
+		__string( name,                    name         )
+		__field( enum dev_pm_qos_req_type, type         )
+		__field( s32,                      new_value    )
+	),
+
+	TP_fast_assign(
+		__assign_str(name, name);
+		__entry->type = type;
+		__entry->new_value = new_value;
+	),
+
+	TP_printk("device=%s type=%s new_value=%d",
+		  __get_str(name),
+		  (__entry->type == DEV_PM_QOS_LATENCY) ?
+			"DEV_PM_QOS_LATENCY" :
+		  (__entry->type == DEV_PM_QOS_FLAGS) ?
+			"DEV_PM_QOS_FLAGS" : "??",
+		  __entry->new_value)
+);
+
+DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_add_request,
+
+	TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
+		 s32 new_value),
+
+	TP_ARGS(name, type, new_value)
+);
+
+DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_update_request,
+
+	TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
+		 s32 new_value),
+
+	TP_ARGS(name, type, new_value)
+);
+
+DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_remove_request,
+
+	TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
+		 s32 new_value),
+
+	TP_ARGS(name, type, new_value)
+);
 #endif /* _TRACE_POWER_H */
 
 /* This part must be outside protection */
-- 
1.7.1


  reply	other threads:[~2013-06-20  4:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-20  4:56 [PATCH 1/4] PM / tracing: Add pm_qos_update_target/flags tracepoints kpark3469
2013-06-20  4:56 ` [PATCH 2/4] PM / tracing: Add pm_qos_request tracepoints kpark3469
2013-06-20  4:56   ` kpark3469 [this message]
2013-06-20  4:57     ` [PATCH 4/4] Documentation: Add pm_qos and dev_pm_qos to events-power.txt kpark3469
2013-06-20 12:35 ` [PATCH 1/4] PM / tracing: Add pm_qos_update_target/flags tracepoints Steven Rostedt
2013-06-21  2:16   ` Keun-O Park
2013-06-20 12:36 ` Steven Rostedt

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=1371704220-7008-3-git-send-email-kpark3469@gmail.com \
    --to=kpark3469@gmail.com \
    --cc=keun-o.park@windriver.com \
    --cc=len.brown@intel.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --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;
as well as URLs for NNTP newsgroup(s).