diff --git a/lisa/_assets/kmodules/sched_tp/ftrace_events.h b/lisa/_assets/kmodules/sched_tp/ftrace_events.h index 2dccabf9d87649a667ce4e6533788a851c989633..1360cd8a7d3850f5e78be0908328fe9f8111b7c3 100644 --- a/lisa/_assets/kmodules/sched_tp/ftrace_events.h +++ b/lisa/_assets/kmodules/sched_tp/ftrace_events.h @@ -95,6 +95,10 @@ DEFINE_EVENT(sched_pelt_rq_template, sched_pelt_irq, TP_PROTO(int cpu, const struct sched_avg *avg), TP_ARGS(cpu, avg)); +DEFINE_EVENT(sched_pelt_rq_template, sched_pelt_thermal, + TP_PROTO(int cpu, const struct sched_avg *avg), + TP_ARGS(cpu, avg)); + TRACE_EVENT(sched_pelt_se, TP_PROTO(int cpu, char *path, char *comm, int pid, const struct sched_avg *avg), diff --git a/lisa/_assets/kmodules/sched_tp/sched_helpers.h b/lisa/_assets/kmodules/sched_tp/sched_helpers.h index 6305cefcda4d7cd8e576e315ba89da164fd752ec..800a603d982114aa5c87120d916305bbd6e6a966 100644 --- a/lisa/_assets/kmodules/sched_tp/sched_helpers.h +++ b/lisa/_assets/kmodules/sched_tp/sched_helpers.h @@ -165,6 +165,15 @@ static inline const struct sched_avg *sched_tp_rq_avg_irq(struct rq *rq) #endif } +static inline const struct sched_avg *sched_tp_rq_avg_thermal(struct rq *rq) +{ +#if defined(CONFIG_SMP) && defined(CONFIG_SCHED_THERMAL_PRESSURE) + return rq ? (struct sched_avg *)&rq->avg_thermal : NULL; +#else + return NULL; +#endif +} + static inline int sched_tp_rq_cpu(struct rq *rq) { return rq ? cpu_of(rq) : -1; diff --git a/lisa/_assets/kmodules/sched_tp/tp.c b/lisa/_assets/kmodules/sched_tp/tp.c index 097cf1730c9e85e99393e454494927ecffeae457..503a3f1b7efdf7f9cddc16972b84fe800bdf6568 100644 --- a/lisa/_assets/kmodules/sched_tp/tp.c +++ b/lisa/_assets/kmodules/sched_tp/tp.c @@ -95,6 +95,18 @@ static void sched_pelt_irq_probe(struct feature *feature, struct rq *rq) } DEFINE_TP_EVENT_FEATURE(sched_pelt_irq, pelt_irq_tp, sched_pelt_irq_probe); +static void sched_pelt_thermal_probe(struct feature *feature, struct rq *rq) +{ + const struct sched_avg *avg = sched_tp_rq_avg_thermal(rq); + int cpu = sched_tp_rq_cpu(rq); + + if (!avg) + return; + + trace_sched_pelt_thermal(cpu, avg); +} +DEFINE_TP_EVENT_FEATURE(sched_pelt_thermal, pelt_thermal_tp, sched_pelt_thermal_probe); + static void sched_pelt_se_probe(struct feature *feature, struct sched_entity *se) { _trace_se(se, trace_sched_pelt_se); diff --git a/lisa/datautils.py b/lisa/datautils.py index 399555d6c09504b43798a17855a5993fbaa3a37a..75081c6d1c684ef64107ae44a87eea38498b07b2 100644 --- a/lisa/datautils.py +++ b/lisa/datautils.py @@ -2062,6 +2062,7 @@ _SIGNALS = [ SignalDesc('sched_pelt_irq', ['cpu']), SignalDesc('sched_pelt_rt', ['cpu']), SignalDesc('sched_pelt_dl', ['cpu']), + SignalDesc('sched_pelt_thermal', ['cpu']), SignalDesc('uclamp_util_se', ['pid', 'comm']), SignalDesc('uclamp_util_cfs', ['cpu']), diff --git a/lisa/trace.py b/lisa/trace.py index 80f183c7814e0f4577e49e8ebf5934a95ae59bba..e565c0694ec8b8ad94667619e8b261bfe07d8788 100644 --- a/lisa/trace.py +++ b/lisa/trace.py @@ -1486,6 +1486,14 @@ class TxtTraceParser(TxtTraceParserBase): 'util': _KERNEL_DTYPE['util'], }, ), + 'sched_pelt_thermal': dict( + fields={ + 'cpu': _KERNEL_DTYPE['cpu'], + 'load': _KERNEL_DTYPE['util'], + 'rbl_load': _KERNEL_DTYPE['util'], + 'util': _KERNEL_DTYPE['util'], + }, + ), 'sched_process_wait': dict( fields={ 'comm': _KERNEL_DTYPE['comm'],