/* Sample a per-thread clock for the given task.  */
static int cpu_clock_sample(const clockid_t which_clock, struct task_struct *p, union cpu_time_count *cpu)
/* Sample a per-thread clock for the given task.  */
static int cpu_clock_sample(const clockid_t which_clock, struct task_struct *p, union cpu_time_count *cpu)
{
	switch (CPUCLOCK_WHICH(which_clock)) {
	default:
		return -EINVAL;
	case CPUCLOCK_PROF:
		cpu->cpu = prof_ticks(p);
		break;
	case CPUCLOCK_VIRT:
		cpu->cpu = virt_ticks(p);
		break;
	case CPUCLOCK_SCHED:
		cpu->sched = task_sched_runtime(p);
		break;
	}
	return 0;
}