Example #1
0
static void proc_cpuidle_cpu_output(unsigned int cpu)
{
    long max_allowed_cstate = 2000000000;
    int cstate, cstates;

    cstates = sysfs_get_idlestate_count(cpu);
    if (cstates < 1) {
        printf(_("CPU %u: No C-states info\n"), cpu);
        return;
    }

    printf(_("active state:            C0\n"));
    printf(_("max_cstate:              C%u\n"), cstates-1);
    printf(_("maximum allowed latency: %lu usec\n"), max_allowed_cstate);
    printf(_("states:\t\n"));
    for (cstate = 1; cstate < cstates; cstate++) {
        printf(_("    C%d:                  "
                 "type[C%d] "), cstate, cstate);
        printf(_("promotion[--] demotion[--] "));
        printf(_("latency[%03lu] "),
               sysfs_get_idlestate_latency(cpu, cstate));
        printf(_("usage[%08lu] "),
               sysfs_get_idlestate_usage(cpu, cstate));
        printf(_("duration[%020Lu] \n"),
               sysfs_get_idlestate_time(cpu, cstate));
    }
}
Example #2
0
static void proc_cpuidle_cpu_output(unsigned int cpu)
{
	long max_allowed_cstate = 2000000000;
	int cstates, cstate;

	cstates = sysfs_get_idlestate_count(cpu);
	if (cstates == 0) {
		/*
		 * Go on and print same useless info as you'd see with
		 * cat /proc/acpi/processor/../power
		 *	printf(_("CPU %u: No C-states available\n"), cpu);
		 *	return;
		 */
	} else if (cstates <= 0) {
		printf(_("CPU %u: Can't read C-state info\n"), cpu);
		return;
	}
	/* printf("Cstates: %d\n", cstates); */

	printf(_("active state:            C0\n"));
	printf(_("max_cstate:              C%u\n"), cstates-1);
	printf(_("maximum allowed latency: %lu usec\n"), max_allowed_cstate);
	printf(_("states:\t\n"));
	for (cstate = 1; cstate < cstates; cstate++) {
		printf(_("    C%d:                  "
			 "type[C%d] "), cstate, cstate);
		printf(_("promotion[--] demotion[--] "));
		printf(_("latency[%03lu] "),
		       sysfs_get_idlestate_latency(cpu, cstate));
		printf(_("usage[%08lu] "),
		       sysfs_get_idlestate_usage(cpu, cstate));
		printf(_("duration[%020Lu] \n"),
		       sysfs_get_idlestate_time(cpu, cstate));
	}
}
Example #3
0
static void cpuidle_cpu_output(unsigned int cpu, int verbose)
{
	int idlestates, idlestate;
	char *tmp;

	printf(_ ("Analyzing CPU %d:\n"), cpu);

	idlestates = sysfs_get_idlestate_count(cpu);
	if (idlestates == 0) {
		printf(_("CPU %u: No idle states\n"), cpu);
		return;
	} else if (idlestates <= 0) {
		printf(_("CPU %u: Can't read idle state info\n"), cpu);
		return;
	}
	tmp = sysfs_get_idlestate_name(cpu, idlestates - 1);
	if (!tmp) {
		printf(_("Could not determine max idle state %u\n"),
		       idlestates - 1);
		return;
	}

	printf(_("Number of idle states: %d\n"), idlestates);

	printf(_("Available idle states:"));
	for (idlestate = 1; idlestate < idlestates; idlestate++) {
		tmp = sysfs_get_idlestate_name(cpu, idlestate);
		if (!tmp)
			continue;
		printf(" %s", tmp);
		free(tmp);
	}
	printf("\n");

	if (!verbose)
		return;

	for (idlestate = 1; idlestate < idlestates; idlestate++) {
		tmp = sysfs_get_idlestate_name(cpu, idlestate);
		if (!tmp)
			continue;
		printf("%s:\n", tmp);
		free(tmp);

		tmp = sysfs_get_idlestate_desc(cpu, idlestate);
		if (!tmp)
			continue;
		printf(_("Flags/Description: %s\n"), tmp);
		free(tmp);

		printf(_("Latency: %lu\n"),
		       sysfs_get_idlestate_latency(cpu, idlestate));
		printf(_("Usage: %lu\n"),
		       sysfs_get_idlestate_usage(cpu, idlestate));
		printf(_("Duration: %llu\n"),
		       sysfs_get_idlestate_time(cpu, idlestate));
	}
	printf("\n");
}
Example #4
0
static void cpuidle_cpu_output(unsigned int cpu, int verbose)
{
    int idlestates, idlestate;
    char *tmp;

    printf(_ ("Analyzing CPU %d:\n"), cpu);

    idlestates = sysfs_get_idlestate_count(cpu);
    if (idlestates < 1) {
        printf(_("CPU %u: No idle states\n"), cpu);
        return;
    }

    printf(_("Number of idle states: %d\n"), idlestates);
    printf(_("Available idle states:"));
    for (idlestate = 0; idlestate < idlestates; idlestate++) {
        tmp = sysfs_get_idlestate_name(cpu, idlestate);
        if (!tmp)
            continue;
        printf(" %s", tmp);
        free(tmp);
    }
    printf("\n");

    if (!verbose)
        return;

    for (idlestate = 0; idlestate < idlestates; idlestate++) {
        int disabled = sysfs_is_idlestate_disabled(cpu, idlestate);
        /* Disabled interface not supported on older kernels */
        if (disabled < 0)
            disabled = 0;
        tmp = sysfs_get_idlestate_name(cpu, idlestate);
        if (!tmp)
            continue;
        printf("%s%s:\n", tmp, (disabled) ? " (DISABLED) " : "");
        free(tmp);

        tmp = sysfs_get_idlestate_desc(cpu, idlestate);
        if (!tmp)
            continue;
        printf(_("Flags/Description: %s\n"), tmp);
        free(tmp);

        printf(_("Latency: %lu\n"),
               sysfs_get_idlestate_latency(cpu, idlestate));
        printf(_("Usage: %lu\n"),
               sysfs_get_idlestate_usage(cpu, idlestate));
        printf(_("Duration: %llu\n"),
               sysfs_get_idlestate_time(cpu, idlestate));
    }
    printf("\n");
}