perf llvm: Pass number of configured CPUs to clang compiler
commit59f41af980f95cbd556a6dc2e064b412abc439cf
authorWang Nan <wangnan0@huawei.com>
Wed, 4 Nov 2015 11:20:04 +0000 (4 11:20 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 5 Nov 2015 15:47:02 +0000 (5 12:47 -0300)
tree275d7385bf1a1e5d0ca91aa4e2295568aeff5874
parent98916392a0bdfd71668b711fd93915791f45df02
perf llvm: Pass number of configured CPUs to clang compiler

This patch introduces a new macro "__NR_CPUS__" to perf's embedded clang
compiler, which represent the number of configured CPUs in this system.
BPF programs can use this macro to create a map with the same number of
system CPUs. For example:

 struct bpf_map_def SEC("maps") pmu_map = {
     .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
     .key_size = sizeof(int),
     .value_size = sizeof(u32),
     .max_entries = __NR_CPUS__,
 };

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1446636007-239722-2-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/llvm-utils.c