static u64 get_iowait_time(int cpu)
{
	u64 iowait, iowait_time = -1ULL;

	if (cpu_online(cpu))
		iowait_time = get_cpu_iowait_time_us(cpu, NULL);

	if (iowait_time == -1ULL)
		/* !NO_HZ or cpu offline so we can rely on cpustat.iowait */
		iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
	else
		iowait = usecs_to_cputime64(iowait_time);

	return iowait;
}
/*lint --e{551,713}*/
static cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall)/*lint !e551*/
{

    u64 idle_time = get_cpu_idle_time_us((int)cpu, NULL);/*lint !e530 !e712 */
    /*lint --e{501} */
    if (idle_time == -1ULL)
    {
        return get_cpu_idle_time_jiffy(cpu, wall);
    }
    else
    {
        idle_time += get_cpu_iowait_time_us((int)cpu, wall);
    }

    return idle_time;
}
Exemple #3
0
static cputime64_t get_iowait_time(int cpu)
{
	u64 iowait_time = -1ULL;
	cputime64_t iowait;

	if (cpu_online(cpu))
		iowait_time = get_cpu_iowait_time_us(cpu, NULL);

	if (iowait_time == -1ULL)
		/* !NO_HZ or cpu offline so we can rely on cpustat.iowait */
		iowait = kstat_cpu(cpu).cpustat.iowait;
	else
		iowait = usecs_to_cputime64(iowait_time);

	return iowait;
}
static u64 get_iowait_time(int cpu)
{
	u64 iowait, iowait_time = -1ULL;
    #ifdef CONFIG_MTK_IDLE_TIME_FIX
	iowait_time = get_cpu_iowait_time_us_wo_cpuoffline(cpu, NULL);
    #else
	iowait_time = get_cpu_iowait_time_us(cpu, NULL);
	#endif
	
	if (iowait_time == -1ULL)
		/* !NO_HZ or cpu offline so we can rely on cpustat.iowait */
		iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
	else
		iowait = usecs_to_cputime64(iowait_time);

	return iowait;
}
Exemple #5
0
unsigned long long mtprof_get_cpu_idle(int cpu)
{
    u64 unused = 0, idle_time = 0;
	idle_time = get_cpu_idle_time_us(cpu, NULL);

	if (idle_time == -1ULL)
	{	
		return get_cpu_idle_time_jiffy(cpu, &unused);
	}
	else
	{	
		idle_time += get_cpu_iowait_time_us(cpu, &unused);
	}
	printk("update time is is %llu\n", unused);
					
	return idle_time;
}
static u64 get_iowait_time(int cpu)
{
	u64 iowait, iowait_time = -1ULL;

	/* FIXME: the iowait time from get_cpu_iowait_time_us() is reset while CPU is hot-pluged.
	 *        Using cpustat[CPUTIME_IOWAIT] to get iowait. It isn't very accurate, but stable */
#if 0
	if (cpu_online(cpu))
		iowait_time = get_cpu_iowait_time_us(cpu, NULL);
#endif

	if (iowait_time == -1ULL)
		iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
	else
		iowait = usecs_to_cputime64(iowait_time);

	return iowait;
}
static void init_cpu_load_trend(void)
{
	int i;

	for_each_possible_cpu(i) {
		struct hotplug_cpu_info *info;
		int j;

		info = &per_cpu(hotplug_info, i);

		info->prev_cpu_idle = get_cpu_idle_time_us(i,
						&(info->prev_cpu_wall));
		info->prev_cpu_io = get_cpu_iowait_time_us(i,
						&(info->prev_cpu_wall));

		for (j = 0; j < LOAD_MONITOR; j++) {
			info->load[j] = 100;
		}
		info->idx = 0;
	}
}
unsigned long long mtprof_get_cpu_iowait(int cpu)
{
    unsigned long long *unused = 0;
    return get_cpu_iowait_time_us(cpu, unused);
}