2 but casuse err when i run offcputime as follow, thank you very much
root@a64265ff4f00:/usr/share/bcc/tools# ./offcputime
In file included from :2:
In file included from /virtual/include/bcc/bpf.h:12:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:14:
In file included from ./include/uapi/linux/posix_types.h:5:
In file included from include/linux/stddef.h:5:
In file included from include/uapi/linux/stddef.h:5:
In file included from include/linux/compiler_types.h:80:
include/linux/compiler-clang.h:41:9: warning: 'HAVE_BUILTIN_BSWAP32' macro redefined [-Wmacro-redefined]
define HAVE_BUILTIN_BSWAP32
^
:4:9: note: previous definition is here
define HAVE_BUILTIN_BSWAP32 1
^
In file included from :2:
In file included from /virtual/include/bcc/bpf.h:12:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:14:
In file included from ./include/uapi/linux/posix_types.h:5:
In file included from include/linux/stddef.h:5:
In file included from include/uapi/linux/stddef.h:5:
In file included from include/linux/compiler_types.h:80:
include/linux/compiler-clang.h:42:9: warning: 'HAVE_BUILTIN_BSWAP64' macro redefined [-Wmacro-redefined]
define HAVE_BUILTIN_BSWAP64
^
:5:9: note: previous definition is here
define HAVE_BUILTIN_BSWAP64 1
^
In file included from :2:
In file included from /virtual/include/bcc/bpf.h:12:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:14:
In file included from ./include/uapi/linux/posix_types.h:5:
In file included from include/linux/stddef.h:5:
In file included from include/uapi/linux/stddef.h:5:
In file included from include/linux/compiler_types.h:80:
include/linux/compiler-clang.h:43:9: warning: 'HAVE_BUILTIN_BSWAP16' macro redefined [-Wmacro-redefined]
define HAVE_BUILTIN_BSWAP16
^
:3:9: note: previous definition is here
define HAVE_BUILTIN_BSWAP16 1
^
In file included from /virtual/main.c:2:
In file included from include/uapi/linux/ptrace.h:153:
In file included from ./arch/x86/include/asm/ptrace.h:5:
./arch/x86/include/asm/segment.h:255:2: error: expected '(' after 'asm'
alternative_io ("lsl %[seg],%[p]",
^
./arch/x86/include/asm/alternative.h:248:2: note: expanded from macro 'alternative_io'
asm_inline volatile (ALTERNATIVE(oldinstr, newinstr, feature) \
^
include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
^
In file included from /virtual/main.c:3:
In file included from include/linux/sched.h:14:
In file included from include/linux/pid.h:5:
In file included from include/linux/rculist.h:11:
In file included from include/linux/rcupdate.h:27:
In file included from include/linux/preempt.h:78:
In file included from ./arch/x86/include/asm/preempt.h:7:
In file included from include/linux/thread_info.h:60:
In file included from ./arch/x86/include/asm/thread_info.h:12:
In file included from ./arch/x86/include/asm/page.h:12:
./arch/x86/include/asm/page_64.h:49:2: error: expected '(' after 'asm'
alternative_call_2(clear_page_orig,
^
./arch/x86/include/asm/alternative.h:264:2: note: expanded from macro 'alternative_call_2'
asm_inline volatile (ALTERNATIVE_2("call %P[old]", "call %P[new1]", feature1,\
^
include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
^
In file included from /virtual/main.c:3:
In file included from include/linux/sched.h:14:
In file included from include/linux/pid.h:5:
In file included from include/linux/rculist.h:11:
In file included from include/linux/rcupdate.h:27:
In file included from include/linux/preempt.h:78:
In file included from ./arch/x86/include/asm/preempt.h:7:
In file included from include/linux/thread_info.h:60:
In file included from ./arch/x86/include/asm/thread_info.h:53:
In file included from ./arch/x86/include/asm/cpufeature.h:5:
In file included from ./arch/x86/include/asm/processor.h:25:
./arch/x86/include/asm/special_insns.h:205:2: error: expected '(' after 'asm'
alternative_io(".byte 0x3e; clflush %P0",
^
./arch/x86/include/asm/alternative.h:248:2: note: expanded from macro 'alternative_io'
asm_inline volatile (ALTERNATIVE(oldinstr, newinstr, feature) \
^
include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
^
In file included from /virtual/main.c:3:
In file included from include/linux/sched.h:14:
In file included from include/linux/pid.h:5:
In file included from include/linux/rculist.h:11:
In file included from include/linux/rcupdate.h:27:
In file included from include/linux/preempt.h:78:
In file included from ./arch/x86/include/asm/preempt.h:7:
In file included from include/linux/thread_info.h:60:
In file included from ./arch/x86/include/asm/thread_info.h:53:
In file included from ./arch/x86/include/asm/cpufeature.h:5:
./arch/x86/include/asm/processor.h:731:2: error: expected '(' after 'asm'
alternative_input(BASE_PREFETCH, "prefetchnta %P1",
^
./arch/x86/include/asm/alternative.h:229:2: note: expanded from macro 'alternative_input'
asm_inline volatile (ALTERNATIVE(oldinstr, newinstr, feature) \
^
include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
^
In file included from /virtual/main.c:3:
In file included from include/linux/sched.h:14:
In file included from include/linux/pid.h:5:
In file included from include/linux/rculist.h:11:
In file included from include/linux/rcupdate.h:27:
In file included from include/linux/preempt.h:78:
In file included from ./arch/x86/include/asm/preempt.h:7:
In file included from include/linux/thread_info.h:60:
In file included from ./arch/x86/include/asm/thread_info.h:53:
In file included from ./arch/x86/include/asm/cpufeature.h:5:
./arch/x86/include/asm/processor.h:743:2: error: expected '(' after 'asm'
alternative_input(BASE_PREFETCH, "prefetchw %P1",
^
./arch/x86/include/asm/alternative.h:229:2: note: expanded from macro 'alternative_input'
asm_inline volatile (ALTERNATIVE(oldinstr, newinstr, feature) \
^
include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
^
In file included from /virtual/main.c:3:
In file included from include/linux/sched.h:14:
In file included from include/linux/pid.h:5:
In file included from include/linux/rculist.h:11:
In file included from include/linux/rcupdate.h:27:
In file included from include/linux/preempt.h:78:
In file included from ./arch/x86/include/asm/preempt.h:7:
include/linux/thread_info.h:200:2: error: expected '(' after 'asm'
WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count);
^
include/asm-generic/bug.h:132:3: note: expanded from macro 'WARN'
WARN_printf(TAINT_WARN, format); \
^
include/asm-generic/bug.h:100:3: note: expanded from macro 'WARN_printf'
__WARN_FLAGS(BUGFLAG_NO_CUT_HERE | BUGFLAG_TAINT(taint));\
^
./arch/x86/include/asm/bug.h:82:2: note: expanded from macro 'WARN_FLAGS'
_BUG_FLAGS(ASM_UD2, flags, ASM_REACHABLE); \
^
./arch/x86/include/asm/bug.h:27:2: note: expanded from macro '_BUG_FLAGS'
asm_inline volatile("1:\t" ins "\n" \
^
include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
^
In file included from /virtual/main.c:3:
In file included from include/linux/sched.h:14:
In file included from include/linux/pid.h:5:
In file included from include/linux/rculist.h:11:
In file included from include/linux/rcupdate.h:27:
In file included from include/linux/preempt.h:78:
In file included from ./arch/x86/include/asm/preempt.h:7:
include/linux/thread_info.h:216:6: error: expected '(' after 'asm'
if (WARN_ON_ONCE(bytes > INT_MAX))
^
include/asm-generic/bug.h:106:3: note: expanded from macro 'WARN_ON_ONCE'
WARN_FLAGS(BUGFLAG_ONCE | \
^
./arch/x86/include/asm/bug.h:82:2: note: expanded from macro 'WARN_FLAGS'
_BUG_FLAGS(ASM_UD2, __flags, ASM_REACHABLE); \
^
./arch/x86/include/asm/bug.h:27:2: note: expanded from macro '_BUG_FLAGS'
asm_inline volatile("1:\t" ins "\n" \
^
include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
^
In file included from /virtual/main.c:3:
In file included from include/linux/sched.h:14:
In file included from include/linux/pid.h:5:
In file included from include/linux/rculist.h:11:
include/linux/rcupdate.h:1000:2: error: expected '(' after 'asm'
WARN_ON_ONCE(func != (rcu_callback_t)~0L);
^
include/asm-generic/bug.h:106:3: note: expanded from macro 'WARN_ON_ONCE'
WARN_FLAGS(BUGFLAG_ONCE | \
^
./arch/x86/include/asm/bug.h:82:2: note: expanded from macro 'WARN_FLAGS'
_BUG_FLAGS(ASM_UD2, __flags, ASM_REACHABLE); \
^
./arch/x86/include/asm/bug.h:27:2: note: expanded from macro '_BUG_FLAGS'
asm_inline volatile("1:\t" ins "\n" \
^
include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
^
In file included from /virtual/main.c:3:
In file included from include/linux/sched.h:15:
In file included from include/linux/sem.h:5:
In file included from include/uapi/linux/sem.h:5:
In file included from include/linux/ipc.h:7:
In file included from include/linux/rhashtable-types.h:15:
In file included from include/linux/workqueue.h:9:
In file included from include/linux/timer.h:6:
include/linux/ktime.h:154:2: error: expected '(' after 'asm'
WARN_ON(div < 0);
^
include/asm-generic/bug.h:123:3: note: expanded from macro 'WARN_ON'
WARN(); \
^
include/asm-generic/bug.h:96:19: note: expanded from macro 'WARN'
./arch/x86/include/asm/bug.h:82:2: note: expanded from macro 'WARN_FLAGS'
_BUG_FLAGS(ASM_UD2, flags, ASM_REACHABLE); \
^
./arch/x86/include/asm/bug.h:27:2: note: expanded from macro '_BUG_FLAGS'
asm_inline volatile("1:\t" ins "\n" \
^
include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
^
3 warnings and 9 errors generated.
Traceback (most recent call last):
File "./offcputime", line 235, in
b = BPF(text=bpf_text)
File "/usr/lib/python2.7/dist-packages/bcc/init.py", line 325, in init
raise Exception("Failed to compile BPF text")
Exception: Failed to compile BPF text
1 docker run -it --rm \ --privileged \ -v /lib/modules:/lib/modules:ro \ -v /usr/src:/usr/src:ro \ -v /etc/localtime:/etc/localtime:ro \ --workdir /usr/share/bcc/tools \ zlim/bcc
2 but casuse err when i run offcputime as follow, thank you very much root@a64265ff4f00:/usr/share/bcc/tools# ./offcputime In file included from:2:
In file included from /virtual/include/bcc/bpf.h:12:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:14:
In file included from ./include/uapi/linux/posix_types.h:5:
In file included from include/linux/stddef.h:5:
In file included from include/uapi/linux/stddef.h:5:
In file included from include/linux/compiler_types.h:80:
include/linux/compiler-clang.h:41:9: warning: 'HAVE_BUILTIN_BSWAP32' macro redefined [-Wmacro-redefined]
define HAVE_BUILTIN_BSWAP32
define HAVE_BUILTIN_BSWAP32 1
In file included from:2:
In file included from /virtual/include/bcc/bpf.h:12:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:14:
In file included from ./include/uapi/linux/posix_types.h:5:
In file included from include/linux/stddef.h:5:
In file included from include/uapi/linux/stddef.h:5:
In file included from include/linux/compiler_types.h:80:
include/linux/compiler-clang.h:42:9: warning: 'HAVE_BUILTIN_BSWAP64' macro redefined [-Wmacro-redefined]
define HAVE_BUILTIN_BSWAP64
define HAVE_BUILTIN_BSWAP64 1
In file included from:2:
In file included from /virtual/include/bcc/bpf.h:12:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:14:
In file included from ./include/uapi/linux/posix_types.h:5:
In file included from include/linux/stddef.h:5:
In file included from include/uapi/linux/stddef.h:5:
In file included from include/linux/compiler_types.h:80:
include/linux/compiler-clang.h:43:9: warning: 'HAVE_BUILTIN_BSWAP16' macro redefined [-Wmacro-redefined]
define HAVE_BUILTIN_BSWAP16
define HAVE_BUILTIN_BSWAP16 1
In file included from /virtual/main.c:2: In file included from include/uapi/linux/ptrace.h:153: In file included from ./arch/x86/include/asm/ptrace.h:5: ./arch/x86/include/asm/segment.h:255:2: error: expected '(' after 'asm' alternative_io ("lsl %[seg],%[p]", ^ ./arch/x86/include/asm/alternative.h:248:2: note: expanded from macro 'alternative_io' asm_inline volatile (ALTERNATIVE(oldinstr, newinstr, feature) \ ^ include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
In file included from /virtual/main.c:3: In file included from include/linux/sched.h:14: In file included from include/linux/pid.h:5: In file included from include/linux/rculist.h:11: In file included from include/linux/rcupdate.h:27: In file included from include/linux/preempt.h:78: In file included from ./arch/x86/include/asm/preempt.h:7: In file included from include/linux/thread_info.h:60: In file included from ./arch/x86/include/asm/thread_info.h:12: In file included from ./arch/x86/include/asm/page.h:12: ./arch/x86/include/asm/page_64.h:49:2: error: expected '(' after 'asm' alternative_call_2(clear_page_orig, ^ ./arch/x86/include/asm/alternative.h:264:2: note: expanded from macro 'alternative_call_2' asm_inline volatile (ALTERNATIVE_2("call %P[old]", "call %P[new1]", feature1,\ ^ include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
In file included from /virtual/main.c:3: In file included from include/linux/sched.h:14: In file included from include/linux/pid.h:5: In file included from include/linux/rculist.h:11: In file included from include/linux/rcupdate.h:27: In file included from include/linux/preempt.h:78: In file included from ./arch/x86/include/asm/preempt.h:7: In file included from include/linux/thread_info.h:60: In file included from ./arch/x86/include/asm/thread_info.h:53: In file included from ./arch/x86/include/asm/cpufeature.h:5: In file included from ./arch/x86/include/asm/processor.h:25: ./arch/x86/include/asm/special_insns.h:205:2: error: expected '(' after 'asm' alternative_io(".byte 0x3e; clflush %P0", ^ ./arch/x86/include/asm/alternative.h:248:2: note: expanded from macro 'alternative_io' asm_inline volatile (ALTERNATIVE(oldinstr, newinstr, feature) \ ^ include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
In file included from /virtual/main.c:3: In file included from include/linux/sched.h:14: In file included from include/linux/pid.h:5: In file included from include/linux/rculist.h:11: In file included from include/linux/rcupdate.h:27: In file included from include/linux/preempt.h:78: In file included from ./arch/x86/include/asm/preempt.h:7: In file included from include/linux/thread_info.h:60: In file included from ./arch/x86/include/asm/thread_info.h:53: In file included from ./arch/x86/include/asm/cpufeature.h:5: ./arch/x86/include/asm/processor.h:731:2: error: expected '(' after 'asm' alternative_input(BASE_PREFETCH, "prefetchnta %P1", ^ ./arch/x86/include/asm/alternative.h:229:2: note: expanded from macro 'alternative_input' asm_inline volatile (ALTERNATIVE(oldinstr, newinstr, feature) \ ^ include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
In file included from /virtual/main.c:3: In file included from include/linux/sched.h:14: In file included from include/linux/pid.h:5: In file included from include/linux/rculist.h:11: In file included from include/linux/rcupdate.h:27: In file included from include/linux/preempt.h:78: In file included from ./arch/x86/include/asm/preempt.h:7: In file included from include/linux/thread_info.h:60: In file included from ./arch/x86/include/asm/thread_info.h:53: In file included from ./arch/x86/include/asm/cpufeature.h:5: ./arch/x86/include/asm/processor.h:743:2: error: expected '(' after 'asm' alternative_input(BASE_PREFETCH, "prefetchw %P1", ^ ./arch/x86/include/asm/alternative.h:229:2: note: expanded from macro 'alternative_input' asm_inline volatile (ALTERNATIVE(oldinstr, newinstr, feature) \ ^ include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
In file included from /virtual/main.c:3: In file included from include/linux/sched.h:14: In file included from include/linux/pid.h:5: In file included from include/linux/rculist.h:11: In file included from include/linux/rcupdate.h:27: In file included from include/linux/preempt.h:78: In file included from ./arch/x86/include/asm/preempt.h:7: include/linux/thread_info.h:200:2: error: expected '(' after 'asm' WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count); ^ include/asm-generic/bug.h:132:3: note: expanded from macro 'WARN' WARN_printf(TAINT_WARN, format); \ ^ include/asm-generic/bug.h:100:3: note: expanded from macro 'WARN_printf' __WARN_FLAGS(BUGFLAG_NO_CUT_HERE | BUGFLAG_TAINT(taint));\ ^ ./arch/x86/include/asm/bug.h:82:2: note: expanded from macro 'WARN_FLAGS' _BUG_FLAGS(ASM_UD2, flags, ASM_REACHABLE); \ ^ ./arch/x86/include/asm/bug.h:27:2: note: expanded from macro '_BUG_FLAGS' asm_inline volatile("1:\t" ins "\n" \ ^ include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
In file included from /virtual/main.c:3: In file included from include/linux/sched.h:14: In file included from include/linux/pid.h:5: In file included from include/linux/rculist.h:11: In file included from include/linux/rcupdate.h:27: In file included from include/linux/preempt.h:78: In file included from ./arch/x86/include/asm/preempt.h:7: include/linux/thread_info.h:216:6: error: expected '(' after 'asm' if (WARN_ON_ONCE(bytes > INT_MAX)) ^ include/asm-generic/bug.h:106:3: note: expanded from macro 'WARN_ON_ONCE' WARN_FLAGS(BUGFLAG_ONCE | \ ^ ./arch/x86/include/asm/bug.h:82:2: note: expanded from macro 'WARN_FLAGS' _BUG_FLAGS(ASM_UD2, __flags, ASM_REACHABLE); \ ^ ./arch/x86/include/asm/bug.h:27:2: note: expanded from macro '_BUG_FLAGS' asm_inline volatile("1:\t" ins "\n" \ ^ include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
In file included from /virtual/main.c:3: In file included from include/linux/sched.h:14: In file included from include/linux/pid.h:5: In file included from include/linux/rculist.h:11: include/linux/rcupdate.h:1000:2: error: expected '(' after 'asm' WARN_ON_ONCE(func != (rcu_callback_t)~0L); ^ include/asm-generic/bug.h:106:3: note: expanded from macro 'WARN_ON_ONCE' WARN_FLAGS(BUGFLAG_ONCE | \ ^ ./arch/x86/include/asm/bug.h:82:2: note: expanded from macro 'WARN_FLAGS' _BUG_FLAGS(ASM_UD2, __flags, ASM_REACHABLE); \ ^ ./arch/x86/include/asm/bug.h:27:2: note: expanded from macro '_BUG_FLAGS' asm_inline volatile("1:\t" ins "\n" \ ^ include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
In file included from /virtual/main.c:3: In file included from include/linux/sched.h:15: In file included from include/linux/sem.h:5: In file included from include/uapi/linux/sem.h:5: In file included from include/linux/ipc.h:7: In file included from include/linux/rhashtable-types.h:15: In file included from include/linux/workqueue.h:9: In file included from include/linux/timer.h:6: include/linux/ktime.h:154:2: error: expected '(' after 'asm' WARN_ON(div < 0); ^ include/asm-generic/bug.h:123:3: note: expanded from macro 'WARN_ON' WARN(); \ ^ include/asm-generic/bug.h:96:19: note: expanded from macro 'WARN'
define WARN() WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN))
./arch/x86/include/asm/bug.h:82:2: note: expanded from macro 'WARN_FLAGS' _BUG_FLAGS(ASM_UD2, flags, ASM_REACHABLE); \ ^ ./arch/x86/include/asm/bug.h:27:2: note: expanded from macro '_BUG_FLAGS' asm_inline volatile("1:\t" ins "\n" \ ^ include/linux/compiler_types.h:270:24: note: expanded from macro 'asm_inline'
define asm_inline asm __inline
3 warnings and 9 errors generated. Traceback (most recent call last): File "./offcputime", line 235, in
b = BPF(text=bpf_text)
File "/usr/lib/python2.7/dist-packages/bcc/init.py", line 325, in init
raise Exception("Failed to compile BPF text")
Exception: Failed to compile BPF text