Skip to content

Commit

Permalink
PM / QoS: Add dev_pm_qos_request tracepoints
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Sahara authored and Rafael J. Wysocki committed Jun 24, 2013
1 parent ae8822b commit 96d9d0b
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/base/power/qos.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down
51 changes: 51 additions & 0 deletions include/trace/events/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,57 @@ DEFINE_EVENT_PRINT(pm_qos_update, pm_qos_update_flags,
{ 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),
__print_symbolic(__entry->type,
{ DEV_PM_QOS_LATENCY, "DEV_PM_QOS_LATENCY" },
{ 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 */
Expand Down

0 comments on commit 96d9d0b

Please sign in to comment.