Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\taskstats.c Create Date:2022-07-28 11:49:08
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:fill_stats_for_tgid

Proto:static int fill_stats_for_tgid(pid_t tgid, struct taskstats *stats)

Type:int

Parameter:

TypeParameterName
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  If Not first || Not lock_task_sighand(first, & flags) Then Go to out
213  If stats Then No 3D Now!(stats, stats, size of stats )
215  Else memset(stats, 0, size of stats )
218  tsk = first
219  start_time = ktime_get_ns()
220  Do
221  If exit state Then Continue
229  delayacct_add_tsk(stats, tsk)
232  delta = start_time - Monotonic time in nsecs:
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 += Context switch counts:
242  nonvoluntary_ctxt_switches += nivcsw
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  Return rc
Caller
NameDescribe
cmd_attr_tgid