cpu_load: rename conflicting API

We have two places defining cpu_load_get() and trying to the same thing,
one is a core kernel feature supported on all architecture, the other is
part of debug, requires tracing and supported only on a subset of
architectures. Both deliver different results and accuracy.

While we figure our how to merge those into one API and with the
advanatges of both, rename the API so there is no confusion about what
is being used.

Fixes #97845

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif
2025-11-04 14:03:48 -05:00
committed by Johan Hedberg
parent f2428c68ff
commit 4e9a4e385a
4 changed files with 4 additions and 4 deletions

View File

@@ -34,7 +34,7 @@ extern "C" {
* @retval -errno code in case of failure.
*
*/
int cpu_load_get(int cpu_id);
int cpu_load_metric_get(int cpu_id);
/**
* @}

View File

@@ -14,7 +14,7 @@ static uint64_t total_cycles_prev[CONFIG_MP_MAX_NUM_CPUS];
static struct k_spinlock lock[CONFIG_MP_MAX_NUM_CPUS];
int cpu_load_get(int cpu_id)
int cpu_load_metric_get(int cpu_id)
{
int ret;
int load;

View File

@@ -8,7 +8,7 @@ common:
type: multi_line
regex:
- "^.*<inf> cpu_freq_sample: Starting CPU Freq Subsystem Sample!"
- "^.*<dbg> cpu_load_metric: cpu_load_get: CPU[0-9]+ Execution cycles: \
- "^.*<dbg> cpu_load_metric: cpu_load_metric_get: CPU[0-9]+ Execution cycles: \
[0-9]+, Total cycles: [0-9]+"
- "^.*<dbg> cpu_freq_policy_on_demand: cpu_freq_policy_select_pstate: \
CPU[0-9]+ Load: [0-9]+%"

View File

@@ -53,7 +53,7 @@ int cpu_freq_policy_select_pstate(const struct pstate **pstate_out)
cpu_id = arch_curr_cpu()->id;
#endif
cpu_load = cpu_load_get(cpu_id);
cpu_load = cpu_load_metric_get(cpu_id);
if (cpu_load < 0) {
LOG_ERR("Unable to retrieve CPU load");
return cpu_load;