* [PATCH 1/2] PM / QoS: use __print_symbolic with more convenient way
@ 2013-08-06 4:51 kpark3469
2013-08-06 4:51 ` [PATCH 2/2] xen/trace: replace old code with __print_symbolic kpark3469
0 siblings, 1 reply; 2+ messages in thread
From: kpark3469 @ 2013-08-06 4:51 UTC (permalink / raw)
To: rostedt; +Cc: keun-o.park, linux-kernel
From: Sahara <keun-o.park@windriver.com>
This patch is to prevent the same __print_symbolic functions from
being used repeatedly.
Signed-off-by: Sahara <keun-o.park@windriver.com>
---
include/trace/events/power.h | 43 +++++++++++++++++++++--------------------
1 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 8e42410..34efacc 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -182,6 +182,23 @@ DEFINE_EVENT(power_domain, power_domain_target,
/*
* The pm qos events are used for pm qos update
*/
+#define show_pm_qos_class(val) \
+ __print_symbolic(val, \
+ { PM_QOS_CPU_DMA_LATENCY, "CPU_DMA_LATENCY" }, \
+ { PM_QOS_NETWORK_LATENCY, "NETWORK_LATENCY" }, \
+ { PM_QOS_NETWORK_THROUGHPUT, "NETWORK_THROUGHPUT" })
+
+#define show_pm_qos_req_action(val) \
+ __print_symbolic(val, \
+ { PM_QOS_ADD_REQ, "ADD_REQ" }, \
+ { PM_QOS_UPDATE_REQ, "UPDATE_REQ" }, \
+ { PM_QOS_REMOVE_REQ, "REMOVE_REQ" })
+
+#define show_dev_pm_qos_req_type(val) \
+ __print_symbolic(val, \
+ { DEV_PM_QOS_LATENCY, "DEV_PM_QOS_LATENCY" }, \
+ { DEV_PM_QOS_FLAGS, "DEV_PM_QOS_FLAGS" })
+
DECLARE_EVENT_CLASS(pm_qos_request,
TP_PROTO(int pm_qos_class, s32 value),
@@ -199,11 +216,7 @@ DECLARE_EVENT_CLASS(pm_qos_request,
),
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)
+ show_pm_qos_class(__entry->pm_qos_class), __entry->value)
);
DEFINE_EVENT(pm_qos_request, pm_qos_add_request,
@@ -246,10 +259,7 @@ TRACE_EVENT(pm_qos_update_request_timeout,
),
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" }),
+ show_pm_qos_class(__entry->pm_qos_class),
__entry->value, __entry->timeout_us)
);
@@ -272,10 +282,7 @@ DECLARE_EVENT_CLASS(pm_qos_update,
),
TP_printk("action=%s prev_value=%d curr_value=%d",
- __print_symbolic(__entry->action,
- { PM_QOS_ADD_REQ, "ADD_REQ" },
- { PM_QOS_UPDATE_REQ, "UPDATE_REQ" },
- { PM_QOS_REMOVE_REQ, "REMOVE_REQ" }),
+ show_pm_qos_req_action(__entry->action),
__entry->prev_value, __entry->curr_value)
);
@@ -293,10 +300,7 @@ DEFINE_EVENT_PRINT(pm_qos_update, pm_qos_update_flags,
TP_ARGS(action, prev_value, curr_value),
TP_printk("action=%s prev_value=0x%x curr_value=0x%x",
- __print_symbolic(__entry->action,
- { PM_QOS_ADD_REQ, "ADD_REQ" },
- { PM_QOS_UPDATE_REQ, "UPDATE_REQ" },
- { PM_QOS_REMOVE_REQ, "REMOVE_REQ" }),
+ show_pm_qos_req_action(__entry->action),
__entry->prev_value, __entry->curr_value)
);
@@ -321,10 +325,7 @@ DECLARE_EVENT_CLASS(dev_pm_qos_request,
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)
+ show_dev_pm_qos_req_type(__entry->type), __entry->new_value)
);
DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_add_request,
--
1.7.1
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH 2/2] xen/trace: replace old code with __print_symbolic
2013-08-06 4:51 [PATCH 1/2] PM / QoS: use __print_symbolic with more convenient way kpark3469
@ 2013-08-06 4:51 ` kpark3469
0 siblings, 0 replies; 2+ messages in thread
From: kpark3469 @ 2013-08-06 4:51 UTC (permalink / raw)
To: rostedt; +Cc: keun-o.park, linux-kernel
From: Sahara <keun-o.park@windriver.com>
The advantage of using __print_symbolic() is that it allows both perf
and trace-cmd to read this event properly. Their parsers are not full C
parsers, and when you open code the the processing, they both will fail
to parse how to read the output, and will just default to printing the
fields via their raw numbers.
Another advantage is if the __entry->action is not one of the defined
fields, instead of outputting "??" it will output the number in hex. Say
if __entry->action is 0x123, the __print_symbolic will return "0x123" as
a string and that will be shown to the user, letting you know the actual
value of the field that was unknown.
Signed-off-by: Sahara <keun-o.park@windriver.com>
---
include/trace/events/xen.h | 33 +++++++++++++++++++++++----------
1 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/include/trace/events/xen.h b/include/trace/events/xen.h
index d06b6da..8c6f945 100644
--- a/include/trace/events/xen.h
+++ b/include/trace/events/xen.h
@@ -10,6 +10,25 @@
struct multicall_entry;
+#define show_paravirt_lazy_mode(val) \
+ __print_symbolic(val, \
+ { PARAVIRT_LAZY_NONE, "LAZY_NONE" }, \
+ { PARAVIRT_LAZY_MMU, "LAZY_MMU" }, \
+ { PARAVIRT_LAZY_CPU, "LAZY_CPU" })
+
+#define show_xen_mc_flush_reason(val) \
+ __print_symbolic(val, \
+ { XEN_MC_FL_NONE, "NONE" }, \
+ { XEN_MC_FL_BATCH, "BATCH" }, \
+ { XEN_MC_FL_ARGS, "ARGS" }, \
+ { XEN_MC_FL_CALLBACK, "CALLBACK" })
+
+#define show_xen_mc_extend_args(val) \
+ __print_symbolic(val, \
+ { XEN_MC_XE_OK, "OK" }, \
+ { XEN_MC_XE_BAD_OP, "BAD_OP" }, \
+ { XEN_MC_XE_NO_SPACE, "NO_SPACE" })
+
/* Multicalls */
DECLARE_EVENT_CLASS(xen_mc__batch,
TP_PROTO(enum paravirt_lazy_mode mode),
@@ -18,9 +37,8 @@ DECLARE_EVENT_CLASS(xen_mc__batch,
__field(enum paravirt_lazy_mode, mode)
),
TP_fast_assign(__entry->mode = mode),
- TP_printk("start batch LAZY_%s",
- (__entry->mode == PARAVIRT_LAZY_MMU) ? "MMU" :
- (__entry->mode == PARAVIRT_LAZY_CPU) ? "CPU" : "NONE")
+ TP_printk("start batch %s",
+ show_paravirt_lazy_mode(__entry->mode)
);
#define DEFINE_XEN_MC_BATCH(name) \
DEFINE_EVENT(xen_mc__batch, name, \
@@ -82,10 +100,7 @@ TRACE_EVENT(xen_mc_flush_reason,
),
TP_fast_assign(__entry->reason = reason),
TP_printk("flush reason %s",
- (__entry->reason == XEN_MC_FL_NONE) ? "NONE" :
- (__entry->reason == XEN_MC_FL_BATCH) ? "BATCH" :
- (__entry->reason == XEN_MC_FL_ARGS) ? "ARGS" :
- (__entry->reason == XEN_MC_FL_CALLBACK) ? "CALLBACK" : "??")
+ show_xen_mc_flush_reason(__entry->reason)
);
TRACE_EVENT(xen_mc_flush,
@@ -117,9 +132,7 @@ TRACE_EVENT(xen_mc_extend_args,
TP_printk("extending op %u%s by %zu bytes res %s",
__entry->op, xen_hypercall_name(__entry->op),
__entry->args,
- __entry->res == XEN_MC_XE_OK ? "OK" :
- __entry->res == XEN_MC_XE_BAD_OP ? "BAD_OP" :
- __entry->res == XEN_MC_XE_NO_SPACE ? "NO_SPACE" : "???")
+ show_xen_mc_extend_args(__entry->res)
);
/* mmu */
--
1.7.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-06 4:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-06 4:51 [PATCH 1/2] PM / QoS: use __print_symbolic with more convenient way kpark3469
2013-08-06 4:51 ` [PATCH 2/2] xen/trace: replace old code with __print_symbolic kpark3469
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®