aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2015-01-13 08:19:12 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-01-16 15:49:29 -0500
commit25cd480e447eba47b8bdad1c9f95cadc074abc75 (patch)
tree36e2194788f9f907eaf7a7afeedf45ae3177d0e0 /tools/perf
parent260d819e3abdbdaa2b88fb983d1314f1b263f9e2 (diff)
tools: Remove bitops/hweight usage of bits in tools/perf
We need to use lib/hweight.c for that, just like we do for lib/rbtree.c, so tools need to link hweight.o. For now do it directly, but we need to have a tools/lib/lk.a or .so that collects these goodies... Reported-by: Jan Beulich <JBeulich@suse.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-a1e91dx3apzqw5kbdt7ut21s@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/MANIFEST6
-rw-r--r--tools/perf/Makefile.perf7
-rw-r--r--tools/perf/util/hweight.c31
-rw-r--r--tools/perf/util/include/asm/hweight.h8
-rw-r--r--tools/perf/util/python-ext-sources2
5 files changed, 13 insertions, 41 deletions
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index 83e2887f91a3..fbbfdc39271d 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -6,12 +6,15 @@ tools/lib/symbol/kallsyms.c
6tools/lib/symbol/kallsyms.h 6tools/lib/symbol/kallsyms.h
7tools/lib/util/find_next_bit.c 7tools/lib/util/find_next_bit.c
8tools/include/asm/bug.h 8tools/include/asm/bug.h
9tools/include/asm-generic/bitops/arch_hweight.h
9tools/include/asm-generic/bitops/atomic.h 10tools/include/asm-generic/bitops/atomic.h
11tools/include/asm-generic/bitops/const_hweight.h
10tools/include/asm-generic/bitops/__ffs.h 12tools/include/asm-generic/bitops/__ffs.h
11tools/include/asm-generic/bitops/__fls.h 13tools/include/asm-generic/bitops/__fls.h
12tools/include/asm-generic/bitops/find.h 14tools/include/asm-generic/bitops/find.h
13tools/include/asm-generic/bitops/fls64.h 15tools/include/asm-generic/bitops/fls64.h
14tools/include/asm-generic/bitops/fls.h 16tools/include/asm-generic/bitops/fls.h
17tools/include/asm-generic/bitops/hweight.h
15tools/include/asm-generic/bitops.h 18tools/include/asm-generic/bitops.h
16tools/include/linux/bitops.h 19tools/include/linux/bitops.h
17tools/include/linux/compiler.h 20tools/include/linux/compiler.h
@@ -19,6 +22,8 @@ tools/include/linux/export.h
19tools/include/linux/hash.h 22tools/include/linux/hash.h
20tools/include/linux/log2.h 23tools/include/linux/log2.h
21tools/include/linux/types.h 24tools/include/linux/types.h
25include/asm-generic/bitops/arch_hweight.h
26include/asm-generic/bitops/const_hweight.h
22include/asm-generic/bitops/fls64.h 27include/asm-generic/bitops/fls64.h
23include/asm-generic/bitops/__fls.h 28include/asm-generic/bitops/__fls.h
24include/asm-generic/bitops/fls.h 29include/asm-generic/bitops/fls.h
@@ -29,6 +34,7 @@ include/linux/list.h
29include/linux/hash.h 34include/linux/hash.h
30include/linux/stringify.h 35include/linux/stringify.h
31lib/find_next_bit.c 36lib/find_next_bit.c
37lib/hweight.c
32lib/rbtree.c 38lib/rbtree.c
33include/linux/swab.h 39include/linux/swab.h
34arch/*/include/asm/unistd*.h 40arch/*/include/asm/unistd*.h
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 1f71a32aea78..aa6a50447c32 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -232,12 +232,15 @@ LIB_H += ../include/linux/hash.h
232LIB_H += ../../include/linux/stringify.h 232LIB_H += ../../include/linux/stringify.h
233LIB_H += util/include/linux/bitmap.h 233LIB_H += util/include/linux/bitmap.h
234LIB_H += ../include/linux/bitops.h 234LIB_H += ../include/linux/bitops.h
235LIB_H += ../include/asm-generic/bitops/arch_hweight.h
235LIB_H += ../include/asm-generic/bitops/atomic.h 236LIB_H += ../include/asm-generic/bitops/atomic.h
237LIB_H += ../include/asm-generic/bitops/const_hweight.h
236LIB_H += ../include/asm-generic/bitops/find.h 238LIB_H += ../include/asm-generic/bitops/find.h
237LIB_H += ../include/asm-generic/bitops/fls64.h 239LIB_H += ../include/asm-generic/bitops/fls64.h
238LIB_H += ../include/asm-generic/bitops/fls.h 240LIB_H += ../include/asm-generic/bitops/fls.h
239LIB_H += ../include/asm-generic/bitops/__ffs.h 241LIB_H += ../include/asm-generic/bitops/__ffs.h
240LIB_H += ../include/asm-generic/bitops/__fls.h 242LIB_H += ../include/asm-generic/bitops/__fls.h
243LIB_H += ../include/asm-generic/bitops/hweight.h
241LIB_H += ../include/asm-generic/bitops.h 244LIB_H += ../include/asm-generic/bitops.h
242LIB_H += ../include/linux/compiler.h 245LIB_H += ../include/linux/compiler.h
243LIB_H += ../include/linux/log2.h 246LIB_H += ../include/linux/log2.h
@@ -255,7 +258,6 @@ LIB_H += util/include/linux/linkage.h
255LIB_H += util/include/asm/asm-offsets.h 258LIB_H += util/include/asm/asm-offsets.h
256LIB_H += ../include/asm/bug.h 259LIB_H += ../include/asm/bug.h
257LIB_H += util/include/asm/byteorder.h 260LIB_H += util/include/asm/byteorder.h
258LIB_H += util/include/asm/hweight.h
259LIB_H += util/include/asm/swab.h 261LIB_H += util/include/asm/swab.h
260LIB_H += util/include/asm/system.h 262LIB_H += util/include/asm/system.h
261LIB_H += util/include/asm/uaccess.h 263LIB_H += util/include/asm/uaccess.h
@@ -745,6 +747,9 @@ $(OUTPUT)util/kallsyms.o: ../lib/symbol/kallsyms.c $(OUTPUT)PERF-CFLAGS
745$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS 747$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
746 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< 748 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
747 749
750$(OUTPUT)util/hweight.o: ../../lib/hweight.c $(OUTPUT)PERF-CFLAGS
751 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
752
748$(OUTPUT)util/find_next_bit.o: ../lib/util/find_next_bit.c $(OUTPUT)PERF-CFLAGS 753$(OUTPUT)util/find_next_bit.o: ../lib/util/find_next_bit.c $(OUTPUT)PERF-CFLAGS
749 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< 754 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
750 755
diff --git a/tools/perf/util/hweight.c b/tools/perf/util/hweight.c
deleted file mode 100644
index 5c1d0d099f0d..000000000000
--- a/tools/perf/util/hweight.c
+++ /dev/null
@@ -1,31 +0,0 @@
1#include <linux/bitops.h>
2
3/**
4 * hweightN - returns the hamming weight of a N-bit word
5 * @x: the word to weigh
6 *
7 * The Hamming Weight of a number is the total number of bits set in it.
8 */
9
10unsigned int hweight32(unsigned int w)
11{
12 unsigned int res = w - ((w >> 1) & 0x55555555);
13 res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
14 res = (res + (res >> 4)) & 0x0F0F0F0F;
15 res = res + (res >> 8);
16 return (res + (res >> 16)) & 0x000000FF;
17}
18
19unsigned long hweight64(__u64 w)
20{
21#if BITS_PER_LONG == 32
22 return hweight32((unsigned int)(w >> 32)) + hweight32((unsigned int)w);
23#elif BITS_PER_LONG == 64
24 __u64 res = w - ((w >> 1) & 0x5555555555555555ul);
25 res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
26 res = (res + (res >> 4)) & 0x0F0F0F0F0F0F0F0Ful;
27 res = res + (res >> 8);
28 res = res + (res >> 16);
29 return (res + (res >> 32)) & 0x00000000000000FFul;
30#endif
31}
diff --git a/tools/perf/util/include/asm/hweight.h b/tools/perf/util/include/asm/hweight.h
deleted file mode 100644
index 36cf26d434a5..000000000000
--- a/tools/perf/util/include/asm/hweight.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef PERF_HWEIGHT_H
2#define PERF_HWEIGHT_H
3
4#include <linux/types.h>
5unsigned int hweight32(unsigned int w);
6unsigned long hweight64(__u64 w);
7
8#endif /* PERF_HWEIGHT_H */
diff --git a/tools/perf/util/python-ext-sources b/tools/perf/util/python-ext-sources
index 16a475a7d492..6c6a6953fa93 100644
--- a/tools/perf/util/python-ext-sources
+++ b/tools/perf/util/python-ext-sources
@@ -10,7 +10,7 @@ util/ctype.c
10util/evlist.c 10util/evlist.c
11util/evsel.c 11util/evsel.c
12util/cpumap.c 12util/cpumap.c
13util/hweight.c 13../../lib/hweight.c
14util/thread_map.c 14util/thread_map.c
15util/util.c 15util/util.c
16util/xyarray.c 16util/xyarray.c