Lines Matching refs:stats
157 static void exe_add_tsk(struct taskstats *stats, struct task_struct *tsk) in exe_add_tsk() argument
164 stats->ac_exe_dev = in exe_add_tsk()
166 stats->ac_exe_inode = exe_file->f_inode->i_ino; in exe_add_tsk()
169 stats->ac_exe_dev = 0; in exe_add_tsk()
170 stats->ac_exe_inode = 0; in exe_add_tsk()
176 struct task_struct *tsk, struct taskstats *stats) in fill_stats() argument
178 memset(stats, 0, sizeof(*stats)); in fill_stats()
186 delayacct_add_tsk(stats, tsk); in fill_stats()
189 stats->version = TASKSTATS_VERSION; in fill_stats()
190 stats->nvcsw = tsk->nvcsw; in fill_stats()
191 stats->nivcsw = tsk->nivcsw; in fill_stats()
192 bacct_add_tsk(user_ns, pid_ns, stats, tsk); in fill_stats()
195 xacct_add_tsk(stats, tsk); in fill_stats()
198 exe_add_tsk(stats, tsk); in fill_stats()
201 static int fill_stats_for_pid(pid_t pid, struct taskstats *stats) in fill_stats_for_pid() argument
208 fill_stats(current_user_ns(), task_active_pid_ns(current), tsk, stats); in fill_stats_for_pid()
213 static int fill_stats_for_tgid(pid_t tgid, struct taskstats *stats) in fill_stats_for_tgid() argument
231 if (first->signal->stats) in fill_stats_for_tgid()
232 memcpy(stats, first->signal->stats, sizeof(*stats)); in fill_stats_for_tgid()
234 memset(stats, 0, sizeof(*stats)); in fill_stats_for_tgid()
247 delayacct_add_tsk(stats, tsk); in fill_stats_for_tgid()
253 stats->ac_etime += delta; in fill_stats_for_tgid()
256 stats->ac_utime += div_u64(utime, NSEC_PER_USEC); in fill_stats_for_tgid()
257 stats->ac_stime += div_u64(stime, NSEC_PER_USEC); in fill_stats_for_tgid()
259 stats->nvcsw += tsk->nvcsw; in fill_stats_for_tgid()
260 stats->nivcsw += tsk->nivcsw; in fill_stats_for_tgid()
268 stats->version = TASKSTATS_VERSION; in fill_stats_for_tgid()
281 if (!tsk->signal->stats) in fill_tgid_exit()
290 delayacct_add_tsk(tsk->signal->stats, tsk); in fill_tgid_exit()
411 struct cgroupstats *stats; in cgroupstats_user_cmd() local
441 stats = nla_data(na); in cgroupstats_user_cmd()
442 memset(stats, 0, sizeof(*stats)); in cgroupstats_user_cmd()
444 rc = cgroupstats_build(stats, f.file->f_path.dentry); in cgroupstats_user_cmd()
502 struct taskstats *stats; in cmd_attr_pid() local
516 stats = mk_reply(rep_skb, TASKSTATS_TYPE_PID, pid); in cmd_attr_pid()
517 if (!stats) in cmd_attr_pid()
520 rc = fill_stats_for_pid(pid, stats); in cmd_attr_pid()
531 struct taskstats *stats; in cmd_attr_tgid() local
545 stats = mk_reply(rep_skb, TASKSTATS_TYPE_TGID, tgid); in cmd_attr_tgid()
546 if (!stats) in cmd_attr_tgid()
549 rc = fill_stats_for_tgid(tgid, stats); in cmd_attr_tgid()
575 struct taskstats *stats_new, *stats; in taskstats_tgid_alloc() local
578 stats = smp_load_acquire(&sig->stats); in taskstats_tgid_alloc()
579 if (stats || thread_group_empty(tsk)) in taskstats_tgid_alloc()
580 return stats; in taskstats_tgid_alloc()
586 stats = sig->stats; in taskstats_tgid_alloc()
587 if (!stats) { in taskstats_tgid_alloc()
592 smp_store_release(&sig->stats, stats_new); in taskstats_tgid_alloc()
593 stats = stats_new; in taskstats_tgid_alloc()
601 return stats; in taskstats_tgid_alloc()
609 struct taskstats *stats; in taskstats_exit() local
638 stats = mk_reply(rep_skb, TASKSTATS_TYPE_PID, in taskstats_exit()
640 if (!stats) in taskstats_exit()
643 fill_stats(&init_user_ns, &init_pid_ns, tsk, stats); in taskstats_exit()
645 stats->ac_flag |= AGROUP; in taskstats_exit()
653 stats = mk_reply(rep_skb, TASKSTATS_TYPE_TGID, in taskstats_exit()
655 if (!stats) in taskstats_exit()
658 memcpy(stats, tsk->signal->stats, sizeof(*stats)); in taskstats_exit()