It gives me:

make rtop
cc  -g -Wall -Werror -Wextra -Wno-unused-parameter -I. -I/home/.../libpfm4/perf_examples/../include -DCONFIG_PFMLIB_DEBUG -DCONFIG_PFMLIB_OS_LINUX -I. -D_GNU_SOURCE -pthread -c rtop.c
rtop.c: In function ‘populate_cpumask’:
rtop.c:403:14: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
rtop.c:437:18: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
cc1: all warnings being treated as errors

make: *** [rtop.o] Error 1


The patch below makes it compile, but could break some logic in the code, since it is using singed integers. The function populate_cpumask has some flaws, since it assumes that online CPUs are contiguous. Additionally the argument
"--cpu-list=" is misleading. Instead of giving a list of independent CPU numbers it requires a start CPU and end CPU.

Rtop is also not in default target in the makefile, so it's not compiled.


diff --git a/perf_examples/rtop.c b/perf_examples/rtop.c
index e46afe9..865c873 100644
--- a/perf_examples/rtop.c
+++ b/perf_examples/rtop.c
@@ -389,8 +389,8 @@ void
 populate_cpumask(char *cpu_list)
 {
        char *p;
-       unsigned long start_cpu, end_cpu = 0;
-       unsigned long i, count = 0;
+       long start_cpu, end_cpu = 0;
+       long i, count = 0;
 
        options.online_cpus = sysconf(_SC_NPROCESSORS_ONLN);
        if (options.online_cpus == -1)
@@ -412,7 +412,7 @@ populate_cpumask(char *cpu_list)
                p = NULL;
                start_cpu = strtoul(cpu_list, &p, 0); /* auto-detect base */
 
-               if (start_cpu == ULONG_MAX || (*p != '\0' && *p != ',' && *p != '-'))
+               if (start_cpu == LONG_MAX || (*p != '\0' && *p != ',' && *p != '-'))
                        goto invalid;
 
                if (p && *p == '-') {
@@ -421,7 +421,7 @@ populate_cpumask(char *cpu_list)
 
                        end_cpu = strtoul(cpu_list, &p, 0); /* auto-detect base */
 
-                       if (end_cpu == ULONG_MAX || (*p != '\0' && *p != ','))
+                       if (end_cpu == LONG_MAX || (*p != '\0' && *p != ','))
                                goto invalid;
                        if (end_cpu < start_cpu)
                                goto invalid_range;