简体   繁体   English

在 Firefox 中执行 WASM 时,什么是“调试陷阱处理”

[英]When executing WASM in Firefox, what is "debug trap handling"

I've compiled a large chunk of C++ code to WASM using enscriptem, and am trying to optimize its performance.我已经使用 enscriptem 将大量 C++ 代码编译到 WASM,并且正在尝试优化其性能。 Here is what my profiler is showing:这是我的分析器显示的内容:

总时间 总成本 自身时间 自身成本 采样函数 51,272.77 ms 94.46% 51,272.77 ms 94.46% 29273 调试陷阱处理(在 wasm 中) Gecko 4,434.89 ms 8.17% 0 ms 0%:: 0 em __ :: __ st d __ __2 basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char> >::__rep, 0, false>::__get() const qalc.wasm :3795283 localhost:8000 4,264.99 ms 7.86% 0 毫秒 0% 0 std::__2::__compressed_pa​​ir<std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char> >::__rep , std::__2::allocator<char> >::first() const qalc.wasm :3795198 localhost:8000 2,981.12 ms 5.49% 0 ms 0% 0 免费 qalc.wasm :3867464 localhost:8000

What does the "debug trap handling" section mean, and why is my code spending so much time in it? “调试陷阱处理”部分是什么意思,为什么我的代码在其中花费了这么多时间?

I think that means Firefox compiled the Wasm such that it is suitable for debugging, so you can step through the Wasm line by line, since the profiler is open.我认为这意味着 Firefox 编译了 Wasm 使其适合调试,因此您可以逐行逐步完成 Wasm,因为分析器是打开的。 This usually means that it is interpreted.这通常意味着它被解释。 (It does not have to do with the flags you use to compile you C++ project.) (它与用于编译 C++ 项目的标志无关。)

Not super sure if there's a way to profile from the command line, maybe you can try inserted calls to console.profile();不确定是否有办法从命令行进行分析,也许您可​​以尝试插入对console.profile();调用console.profile(); to surround parts of your C++ code that you care about.围绕您关心的 C++ 代码部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM