函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:fill_stats_for_tgid

函数原型:static int fill_stats_for_tgid(pid_t tgid, struct taskstats *stats)

返回类型:int

参数:

类型参数名称
pid_ttgid
struct taskstats *stats
199  rc等于负ESRCH
207  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
208  first等于find_task_by_vpid(tgid)
210  如果非first或非lock_task_sighand(first, & flags)则转到:out
213  如果stats内存复制(stats, stats, stats的长度)
215  否则memset(stats, 0, stats的长度)
218  tsk等于first
219  start_time等于ktime_get_ns()
220  循环
221  如果进程退出时状态则继续下一循环
229  delayacct_add_tsk(stats, tsk)
232  delta等于start_time进程创建时间戳
234  do_div() is NOT a C function(delta, NSEC_PER_USEC)
235  ac_etime加等于delta
237  task_cputime(tsk, & utime, & stime)
238  User CPU time [usec] 加等于div_u64 - unsigned 64bit divide with 32bit divisor*@dividend: unsigned 64bit dividend*@divisor: unsigned 32bit divisor* This is the most common 64bit divide and should be used if possible,* as many 32bit archs can optimize this variant better than a full
239  SYstem CPU time [usec] 加等于div_u64 - unsigned 64bit divide with 32bit divisor*@dividend: unsigned 64bit dividend*@divisor: unsigned 32bit divisor* This is the most common 64bit divide and should be used if possible,* as many 32bit archs can optimize this variant better than a full
241  voluntary_ctxt_switches 加等于切换计数
242  nonvoluntary_ctxt_switches 加等于上下文切换计数
245  unlock_task_sighand(first, & flags)
246  rc等于0
247  out :
248  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
250  The version number of this struct. This field is always set to * TAKSTATS_VERSION, which is defined in . * Each time the struct is changed, the value should be incremented.等于Format for per-task data returned to userland when* - a task exits* - listener requests stats for a task* The struct is versioned
255  返回:rc
调用者
名称描述
cmd_attr_tgid