Add this to erlang.mk
:
define ERLANG_BUILD_GPROF
$(TARGET_MAKE_ENV) $(ERLANG_CONF_ENV) TARGET='riscv64-buildroot-linux-gnu' $(MAKE) -C $(@D)/erts/emulator gprof
endef
ERLANG_POST_BUILD_HOOKS += ERLANG_BUILD_GPROF
This makes beam.gprof.smp
. Copy it to staging
:
cp build/erlang-25.2.2/bin/riscv64-buildroot-linux-gnu/beam.gprof.smp staging/usr/lib/erlang/erts-13.1.4/bin/beam.smp
Add the following to erlinit.config
:
-e GMON_OUT_PREFIX=/root/gmon
Run. You should get a gmon.<pid>
file written to /root
.
Copy the file back:
gprof staging/usr/lib/erlang/erts-13.1.4/bin/beam.smp gmon.54 >analysis.txt