Enable AOT linux perf support (#2930)
And refactor the original perf support - use WAMR_BUILD_LINUX_PERF as the cmake compilation control - use WASM_ENABLE_LINUX_PERF as the compiler macro - use `wamrc --enable-linux-perf` to generate aot file which contains fp operations - use `iwasm --enable-linux-perf` to create perf map for `perf record`
This commit is contained in:
@ -58,7 +58,6 @@ print_help()
|
||||
#if WASM_ENABLE_JIT != 0
|
||||
printf(" --llvm-jit-size-level=n Set LLVM JIT size level, default is 3\n");
|
||||
printf(" --llvm-jit-opt-level=n Set LLVM JIT optimization level, default is 3\n");
|
||||
printf(" --perf-profile Enable linux perf support. For now, it only works in llvm-jit.\n");
|
||||
#if defined(os_writegsbase)
|
||||
printf(" --enable-segue[=<flags>] Enable using segment register GS as the base address of\n");
|
||||
printf(" linear memory, which may improve performance, flags can be:\n");
|
||||
@ -67,6 +66,9 @@ print_help()
|
||||
printf(" Use comma to separate, e.g. --enable-segue=i32.load,i64.store\n");
|
||||
printf(" and --enable-segue means all flags are added.\n");
|
||||
#endif
|
||||
#endif /* WASM_ENABLE_JIT != 0*/
|
||||
#if WASM_ENABLE_LINUX_PERF != 0
|
||||
printf(" --enable-linux-perf Enable linux perf support. It works in aot and llvm-jit.\n");
|
||||
#endif
|
||||
printf(" --repl Start a very simple REPL (read-eval-print-loop) mode\n"
|
||||
" that runs commands in the form of \"FUNC ARG...\"\n");
|
||||
@ -561,7 +563,9 @@ main(int argc, char *argv[])
|
||||
uint32 llvm_jit_size_level = 3;
|
||||
uint32 llvm_jit_opt_level = 3;
|
||||
uint32 segue_flags = 0;
|
||||
bool enable_linux_perf_support = false;
|
||||
#endif
|
||||
#if WASM_ENABLE_LINUX_PERF != 0
|
||||
bool enable_linux_perf = false;
|
||||
#endif
|
||||
wasm_module_t wasm_module = NULL;
|
||||
wasm_module_inst_t wasm_module_inst = NULL;
|
||||
@ -702,9 +706,6 @@ main(int argc, char *argv[])
|
||||
if (segue_flags == (uint32)-1)
|
||||
return print_help();
|
||||
}
|
||||
else if (!strncmp(argv[0], "--perf-profile", 14)) {
|
||||
enable_linux_perf_support = true;
|
||||
}
|
||||
#endif /* end of WASM_ENABLE_JIT != 0 */
|
||||
#if BH_HAS_DLFCN
|
||||
else if (!strncmp(argv[0], "--native-lib=", 13)) {
|
||||
@ -718,6 +719,11 @@ main(int argc, char *argv[])
|
||||
native_lib_list[native_lib_count++] = argv[0] + 13;
|
||||
}
|
||||
#endif
|
||||
#if WASM_ENABLE_LINUX_PERF != 0
|
||||
else if (!strncmp(argv[0], "--enable-linux-perf", 19)) {
|
||||
enable_linux_perf = true;
|
||||
}
|
||||
#endif
|
||||
#if WASM_ENABLE_MULTI_MODULE != 0
|
||||
else if (!strncmp(argv[0],
|
||||
"--module-path=", strlen("--module-path="))) {
|
||||
@ -819,7 +825,9 @@ main(int argc, char *argv[])
|
||||
init_args.llvm_jit_size_level = llvm_jit_size_level;
|
||||
init_args.llvm_jit_opt_level = llvm_jit_opt_level;
|
||||
init_args.segue_flags = segue_flags;
|
||||
init_args.linux_perf_support = enable_linux_perf_support;
|
||||
#endif
|
||||
#if WASM_ENABLE_LINUX_PERF != 0
|
||||
init_args.enable_linux_perf = enable_linux_perf;
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
|
||||
Reference in New Issue
Block a user