Unable to profile wasm build on Chrome

47 views
Skip to first unread message

Amit Gupta

unread,
Apr 2, 2020, 6:59:29 AM4/2/20
to emscripten-discuss
I am trying to profile my wasm build on Chrome using JavaScript Profiler. The code itself is working fine. When I record a snapshot of page load and analyse it, all the function names are coming to be <wasm-unnamed>. This is happening 90% of times. 1-2 times, it worked fine. This is causing ambiguous behaviour. I am using 1.38.28 version of emsdk and Chrome version is Version 80.0.3987.162 (Official Build) (64-bit). Can someone suggest what is happening here? Same issue is happening on Chrome Canary and latest Edge browser too.
Screenshot 2020-04-01 at 6.15.55 PM.png

Shachar Langbeheim

unread,
Apr 2, 2020, 7:17:24 AM4/2/20
to emscripten-discuss
are you compiling and linking with -g --profiling? That should keep the symbols.

On Thu, 2 Apr 2020 at 13:59, Amit Gupta <amitgu...@gmail.com> wrote:
I am trying to profile my wasm build on Chrome using JavaScript Profiler. The code itself is working fine. When I record a snapshot of page load and analyse it, all the function names are coming to be <wasm-unnamed>. This is happening 90% of times. 1-2 times, it worked fine. This is causing ambiguous behaviour. I am using 1.38.28 version of emsdk and Chrome version is Version 80.0.3987.162 (Official Build) (64-bit). Can someone suggest what is happening here? Same issue is happening on Chrome Canary and latest Edge browser too.

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/7c6e57c1-e79f-475c-842c-f0c16599cac6%40googlegroups.com.

Alon Zakai

unread,
Apr 2, 2020, 9:49:26 AM4/2/20
to emscripte...@googlegroups.com
Correct, but note that --profiling is enough, as -g also emits DWARF debug info, which can do a lot more (but increases build size and may inhibit some optimizations).


Amit Gupta

unread,
Apr 3, 2020, 2:40:27 AM4/3/20
to emscripten-discuss
Yes, I am using --profiling --profiling-funcs flags.

Alon Zakai

unread,
Apr 3, 2020, 8:47:01 AM4/3/20
to emscripte...@googlegroups.com
That's very strange. Is it possible an older build is loaded by the profiler (maybe it's in the cache?). Try building to a new name and profiling that maybe.

To see exactly what's going on, you can run wasm-dis or wasm2wat to disassemble the wasm file, and see if functions have names there. For example, here is what things look like on a hello world program without and with --profiling:

-  (import "wasi_snapshot_preview1" "fd_write" (func $fimport$0 (param i32 i32 i32 i32) (result i32)))
+  (import "wasi_snapshot_preview1" "fd_write" (func $__wasi_fd_write (param i32 i32 i32 i32) (result i32)))

- (export "__wasm_call_ctors" (func $1))
+ (export "__wasm_call_ctors" (func $__wasm_call_ctors))

- (func $1 (; 6 ;)
+ (func $__wasm_call_ctors (; 6 ;)

-    (call $fimport$3)
+    (call $__handle_stack_overflow)

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.

Amit Gupta

unread,
Apr 6, 2020, 5:12:43 AM4/6/20
to emscripten-discuss
I don't think the profiler is loading an old build since I hard reloaded the browser and also disabled catching in Network tab in devtools. I can give wasm-dis or wasm2wat  a try.


On Thursday, 2 April 2020 16:29:29 UTC+5:30, Amit Gupta wrote:
Reply all
Reply to author
Forward
0 new messages