Commit 37685d5b authored by Qais Yousef's avatar Qais Yousef Committed by Ionela Voinescu
Browse files

sched_tp: Add uclamp trace points


Signed-off-by: Qais Yousef's avatarQais Yousef <qais.yousef@arm.com>
parent 03561384
......@@ -141,6 +141,81 @@ TRACE_EVENT(sched_overutilized,
__entry->overutilized, __entry->span)
);
#ifdef CONFIG_UCLAMP_TASK
struct rq;
TRACE_EVENT_CONDITION(uclamp_util_se,
TP_PROTO(bool is_task, struct task_struct *p, struct rq *rq),
TP_ARGS(is_task, p, rq),
TP_CONDITION(is_task),
TP_STRUCT__entry(
__field( pid_t, pid )
__array( char, comm, TASK_COMM_LEN )
__field( int, cpu )
__field(unsigned long, util_avg )
__field(unsigned long, uclamp_avg )
__field(unsigned long, uclamp_min )
__field(unsigned long, uclamp_max )
),
TP_fast_assign(
__entry->pid = p->pid;
memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
__entry->cpu = rq->cpu;
__entry->util_avg = p->se.avg.util_avg;
__entry->uclamp_avg = uclamp_rq_util_with(rq, p->se.avg.util_avg, NULL);
__entry->uclamp_min = rq->uclamp[UCLAMP_MIN].value;
__entry->uclamp_max = rq->uclamp[UCLAMP_MAX].value;
),
TP_printk("pid=%d comm=%s cpu=%d util_avg=%lu uclamp_avg=%lu "
"uclamp_min=%lu uclamp_max=%lu",
__entry->pid, __entry->comm, __entry->cpu,
__entry->util_avg, __entry->uclamp_avg,
__entry->uclamp_min, __entry->uclamp_max)
);
TRACE_EVENT_CONDITION(uclamp_util_cfs,
TP_PROTO(bool is_root, int cpu, struct cfs_rq *cfs_rq),
TP_ARGS(is_root, cpu, cfs_rq),
TP_CONDITION(is_root),
TP_STRUCT__entry(
__field( int, cpu )
__field(unsigned long, util_avg )
__field(unsigned long, uclamp_avg )
__field(unsigned long, uclamp_min )
__field(unsigned long, uclamp_max )
),
TP_fast_assign(
__entry->cpu = cpu;
__entry->util_avg = cfs_rq->avg.util_avg;
__entry->uclamp_avg = uclamp_rq_util_with(cpu_rq(cpu), cfs_rq->avg.util_avg, NULL);
__entry->uclamp_min = cpu_rq(cpu)->uclamp[UCLAMP_MIN].value;
__entry->uclamp_max = cpu_rq(cpu)->uclamp[UCLAMP_MAX].value;
),
TP_printk("cpu=%d util_avg=%lu uclamp_avg=%lu "
"uclamp_min=%lu uclamp_max=%lu",
__entry->cpu, __entry->util_avg, __entry->uclamp_avg,
__entry->uclamp_min, __entry->uclamp_max)
);
#else
#define trace_uclamp_util_se(is_task, p, rq) while(false) {}
#define trace_uclamp_util_se_enabled() false
#define trace_uclamp_util_cfs(is_root, cpu, cfs_rq) while(false) {}
#define trace_uclamp_util_cfs_enabled() false
#endif /* CONFIG_UCLAMP_TASK */
#endif /* _SCHED_EVENTS_H */
/* This part must be outside protection */
......
......@@ -4,6 +4,8 @@
#include <linux/sched.h>
#include <trace/events/sched.h>
#include "sched.h"
#define CREATE_TRACE_POINTS
#include "sched_events.h"
......@@ -38,6 +40,13 @@ static void sched_pelt_cfs(void *data, struct cfs_rq *cfs_rq)
trace_sched_pelt_cfs(cpu, path, avg);
}
if (trace_uclamp_util_cfs_enabled()) {
unsigned int cpu = sched_trace_cfs_rq_cpu(cfs_rq);
bool __maybe_unused is_root_rq = (&cpu_rq(cpu)->cfs == cfs_rq);
trace_uclamp_util_cfs(is_root_rq, cpu, cfs_rq);
}
}
static void sched_pelt_rt(void *data, struct rq *rq)
......@@ -99,6 +108,14 @@ static void sched_pelt_se(void *data, struct sched_entity *se)
trace_sched_pelt_se(cpu, path, comm, pid, &se->avg);
}
if (trace_uclamp_util_se_enabled()) {
void __maybe_unused *cfs_rq = get_se_cfs_rq(se);
trace_uclamp_util_se(entity_is_task(se),
container_of(se, struct task_struct, se),
rq_of(cfs_rq));
}
}
static void sched_overutilized(void *data, struct root_domain *rd, bool overutilized)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment