Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Rename cpu_map__all() to cpu_map__empty()

The CPU map is in an "empty" (or not-applicable) state when monitoring
specific threads.

cpu_map__all() returns true if the CPU map is in this empty state (i.e
for the 'empty_cpu_map' or if we created the map via
cpu_map__dummy_new().

The name, cpu_map__all(), is misleading, because even when monitoring
all CPUs, (eg: perf record -a), cpu_map__all() returns false.

Rename cpu_map__all() to cpu_map__empty().

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20130523012620.GA27733@us.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Sukadev Bhattiprolu and committed by
Arnaldo Carvalho de Melo
ec1e7e43 67516844

+3 -3
+1 -1
tools/perf/util/cpumap.h
··· 41 41 return map ? map->nr : 1; 42 42 } 43 43 44 - static inline bool cpu_map__all(const struct cpu_map *map) 44 + static inline bool cpu_map__empty(const struct cpu_map *map) 45 45 { 46 46 return map ? map->map[0] == -1 : true; 47 47 }
+2 -2
tools/perf/util/evlist.c
··· 421 421 static int perf_evlist__alloc_mmap(struct perf_evlist *evlist) 422 422 { 423 423 evlist->nr_mmaps = cpu_map__nr(evlist->cpus); 424 - if (cpu_map__all(evlist->cpus)) 424 + if (cpu_map__empty(evlist->cpus)) 425 425 evlist->nr_mmaps = thread_map__nr(evlist->threads); 426 426 evlist->mmap = zalloc(evlist->nr_mmaps * sizeof(struct perf_mmap)); 427 427 return evlist->mmap != NULL ? 0 : -ENOMEM; ··· 573 573 return -ENOMEM; 574 574 } 575 575 576 - if (cpu_map__all(cpus)) 576 + if (cpu_map__empty(cpus)) 577 577 return perf_evlist__mmap_per_thread(evlist, prot, mask); 578 578 579 579 return perf_evlist__mmap_per_cpu(evlist, prot, mask);