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

From: Lukasz Luba
Date: Thu Feb 14 2019 - 13:58:20 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.

Reviewed-by: Chanwoo Choi <cw00.choi@xxxxxxxxxxx>
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 0ae3de7..c9714fd 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>
+
static struct class *devfreq_class;

/*
@@ -394,6 +397,11 @@ static void devfreq_monitor(struct work_struct *work)
queue_delayed_work(devfreq_wq, &devfreq->work,
msecs_to_jiffies(devfreq->profile->polling_ms));
mutex_unlock(&devfreq->lock);
+
+ trace_devfreq_monitor(dev_name(&devfreq->dev), devfreq->previous_freq,
+ devfreq->profile->polling_ms,
+ devfreq->last_status.busy_time,
+ devfreq->last_status.total_time);
}

/**
--
2.7.4