函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:更新当前进程的内核态和用户态占用率

函数原型:void account_process_tick(struct task_struct *p, int user_tick)

返回类型:void

参数:

类型参数名称
struct task_struct *p
intuser_tick
476  rq等于this_rq()
478  如果vtime_accounting_enabled_this_cpu()则返回
481  如果SPDX-License-Identifier: GPL-2.0-only
482  irqtime_account_process_tick(p, user_tick, rq, 1)
483  返回
486  cputime等于TICK_NSEC is the time between ticks in nsec assuming SHIFTED_HZ
487  steal等于When a guest is interrupted for a longer amount of time, missed clock* ticks are not redelivered later. Due to that, this function may on* occasion account more time than the calling functions think elapsed.
489  如果steal大于等于cputime则返回
492  cputime减等于steal
494  如果user_tickAccount user CPU time to a process.*@p: the process that the CPU time gets accounted to*@cputime: the CPU time spent in user space since the last update
496  否则如果p不等于空闲任务irq_count()不等于HARDIRQ_OFFSETAccount system CPU time to a process.*@p: the process that the CPU time gets accounted to*@hardirq_offset: the offset to subtract from hardirq_count()*@cputime: the CPU time spent in kernel space since the last update
498  否则Account for idle time.*@cputime: the CPU time spent in idle wait
调用者
名称描述
update_process_timesCalled from the timer interrupt handler to charge one tick to the current* process. user_tick is 1 if the tick is user time, 0 for system.