cpuidle: governors: qcom-lpm: Log the prediction pattern type
Log the prediction pattern type in trace. While at this also fix setting next_pred_time conversion to usec. Change-Id: I5f5370fccd421661d5bc62cb679867e907a44af5 Signed-off-by: Maulik Shah <quic_mkshah@quicinc.com>
This commit is contained in:
parent
c7a452dcff
commit
62dbe04436
@ -30,6 +30,11 @@
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include "trace-qcom-lpm.h"
|
||||
|
||||
#define LPM_PRED_RESET 0
|
||||
#define LPM_PRED_RESIDENCY_PATTERN 1
|
||||
#define LPM_PRED_PREMATURE_EXITS 2
|
||||
#define LPM_PRED_IPI_PATTERN 3
|
||||
|
||||
#define LPM_SELECT_STATE_DISABLED 0
|
||||
#define LPM_SELECT_STATE_QOS_UNMET 1
|
||||
#define LPM_SELECT_STATE_RESIDENCY_UNMET 2
|
||||
@ -266,8 +271,10 @@ static void cpu_predict(struct lpm_cpu *cpu_gov, u64 duration_ns)
|
||||
* that mode.
|
||||
*/
|
||||
cpu_gov->predicted = find_deviation(cpu_gov, lpm_history->resi, duration_ns);
|
||||
if (cpu_gov->predicted)
|
||||
if (cpu_gov->predicted) {
|
||||
cpu_gov->pred_type = LPM_PRED_RESIDENCY_PATTERN;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the number of premature exits for each of the mode,
|
||||
@ -291,8 +298,9 @@ static void cpu_predict(struct lpm_cpu *cpu_gov, u64 duration_ns)
|
||||
if (count >= PRED_PREMATURE_CNT) {
|
||||
do_div(avg_residency, count);
|
||||
cpu_gov->predicted = avg_residency;
|
||||
cpu_gov->next_pred_time = ktime_to_ns(cpu_gov->now)
|
||||
cpu_gov->next_pred_time = ktime_to_us(cpu_gov->now)
|
||||
+ cpu_gov->predicted;
|
||||
cpu_gov->pred_type = LPM_PRED_PREMATURE_EXITS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -302,6 +310,8 @@ static void cpu_predict(struct lpm_cpu *cpu_gov, u64 duration_ns)
|
||||
|
||||
cpu_gov->predicted = find_deviation(cpu_gov, ipi_history->interval,
|
||||
duration_ns);
|
||||
if (cpu_gov->predicted)
|
||||
cpu_gov->pred_type = LPM_PRED_IPI_PATTERN;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -326,6 +336,7 @@ void clear_cpu_predict_history(void)
|
||||
lpm_history->samples_idx = 0;
|
||||
lpm_history->nsamp = 0;
|
||||
cpu_gov->next_pred_time = 0;
|
||||
cpu_gov->pred_type = LPM_PRED_RESET;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -365,6 +376,7 @@ static void update_cpu_history(struct lpm_cpu *cpu_gov)
|
||||
lpm_history->resi[lpm_history->samples_idx] = measured_us;
|
||||
|
||||
lpm_history->mode[lpm_history->samples_idx] = idx;
|
||||
cpu_gov->pred_type = LPM_PRED_RESET;
|
||||
|
||||
trace_gov_pred_hist(idx, lpm_history->resi[lpm_history->samples_idx],
|
||||
tmr);
|
||||
@ -639,7 +651,7 @@ static int lpm_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
|
||||
}
|
||||
|
||||
trace_lpm_gov_select(i, latency_req, duration_ns, reason);
|
||||
trace_gov_pred_select(cpu_gov->predicted, cpu_gov->predicted, htime);
|
||||
trace_gov_pred_select(cpu_gov->pred_type, cpu_gov->predicted, htime);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ struct lpm_cpu {
|
||||
ktime_t now;
|
||||
uint64_t bias;
|
||||
int64_t next_pred_time;
|
||||
uint32_t pred_type;
|
||||
bool ipi_pending;
|
||||
spinlock_t lock;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user