Using perf:
$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg
NOTE: See @GabrielMajeri's comments below about the
-goption.
| // C++ bit . save it in an example.cpp file | |
| #include "emscripten.h" | |
| extern "C" { | |
| inline const char* cstr(const std::string& message) { | |
| char * cstr = new char [message.length()+1]; | |
| std::strcpy (cstr, message.c_str()); | |
| return cstr; | |
| } | |
| EMSCRIPTEN_KEEPALIVE | |
| const char* getAMessage() { |
Using perf:
$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg
NOTE: See @GabrielMajeri's comments below about the
-goption.