I have a node.js application running on a aws ubuntu instance. I was trying to generate flamegraphs using dtrace
and linux perf tools
but none of them seem working.
these are steps I am following :
linux perf tools: https://www.carlhopf.com/blog/2016/09/11/nodejs-cpu-profiling-production/
dtrace: https://nodejs.org/en/blog/uncategorized/profiling-node-js/
I have added the --prof / --perf_basic_prof_only_functions
while starting the app for linux perf tools commands.
The output I get from the dtrace stacks.out file is:
CPU ID FUNCTION:NAME
0 330511 :tick-60s
Installed dtrace
following this : https://askubuntu.com/questions/60940/how-do-i-install-dtrace
The output I get when I try to convert the output from linux perf commands to flamegraph is
ERROR: No stack counts found
I am not sure what's missing and why no stack trace was recorded.
node version: 8.4.0
ubuntu : 14.04
I do see there is Systemtap
option available and can use this command:
stap -s 32 -D MAXBACKTRACE=100 -D MAXSTRINGLEN=4096 -D MAXMAPENTRIES=10240 \
-D MAXACTION=10000 -D STP_OVERLOAD_THRESHOLD=5000000000 --all-modules \
-ve 'global s; probe timer.profile { s[backtrace()] <<< 1; }
probe end { foreach (i in s+) { print_stack(i);
printf("\t%d\n", @count(s[i])); } } probe timer.s(60) { exit(); }' \
> out.stap-stacks
but not sure how I can run that command using PID for the node app I am running. Is there any other way I can generate flame graphs in the ubuntu machine?