]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
Thermal: Add thermal events tracing (ftrace)
authorTimo Alho <talho@nvidia.com>
Wed, 6 Mar 2013 17:37:25 +0000 (19:37 +0200)
committerDan Willemsen <dwillemsen@nvidia.com>
Sat, 14 Sep 2013 20:02:05 +0000 (13:02 -0700)
Following two events in thermal framework are traced:
 - Call to handle_thermal_trip (thermal_zone_device name and temperature
   will be printed)
 - Call to thermal_cdev_update (thermal_cooling_device name and updated
   cooling state value will be printed)

Bug 1050412

Change-Id: If7e685ce26455820408d694fa720105ecae15469
Signed-off-by: Timo Alho <talho@nvidia.com>
Reviewed-on: http://git-master/r/207010
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Peter De Schrijver <pdeschrijver@nvidia.com>
drivers/thermal/thermal_core.c
include/trace/events/thermal.h [new file with mode: 0644]

index 979ecdd646c700506eb78df0b1a77ffb65ecff27..8e1f8168bb37cf021607d1c3b4b32098bffefcaa 100644 (file)
@@ -35,6 +35,8 @@
 #include <linux/reboot.h>
 #include <net/netlink.h>
 #include <net/genetlink.h>
+#define CREATE_TRACE_POINTS
+#include <trace/events/thermal.h>
 
 #include "thermal_core.h"
 
@@ -366,6 +368,8 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip)
 {
        enum thermal_trip_type type;
 
+       trace_thermal_trip(tz->type, tz->temperature/1000);
+
        tz->ops->get_trip_type(tz, trip, &type);
 
        if (type == THERMAL_TRIP_CRITICAL || type == THERMAL_TRIP_HOT)
@@ -1524,6 +1528,7 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev)
        }
        mutex_unlock(&cdev->lock);
        cdev->ops->set_cur_state(cdev, target);
+       trace_cooling_device_update(cdev->type, target);
        cdev->updated = true;
 }
 EXPORT_SYMBOL(thermal_cdev_update);
diff --git a/include/trace/events/thermal.h b/include/trace/events/thermal.h
new file mode 100644 (file)
index 0000000..1a01f7c
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM thermal
+
+#if !defined(_TRACE_THERMAL_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_THERMAL_H
+
+#include <linux/string.h>
+#include <linux/thermal.h>
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(thermal_trip,
+
+           TP_PROTO(const char *type, int temp),
+
+           TP_ARGS(type, temp),
+
+           TP_STRUCT__entry(
+                            __array(char, type, THERMAL_NAME_LENGTH)
+                            __field(int, temp)
+                            ),
+
+           TP_fast_assign(
+                          memcpy(__entry->type, type, THERMAL_NAME_LENGTH);
+                          __entry->temp = temp;
+                          ),
+
+           TP_printk("%s = %d", __entry->type, __entry->temp)
+           );
+
+TRACE_EVENT(cooling_device_update,
+
+           TP_PROTO(const char *type, long target),
+
+           TP_ARGS(type, target),
+
+           TP_STRUCT__entry(
+                            __array(char, type, THERMAL_NAME_LENGTH)
+                            __field(long, target)
+                            ),
+
+           TP_fast_assign(
+                          memcpy(__entry->type, type, THERMAL_NAME_LENGTH);
+                          __entry->target = target;
+                          ),
+
+           TP_printk("%s -> %d", __entry->type, __entry->target)
+           );
+
+
+#endif /* _TRACE_THERMAL_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>