Skip to content

Commit 4e9a4e3

Browse files
nashifjhedberg
authored andcommitted
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>
1 parent f2428c6 commit 4e9a4e3

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

include/zephyr/sys/cpu_load.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extern "C" {
3434
* @retval -errno code in case of failure.
3535
*
3636
*/
37-
int cpu_load_get(int cpu_id);
37+
int cpu_load_metric_get(int cpu_id);
3838

3939
/**
4040
* @}

lib/os/cpu_load/cpu_load.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ static uint64_t total_cycles_prev[CONFIG_MP_MAX_NUM_CPUS];
1414

1515
static struct k_spinlock lock[CONFIG_MP_MAX_NUM_CPUS];
1616

17-
int cpu_load_get(int cpu_id)
17+
int cpu_load_metric_get(int cpu_id)
1818
{
1919
int ret;
2020
int load;

samples/subsys/cpu_freq/on_demand/sample.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ common:
88
type: multi_line
99
regex:
1010
- "^.*<inf> cpu_freq_sample: Starting CPU Freq Subsystem Sample!"
11-
- "^.*<dbg> cpu_load_metric: cpu_load_get: CPU[0-9]+ Execution cycles: \
11+
- "^.*<dbg> cpu_load_metric: cpu_load_metric_get: CPU[0-9]+ Execution cycles: \
1212
[0-9]+, Total cycles: [0-9]+"
1313
- "^.*<dbg> cpu_freq_policy_on_demand: cpu_freq_policy_select_pstate: \
1414
CPU[0-9]+ Load: [0-9]+%"

subsys/cpu_freq/policies/on_demand/on_demand.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int cpu_freq_policy_select_pstate(const struct pstate **pstate_out)
5353
cpu_id = arch_curr_cpu()->id;
5454
#endif
5555

56-
cpu_load = cpu_load_get(cpu_id);
56+
cpu_load = cpu_load_metric_get(cpu_id);
5757
if (cpu_load < 0) {
5858
LOG_ERR("Unable to retrieve CPU load");
5959
return cpu_load;

0 commit comments

Comments
 (0)