函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\power\energy_model.c Create Date:2022-07-27 11:04:48
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:em_create_pd

函数原型:static struct em_perf_domain *em_create_pd(cpumask_t *span, int nr_states, struct em_data_callback *cb)

返回类型:struct em_perf_domain

参数:

类型参数名称
cpumask_t *span
intnr_states
struct em_data_callback *cb
84  prev_opp_eff等于ULONG_MAX
85  prev_freq等于0
86  cpu等于Uniprocessor. Assume all masks are "1".
91  如果非active_power则返回:NULL
94  pd等于分配内存并置零
95  如果非pd则返回:NULL
98  table等于分配数组内存并置零
99  如果非table则转到:free_pd
103 i小于nr_states循环
109  ret等于active_power( & power, & freq, cpu)
110  如果ret
111  打印错误信息("pd%d: invalid cap. state: %d\n", cpu, ret)
112  转到:free_cs_table
119  如果freq小于等于prev_freq
120  打印错误信息("pd%d: non-increasing freq: %lu\n", cpu, freq)
121  转到:free_cs_table
128  如果非powerpower大于EM_CPU_MAX_POWER
129  打印错误信息("pd%d: invalid power: %lu\n", cpu, power)
130  转到:free_cs_table
133  power等于power
134  frequency等于prev_freq等于freq
142  opp_eff等于freqpower
143  如果opp_eff大于等于prev_opp_eff打印警告信息("pd%d: hertz/watts ratio non-monotonically decreasing: em_cap_state %d >= em_cap_state%d\n", cpu, i, i - 1)
146  prev_opp_eff等于opp_eff
150  fmax等于frequency
151 i小于nr_states循环
152  cost等于div64_u64 - unsigned 64bit divide with 64bit divisor*@dividend: 64bit dividend*@divisor: 64bit divisor* This implementation is a modified version of the algorithm proposed* by the book 'Hacker's Delight'. The original source and full proof
156  table等于table
157  nr_cap_states等于nr_states
158  pumask_copy - *dstp = *srcp*@dstp: the result*@srcp: the input cpumask
160  em_debug_create_pd(pd, cpu)
162  返回:pd
164  free_cs_table :
165  释放内存
166  free_pd :
167  释放内存
169  返回:NULL
调用者
名称描述
em_register_perf_domainm_register_perf_domain() - Register the Energy Model of a performance domain*@span : Mask of CPUs in the performance domain*@nr_states : Number of capacity states to register*@cb : Callback functions providing the data of the Energy Model* Create Energy