From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steven Rostedt Subject: Re: [PATCH 4/4] devfreq_cooling: add trace information Date: Mon, 6 Jul 2015 14:58:43 -0400 Message-ID: <20150706145843.7f475472@gandalf.local.home> References: <1435928310-15938-1-git-send-email-javi.merino@arm.com> <1435928310-15938-5-git-send-email-javi.merino@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from smtprelay0040.hostedemail.com ([216.40.44.40]:39099 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751860AbbGFTH1 (ORCPT ); Mon, 6 Jul 2015 15:07:27 -0400 Received: from smtprelay.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by smtpgrave07.hostedemail.com (Postfix) with ESMTP id CF42D11AD79 for ; Mon, 6 Jul 2015 18:58:46 +0000 (UTC) In-Reply-To: <1435928310-15938-5-git-send-email-javi.merino@arm.com> Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Javi Merino Cc: linux-pm@vger.kernel.org, Zhang Rui , Eduardo Valentin , Ingo Molnar On Fri, 3 Jul 2015 13:58:30 +0100 Javi Merino wrote: > @@ -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; When tracing is disabled, this division will still be done. Why not just pass in status, and have the load calculated in the tracepoint TP_fast_assign() ? > + 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->load = (100 * status->busy_time) / status->total_time; -- Steve > + __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 */