Use sysfs_is_cpu_online(cpu) instead of cpufreq_cpu_exists(cpu) to detect offlined cpus.
Re-arrange printfs slightly to have a consistent output even if you have multiple CPUs
as output and even if offlined cores are in between.
Signed-off-by: Thomas Renninger <trenn@suse.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
#include <getopt.h>
#include "cpufreq.h"
+#include "helpers/sysfs.h"
#include "helpers/helpers.h"
#include "helpers/bitmask.h"
if (!bitmask_isbitset(cpus_chosen, cpu))
continue;
- if (cpufreq_cpu_exists(cpu)) {
- printf(_("couldn't analyze CPU %d as it doesn't seem to be present\n"), cpu);
+
+ printf(_("analyzing CPU %d:\n"), cpu);
+
+ if (sysfs_is_cpu_online(cpu) != 1) {
+ printf(_(" *is offline\n"));
+ printf("\n");
continue;
}
- printf(_("analyzing CPU %d:\n"), cpu);
switch (output_param) {
case 'b':
}
if (ret)
return ret;
+ printf("\n");
}
return ret;
}
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
-#include <cpufreq.h>
#include "helpers/helpers.h"
#include "helpers/sysfs.h"
unsigned 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);
printf(_("Duration: %llu\n"),
sysfs_get_idlestate_time(cpu, idlestate));
}
- printf("\n");
}
static void cpuidle_general_output(void)
for (cpu = bitmask_first(cpus_chosen);
cpu <= bitmask_last(cpus_chosen); cpu++) {
- if (!bitmask_isbitset(cpus_chosen, cpu) ||
- cpufreq_cpu_exists(cpu))
+ if (!bitmask_isbitset(cpus_chosen, cpu))
continue;
+ printf(_("analyzing CPU %d:\n"), cpu);
+
+ if (sysfs_is_cpu_online(cpu) != 1) {
+ printf(_(" *is offline\n"));
+ printf("\n");
+ continue;
+ }
+
switch (output_param) {
case 'o':
cpuidle_cpu_output(cpu, verbose);
break;
}
+ printf("\n");
}
return EXIT_SUCCESS;
}
#include <string.h>
#include <getopt.h>
-#include <cpufreq.h>
#include "helpers/helpers.h"
#include "helpers/sysfs.h"
for (cpu = bitmask_first(cpus_chosen);
cpu <= bitmask_last(cpus_chosen); cpu++) {
- if (!bitmask_isbitset(cpus_chosen, cpu) ||
- cpufreq_cpu_exists(cpu))
+ if (!bitmask_isbitset(cpus_chosen, cpu))
continue;
printf(_("analyzing CPU %d:\n"), cpu);
+ if (sysfs_is_cpu_online(cpu) != 1){
+ printf(_(" *is offline\n"));
+ continue;
+ }
+
if (params.perf_bias) {
ret = msr_intel_get_perf_bias(cpu);
if (ret < 0) {
#include <string.h>
#include <getopt.h>
-#include <cpufreq.h>
#include "helpers/helpers.h"
#include "helpers/sysfs.h"
#include "helpers/bitmask.h"
for (cpu = bitmask_first(cpus_chosen);
cpu <= bitmask_last(cpus_chosen); cpu++) {
- if (!bitmask_isbitset(cpus_chosen, cpu) ||
- cpufreq_cpu_exists(cpu))
+ if (!bitmask_isbitset(cpus_chosen, cpu))
continue;
+ if (sysfs_is_cpu_online(cpu) != 1){
+ fprintf(stderr, _("Cannot set values on CPU %d:"), cpu);
+ fprintf(stderr, _(" *is offline\n"));
+ continue;
+ }
+
if (params.perf_bias) {
ret = msr_intel_set_perf_bias(cpu, perf_bias);
if (ret) {