All of lore.kernel.org
 help / color / mirror / Atom feed
From: Punit Agrawal <punit.agrawal@arm.com>
To: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Punit Agrawal <punit.agrawal@arm.com>,
	Zhang Rui <rui.zhang@intel.com>,
	Eduardo Valentin <edubezval@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@redhat.com>
Subject: [PATCH 1/3] thermal: trace: Trace temperature changes
Date: Tue, 29 Jul 2014 11:50:48 +0100	[thread overview]
Message-ID: <1406631050-14975-2-git-send-email-punit.agrawal@arm.com> (raw)
In-Reply-To: <1406631050-14975-1-git-send-email-punit.agrawal@arm.com>

Create a new event to trace the temperature of a thermal zone. Using
this event trace the temperature changes of the thermal zone every-time
it is updated.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
---
 drivers/thermal/thermal_core.c |    4 ++++
 include/trace/events/thermal.h |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 include/trace/events/thermal.h

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 71b0ec0..6b32391 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -38,6 +38,9 @@
 #include <net/netlink.h>
 #include <net/genetlink.h>
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/thermal.h>
+
 #include "thermal_core.h"
 #include "thermal_hwmon.h"
 
@@ -463,6 +466,7 @@ static void update_temperature(struct thermal_zone_device *tz)
 	tz->temperature = temp;
 	mutex_unlock(&tz->lock);
 
+	trace_thermal_temperature(tz);
 	dev_dbg(&tz->device, "last_temperature=%d, current_temperature=%d\n",
 				tz->last_temperature, tz->temperature);
 }
diff --git a/include/trace/events/thermal.h b/include/trace/events/thermal.h
new file mode 100644
index 0000000..8c5ca96
--- /dev/null
+++ b/include/trace/events/thermal.h
@@ -0,0 +1,38 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM thermal
+
+#if !defined(_TRACE_THERMAL_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_THERMAL_H
+
+#include <linux/thermal.h>
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(thermal_temperature,
+
+	TP_PROTO(struct thermal_zone_device *tz),
+
+	TP_ARGS(tz),
+
+	TP_STRUCT__entry(
+		__string(thermal_zone, tz->type)
+		__field(int, id)
+		__field(int, temp_prev)
+		__field(int, temp)
+	),
+
+	TP_fast_assign(
+		__assign_str(thermal_zone, tz->type);
+		__entry->id = tz->id;
+		__entry->temp_prev = tz->last_temperature;
+		__entry->temp = tz->temperature;
+	),
+
+	TP_printk("thermal_zone=%s id=%d temp_prev=%d temp=%d",
+		__get_str(thermal_zone), __entry->id, __entry->temp_prev,
+		__entry->temp)
+);
+
+#endif /* _TRACE_THERMAL_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
-- 
1.7.10.4


  reply	other threads:[~2014-07-29 10:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11 11:31 [RFC PATCH 0/3] Add trace to thermal framework Punit Agrawal
2014-06-11 11:31 ` [RFC PATCH 1/3] thermal: trace: Trace temperature changes Punit Agrawal
2014-06-11 11:31 ` [RFC PATCH 2/3] thermal: trace: Trace when a cooling device's state is updated Punit Agrawal
2014-06-11 11:31 ` [RFC PATCH 3/3] thermal: trace: Trace when temperature is above a trip point Punit Agrawal
2014-06-11 12:49   ` Steven Rostedt
2014-06-11 14:11     ` Punit Agrawal
2014-06-11 14:11       ` Punit Agrawal
2014-06-11 14:20       ` Steven Rostedt
2014-06-11 14:20         ` Steven Rostedt
2014-06-11 14:53         ` Punit Agrawal
2014-06-11 14:53           ` Punit Agrawal
2014-06-11 15:08           ` Steven Rostedt
2014-06-11 15:08             ` Steven Rostedt
2014-06-12 16:16             ` Punit Agrawal
2014-06-12 16:16               ` Punit Agrawal
2014-06-20 17:24   ` Javi Merino
2014-06-24 10:41     ` Punit Agrawal
2014-06-24 10:41       ` Punit Agrawal
2014-06-25 13:26       ` Javi Merino
2014-07-25 14:11       ` edubezval
2014-07-29 10:50 ` [PATCH 0/3] Add trace to thermal framework Punit Agrawal
2014-07-29 10:50   ` Punit Agrawal [this message]
2014-07-29 10:50   ` [PATCH 2/3] thermal: trace: Trace when a cooling device's state is updated Punit Agrawal
2014-07-29 10:50   ` [PATCH 3/3] thermal: trace: Trace when temperature is above a trip point Punit Agrawal
2014-07-29 13:33   ` [PATCH 0/3] Add trace to thermal framework Eduardo Valentin
2014-07-30 11:40     ` Punit Agrawal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406631050-14975-2-git-send-email-punit.agrawal@arm.com \
    --to=punit.agrawal@arm.com \
    --cc=edubezval@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.