From patchwork Fri Jul 3 12:58:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javi Merino X-Patchwork-Id: 6715221 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 37F88C05AC for ; Fri, 3 Jul 2015 12:59:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 250DF207F2 for ; Fri, 3 Jul 2015 12:59:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C694E207F8 for ; Fri, 3 Jul 2015 12:59:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755333AbbGCM70 (ORCPT ); Fri, 3 Jul 2015 08:59:26 -0400 Received: from foss.arm.com ([217.140.101.70]:53249 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755341AbbGCM70 (ORCPT ); Fri, 3 Jul 2015 08:59:26 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8001A390; Fri, 3 Jul 2015 05:59:56 -0700 (PDT) Received: from e104805.cambridge.arm.com (unknown [10.2.131.190]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 86C783F447; Fri, 3 Jul 2015 05:59:24 -0700 (PDT) From: Javi Merino To: linux-pm@vger.kernel.org Cc: Javi Merino , Zhang Rui , Eduardo Valentin , Steven Rostedt , Ingo Molnar Subject: [PATCH 4/4] devfreq_cooling: add trace information Date: Fri, 3 Jul 2015 13:58:30 +0100 Message-Id: <1435928310-15938-5-git-send-email-javi.merino@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435928310-15938-1-git-send-email-javi.merino@arm.com> References: <1435928310-15938-1-git-send-email-javi.merino@arm.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Tracing is useful for debugging and performance tuning. Add similar traces to what's present in the cpu cooling device. Cc: Zhang Rui Cc: Eduardo Valentin Cc: Steven Rostedt Cc: Ingo Molnar Signed-off-by: Javi Merino --- drivers/thermal/devfreq_cooling.c | 9 ++++++- include/trace/events/thermal.h | 51 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c index ee7b84ecd0c0..30b9e7f6556d 100644 --- a/drivers/thermal/devfreq_cooling.c +++ b/drivers/thermal/devfreq_cooling.c @@ -21,6 +21,8 @@ #include #include +#include + static int devfreq_cooling_get_max_state(struct thermal_cooling_device *cdev, unsigned long *state) { @@ -127,7 +129,7 @@ static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cd struct devfreq_dev_status *status = &df->last_status; unsigned long state; unsigned long freq = status->current_frequency; - u32 dyn_power, static_power; + u32 load, dyn_power, static_power; /* Get dynamic power for state */ state = freq_get_state(df, freq); @@ -142,6 +144,10 @@ static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cd /* Get static power */ static_power = get_static_power(dfc, freq); + load = (100 * status->busy_time) / status->total_time; + trace_thermal_power_devfreq_get_power(cdev, freq, load, dyn_power, + static_power); + *power = dyn_power + static_power; return 0; @@ -195,6 +201,7 @@ static int devfreq_cooling_power2state(struct thermal_cooling_device *cdev, break; *state = i; + trace_thermal_power_devfreq_limit(cdev, freq, *state, power); return 0; } diff --git a/include/trace/events/thermal.h b/include/trace/events/thermal.h index 8b1f80682b80..ffa870c0d2d2 100644 --- a/include/trace/events/thermal.h +++ b/include/trace/events/thermal.h @@ -135,6 +135,57 @@ TRACE_EVENT(thermal_power_cpu_limit, __entry->power) ); +TRACE_EVENT(thermal_power_devfreq_get_power, + TP_PROTO(struct thermal_cooling_device *cdev, unsigned long freq, + u32 load, u32 dynamic_power, u32 static_power), + + TP_ARGS(cdev, freq, load, dynamic_power, static_power), + + TP_STRUCT__entry( + __string(type, cdev->type ) + __field(unsigned long, freq ) + __field(u32, load ) + __field(u32, dynamic_power ) + __field(u32, static_power ) + ), + + TP_fast_assign( + __assign_str(type, cdev->type); + __entry->freq = freq; + __entry->load = load; + __entry->dynamic_power = dynamic_power; + __entry->static_power = static_power; + ), + + TP_printk("type=%s freq=%lu load=%u dynamic_power=%u static_power=%u", + __get_str(type), __entry->freq, + __entry->load, __entry->dynamic_power, __entry->static_power) +); + +TRACE_EVENT(thermal_power_devfreq_limit, + TP_PROTO(struct thermal_cooling_device *cdev, unsigned long freq, + unsigned long cdev_state, u32 power), + + TP_ARGS(cdev, freq, cdev_state, power), + + TP_STRUCT__entry( + __string(type, cdev->type) + __field(unsigned int, freq ) + __field(unsigned long, cdev_state) + __field(u32, power ) + ), + + TP_fast_assign( + __assign_str(type, cdev->type); + __entry->freq = freq; + __entry->cdev_state = cdev_state; + __entry->power = power; + ), + + TP_printk("type=%s freq=%u cdev_state=%lu power=%u", + __get_str(type), __entry->freq, __entry->cdev_state, + __entry->power) +); #endif /* _TRACE_THERMAL_H */ /* This part must be outside protection */