/* Sample a process (thread group) timer for the given group_leader task. Must be called with tasklist_lock held for reading.  */
static int cpu_timer_sample_group(const clockid_t which_clock, struct task_struct *p, union cpu_time_count *cpu)
/* Sample a process (thread group) timer for the given group_leader task. Must be called with tasklist_lock held for reading.  */
static int cpu_timer_sample_group(const clockid_t which_clock, struct task_struct *p, union cpu_time_count *cpu)
{
	struct task_cputime cputime;
	thread_group_cputimer(p, &cputime);
	switch (CPUCLOCK_WHICH(which_clock)) {
	default:
		return -EINVAL;
	case CPUCLOCK_PROF:
		cpu->cpu = cputime_add(cputime.utime, cputime.stime);
		break;
	case CPUCLOCK_VIRT:
		cpu->cpu = cputime.utime;
		break;
	case CPUCLOCK_SCHED:
		cpu->sched = cputime.sum_exec_runtime + task_delta_exec(p);
		break;
	}
	return 0;
}