cpufreq interactive governor: event tracing
Change-Id: Ic13614a3da2faa2d4bd215ca3eb7191614f0cf66 Signed-off-by: Todd Poynor <toddpoynor@google.com>
This commit is contained in:
parent
008bd616dd
commit
2561571b3b
2 changed files with 105 additions and 1 deletions
|
@ -30,6 +30,9 @@
|
|||
#include <linux/kthread.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include <trace/events/cpufreq_interactive.h>
|
||||
|
||||
#include <asm/cputime.h>
|
||||
|
||||
static atomic_t active_count = ATOMIC_INIT(0);
|
||||
|
@ -182,7 +185,11 @@ static void cpufreq_interactive_timer(unsigned long data)
|
|||
new_freq = pcpu->freq_table[index].frequency;
|
||||
|
||||
if (pcpu->target_freq == new_freq)
|
||||
{
|
||||
trace_cpufreq_interactive_already(data, cpu_load,
|
||||
pcpu->target_freq, new_freq);
|
||||
goto rearm_if_notmax;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do not scale down unless we have been at this frequency for the
|
||||
|
@ -190,10 +197,16 @@ static void cpufreq_interactive_timer(unsigned long data)
|
|||
*/
|
||||
if (new_freq < pcpu->target_freq) {
|
||||
if (pcpu->timer_run_time - pcpu->freq_change_time
|
||||
< min_sample_time)
|
||||
< min_sample_time) {
|
||||
trace_cpufreq_interactive_notyet(data, cpu_load,
|
||||
pcpu->target_freq, new_freq);
|
||||
goto rearm;
|
||||
}
|
||||
}
|
||||
|
||||
trace_cpufreq_interactive_target(data, cpu_load, pcpu->target_freq,
|
||||
new_freq);
|
||||
|
||||
if (new_freq < pcpu->target_freq) {
|
||||
pcpu->target_freq = new_freq;
|
||||
spin_lock_irqsave(&down_cpumask_lock, flags);
|
||||
|
@ -381,6 +394,8 @@ static int cpufreq_interactive_up_task(void *data)
|
|||
pcpu->freq_change_time_in_idle =
|
||||
get_cpu_idle_time_us(cpu,
|
||||
&pcpu->freq_change_time);
|
||||
trace_cpufreq_interactive_up(cpu, pcpu->target_freq,
|
||||
pcpu->policy->cur);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -427,6 +442,8 @@ static void cpufreq_interactive_freq_down(struct work_struct *work)
|
|||
pcpu->freq_change_time_in_idle =
|
||||
get_cpu_idle_time_us(cpu,
|
||||
&pcpu->freq_change_time);
|
||||
trace_cpufreq_interactive_down(cpu, pcpu->target_freq,
|
||||
pcpu->policy->cur);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
87
include/trace/events/cpufreq_interactive.h
Normal file
87
include/trace/events/cpufreq_interactive.h
Normal file
|
@ -0,0 +1,87 @@
|
|||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM cpufreq_interactive
|
||||
|
||||
#if !defined(_TRACE_CPUFREQ_INTERACTIVE_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_CPUFREQ_INTERACTIVE_H
|
||||
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
DECLARE_EVENT_CLASS(set,
|
||||
TP_PROTO(u32 cpu_id, unsigned long targfreq,
|
||||
unsigned long actualfreq),
|
||||
TP_ARGS(cpu_id, targfreq, actualfreq),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( u32, cpu_id )
|
||||
__field(unsigned long, targfreq )
|
||||
__field(unsigned long, actualfreq )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->cpu_id = (u32) cpu_id;
|
||||
__entry->targfreq = targfreq;
|
||||
__entry->actualfreq = actualfreq;
|
||||
),
|
||||
|
||||
TP_printk("cpu=%u targ=%lu actual=%lu",
|
||||
__entry->cpu_id, __entry->targfreq,
|
||||
__entry->actualfreq)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(set, cpufreq_interactive_up,
|
||||
TP_PROTO(u32 cpu_id, unsigned long targfreq,
|
||||
unsigned long actualfreq),
|
||||
TP_ARGS(cpu_id, targfreq, actualfreq)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(set, cpufreq_interactive_down,
|
||||
TP_PROTO(u32 cpu_id, unsigned long targfreq,
|
||||
unsigned long actualfreq),
|
||||
TP_ARGS(cpu_id, targfreq, actualfreq)
|
||||
);
|
||||
|
||||
DECLARE_EVENT_CLASS(loadeval,
|
||||
TP_PROTO(unsigned long cpu_id, unsigned long load,
|
||||
unsigned long curfreq, unsigned long targfreq),
|
||||
TP_ARGS(cpu_id, load, curfreq, targfreq),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(unsigned long, cpu_id )
|
||||
__field(unsigned long, load )
|
||||
__field(unsigned long, curfreq )
|
||||
__field(unsigned long, targfreq )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->cpu_id = cpu_id;
|
||||
__entry->load = load;
|
||||
__entry->curfreq = curfreq;
|
||||
__entry->targfreq = targfreq;
|
||||
),
|
||||
|
||||
TP_printk("cpu=%lu load=%lu cur=%lu targ=%lu",
|
||||
__entry->cpu_id, __entry->load, __entry->curfreq,
|
||||
__entry->targfreq)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(loadeval, cpufreq_interactive_target,
|
||||
TP_PROTO(unsigned long cpu_id, unsigned long load,
|
||||
unsigned long curfreq, unsigned long targfreq),
|
||||
TP_ARGS(cpu_id, load, curfreq, targfreq)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(loadeval, cpufreq_interactive_already,
|
||||
TP_PROTO(unsigned long cpu_id, unsigned long load,
|
||||
unsigned long curfreq, unsigned long targfreq),
|
||||
TP_ARGS(cpu_id, load, curfreq, targfreq)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(loadeval, cpufreq_interactive_notyet,
|
||||
TP_PROTO(unsigned long cpu_id, unsigned long load,
|
||||
unsigned long curfreq, unsigned long targfreq),
|
||||
TP_ARGS(cpu_id, load, curfreq, targfreq)
|
||||
);
|
||||
#endif /* _TRACE_CPUFREQ_INTERACTIVE_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
Loading…
Add table
Reference in a new issue