From patchwork Tue Mar 1 17:38:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michele DiGiorgio X-Patchwork-Id: 63319 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1959786lbc; Tue, 1 Mar 2016 09:39:46 -0800 (PST) X-Received: by 10.98.32.218 with SMTP id m87mr31804101pfj.48.1456853986804; Tue, 01 Mar 2016 09:39:46 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id va5si13129138pac.165.2016.03.01.09.39.46; Tue, 01 Mar 2016 09:39:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751127AbcCARjp (ORCPT + 11 others); Tue, 1 Mar 2016 12:39:45 -0500 Received: from fw-tnat.cambridge.arm.com ([217.140.96.140]:55439 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750996AbcCARjo (ORCPT ); Tue, 1 Mar 2016 12:39:44 -0500 Received: from e108455-lin.cambridge.arm.com (e108455-lin.cambridge.arm.com [10.1.205.133]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with SMTP id u21HdWum026210; Tue, 1 Mar 2016 17:39:32 GMT Received: by e108455-lin.cambridge.arm.com (sSMTP sendmail emulation); Tue, 01 Mar 2016 17:39:32 +0000 From: Michele Di Giorgio To: linux-pm@vger.kernel.org Cc: Ingo Molnar , Javi Merino , linux-kernel@vger.kernel.org, Punit Agrawal , Michele Di Giorgio , Steven Rostedt , Eduardo Valentin Subject: [PATCH] thermal: trace: migrating thermal traces to use TRACE_DEFINE_ENUM() macros Date: Tue, 1 Mar 2016 17:38:54 +0000 Message-Id: <1456853934-24715-1-git-send-email-michele.digiorgio@arm.com> X-Mailer: git-send-email 1.9.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Userspace tools are not aware of how to convert the enums provided by the tracepoints to their corresponding strings. Adding TRACE_DEFINE_ENUM() macros allows to make the enums available to userspace to let the tools know what those enum values represent. In particular, for thermal zone trip types what we obtained before was something like: kworker/1:1-460 [001] 320.372732: thermal_zone_trip: thermal_zone=soc id=0 trip=1 trip_type=1 Unfortunately, userspace tools do not know how to convert enum values to strings and as a consequence they can only forward the enum value to the output. By using TRACE_DEFINE_ENUM() macros for thermal traces we get the following trace line: kworker/1:1-460 [001] 320.372732: thermal_zone_trip: thermal_zone=soc id=0 trip=1 trip_type=PASSIVE Userspace tools are now able to better understand the meaning of the trip_type and provide the user with more readable information. CC: Steven Rostedt CC: Eduardo Valentin Signed-off-by: Michele Di Giorgio --- include/trace/events/thermal.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/trace/events/thermal.h b/include/trace/events/thermal.h index 5738bb3..2b4a8ff 100644 --- a/include/trace/events/thermal.h +++ b/include/trace/events/thermal.h @@ -8,6 +8,18 @@ #include #include +TRACE_DEFINE_ENUM(THERMAL_TRIP_CRITICAL); +TRACE_DEFINE_ENUM(THERMAL_TRIP_HOT); +TRACE_DEFINE_ENUM(THERMAL_TRIP_PASSIVE); +TRACE_DEFINE_ENUM(THERMAL_TRIP_ACTIVE); + +#define show_tzt_type(type) \ + __print_symbolic(type, \ + { THERMAL_TRIP_CRITICAL, "CRITICAL"}, \ + { THERMAL_TRIP_HOT, "HOT"}, \ + { THERMAL_TRIP_PASSIVE, "PASSIVE"}, \ + { THERMAL_TRIP_ACTIVE, "ACTIVE"}) + TRACE_EVENT(thermal_temperature, TP_PROTO(struct thermal_zone_device *tz), @@ -73,9 +85,9 @@ TRACE_EVENT(thermal_zone_trip, __entry->trip_type = trip_type; ), - TP_printk("thermal_zone=%s id=%d trip=%d trip_type=%d", + TP_printk("thermal_zone=%s id=%d trip=%d trip_type=%s", __get_str(thermal_zone), __entry->id, __entry->trip, - __entry->trip_type) + show_tzt_type(__entry->trip_type)) ); TRACE_EVENT(thermal_power_cpu_get_power,