Skip to content

Commit

Permalink
PM / QoS: Add pm_qos_request tracepoints
Browse files Browse the repository at this point in the history
Adds tracepoints to pm_qos_add_request, pm_qos_update_request,
pm_qos_remove_request, and pm_qos_update_request_timeout.
It's useful for checking pm_qos_class, value, and timeout_us.

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 247e9ee commit ae8822b
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
71 changes: 71 additions & 0 deletions include/trace/events/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,77 @@ DEFINE_EVENT(power_domain, power_domain_target,
/*
* The pm qos events are used for pm qos update
*/
DECLARE_EVENT_CLASS(pm_qos_request,

TP_PROTO(int pm_qos_class, s32 value),

TP_ARGS(pm_qos_class, value),

TP_STRUCT__entry(
__field( int, pm_qos_class )
__field( s32, value )
),

TP_fast_assign(
__entry->pm_qos_class = pm_qos_class;
__entry->value = value;
),

TP_printk("pm_qos_class=%s value=%d",
__print_symbolic(__entry->pm_qos_class,
{ PM_QOS_CPU_DMA_LATENCY, "CPU_DMA_LATENCY" },
{ PM_QOS_NETWORK_LATENCY, "NETWORK_LATENCY" },
{ PM_QOS_NETWORK_THROUGHPUT, "NETWORK_THROUGHPUT" }),
__entry->value)
);

DEFINE_EVENT(pm_qos_request, pm_qos_add_request,

TP_PROTO(int pm_qos_class, s32 value),

TP_ARGS(pm_qos_class, value)
);

DEFINE_EVENT(pm_qos_request, pm_qos_update_request,

TP_PROTO(int pm_qos_class, s32 value),

TP_ARGS(pm_qos_class, value)
);

DEFINE_EVENT(pm_qos_request, pm_qos_remove_request,

TP_PROTO(int pm_qos_class, s32 value),

TP_ARGS(pm_qos_class, value)
);

TRACE_EVENT(pm_qos_update_request_timeout,

TP_PROTO(int pm_qos_class, s32 value, unsigned long timeout_us),

TP_ARGS(pm_qos_class, value, timeout_us),

TP_STRUCT__entry(
__field( int, pm_qos_class )
__field( s32, value )
__field( unsigned long, timeout_us )
),

TP_fast_assign(
__entry->pm_qos_class = pm_qos_class;
__entry->value = value;
__entry->timeout_us = timeout_us;
),

TP_printk("pm_qos_class=%s value=%d, timeout_us=%ld",
__print_symbolic(__entry->pm_qos_class,
{ PM_QOS_CPU_DMA_LATENCY, "CPU_DMA_LATENCY" },
{ PM_QOS_NETWORK_LATENCY, "NETWORK_LATENCY" },
{ PM_QOS_NETWORK_THROUGHPUT, "NETWORK_THROUGHPUT" }),
__entry->value, __entry->timeout_us)
);

DECLARE_EVENT_CLASS(pm_qos_update,

TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
Expand Down
5 changes: 5 additions & 0 deletions kernel/power/qos.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ void pm_qos_add_request(struct pm_qos_request *req,
}
req->pm_qos_class = pm_qos_class;
INIT_DELAYED_WORK(&req->work, pm_qos_work_fn);
trace_pm_qos_add_request(pm_qos_class, value);
pm_qos_update_target(pm_qos_array[pm_qos_class]->constraints,
&req->node, PM_QOS_ADD_REQ, value);
}
Expand Down Expand Up @@ -364,6 +365,7 @@ void pm_qos_update_request(struct pm_qos_request *req,

cancel_delayed_work_sync(&req->work);

trace_pm_qos_update_request(req->pm_qos_class, new_value);
if (new_value != req->node.prio)
pm_qos_update_target(
pm_qos_array[req->pm_qos_class]->constraints,
Expand All @@ -390,6 +392,8 @@ void pm_qos_update_request_timeout(struct pm_qos_request *req, s32 new_value,

cancel_delayed_work_sync(&req->work);

trace_pm_qos_update_request_timeout(req->pm_qos_class,
new_value, timeout_us);
if (new_value != req->node.prio)
pm_qos_update_target(
pm_qos_array[req->pm_qos_class]->constraints,
Expand Down Expand Up @@ -419,6 +423,7 @@ void pm_qos_remove_request(struct pm_qos_request *req)

cancel_delayed_work_sync(&req->work);

trace_pm_qos_remove_request(req->pm_qos_class, PM_QOS_DEFAULT_VALUE);
pm_qos_update_target(pm_qos_array[req->pm_qos_class]->constraints,
&req->node, PM_QOS_REMOVE_REQ,
PM_QOS_DEFAULT_VALUE);
Expand Down

0 comments on commit ae8822b

Please sign in to comment.