函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:cpuacct_cpuusage_read

函数原型:static u64 cpuacct_cpuusage_read(struct cpuacct *ca, int cpu, enum cpuacct_stat_index index)

返回类型:u64

参数:

类型参数名称
struct cpuacct *ca
intcpu
enum cpuacct_stat_indexindex
101  cpuusage等于per_cpu_ptr(cpuusage holds pointer to a u64-type object on every CPU , cpu)
108  BUG_ON(index > CPUACCT_STAT_NSTATS)
114  关闭本地中断,获取所要保护的运行队列(runqueue)的自旋锁(spinlock),为查找可运行进程做准备。( & lock)
117  如果index恒等于CPUACCT_STAT_NSTATS
118  i等于0
120  data等于0
121 i小于CPUACCT_STAT_NSTATS循环data加等于usages[i]
123  否则
124  data等于usages[index]
128  raw_spin_unlock_irq( & lock)
131  返回:data
调用者
名称描述
__cpuusage_readReturn total CPU usage (in nanoseconds) of a group
__cpuacct_percpu_seq_show