[PATCH v3 7/7] drivers: devfreq: add tracing for scheduling work

From: Lukasz Luba
Date: Tue Feb 12 2019 - 17:24:47 EST


This patch add basic tracing of the devfreq workqueue and delayed work.
It aims to capture changes of the polling intervals and device state.

Signed-off-by: Lukasz Luba <l.luba@xxxxxxxxxxxxxxxxxxx>
---
drivers/devfreq/devfreq.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 29e99ce..c1d0d8c 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -29,6 +29,9 @@
#include <linux/of.h>
#include "governor.h"

+#define CREATE_TRACE_POINTS
+#include <trace/events/devfreq.h>
+
/* The ~30% load threshold used for load calculation (due to fixed point
* arithmetic) */
#define LOAD_THRESHOLD_IN_DEVICE_USAGE (300)
@@ -418,6 +421,7 @@ static void devfreq_monitor(struct work_struct *work)
struct devfreq *devfreq = container_of(work,
struct devfreq, work.work);
unsigned int polling_ms;
+ const char *df_name = dev_name(&devfreq->dev);

mutex_lock(&devfreq->lock);
polling_ms = devfreq_get_polling_delay(devfreq);
@@ -429,6 +433,10 @@ static void devfreq_monitor(struct work_struct *work)
schedule_delayed_work(&devfreq->work,
msecs_to_jiffies(polling_ms));
mutex_unlock(&devfreq->lock);
+
+ trace_devfreq_monitor(df_name, devfreq->previous_freq, polling_ms,
+ devfreq->last_status.busy_time,
+ devfreq->last_status.total_time);
}

/**
--
2.7.4