flamegraph: force flamegraph-report script to run in live mode when using 'perf script flamegraph'
PATCH 1/1 flamegraph: force flamegraph-report script to run in live mode when using 'perf script flamegraph'
Currently, running "perf script flamegraph -a -F 99 sleep 1" should produce flamegraph.html containing the flamegraph. Howevever, it gives a segmentation fault.
This is caused because the flamegraph.py script is
supposed to take as input the output of "perf record", which should be in stdin. This would require passing "-i -" to flamegraph.py. However, the "flamegraph-report" script causes "perf script" command to take the "-i -" option instead of flamegraph.py, which causes no problem for "perf script", but causes a seg fault since flamegraph.py has no input file. To fix this I added the "-i -" option directly to the flamegraph-report script to ensure flamegraph.py gets input from stdin.
--- tools/perf/scripts/python/bin/flamegraph-report | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/scripts/python/bin/flamegraph-report +1 -1
@@ -1,3 +1,3 @@ #!/bin/bash # description: create flame graphs -perf script -s "$PERF_EXEC_PATH"/scripts/python/flamegraph.py -- "$@" +perf script -s "$PERF_EXEC_PATH"/scripts/python/flamegraph.py -i - -- "$@"
Signature · 1 line
2.48.1
Quoted 13 lines · Anubhav Shelat
Currently, running "perf script flamegraph -a -F 99 sleep 1" should produce flamegraph.html containing the flamegraph. Howevever, it gives a segmentation fault.
This is caused because the
flamegraph.pyscript is
supposed to take as input the output of "perf record", which should be in stdin. This would require passing "-i -" toflamegraph.py. However, the "flamegraph-report" script causes "perf script" command to take the "-i -" option instead offlamegraph.py, which causes no problem for "perf script", but causes a seg fault sinceflamegraph.pyhas no input file. To fix this I added the "-i -" option directly to the flamegraph-report script to ensureflamegraph.pygets input from stdin.
Quoted 1 line
Signed-off-by Anubhav Shelat <[email protected]>
I'd suggest adjusting the title slightly, e.g.:
"perf script flamegraph: Force stdin in live mode"
Otherwise, thanks for the fix.
Quoted 17 lines
--- tools/perf/scripts/python/bin/flamegraph-report | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/scripts/python/bin/flamegraph-report +1
-1@@ -1,3 +1,3 @@ #!/bin/bash # description: create flame graphs -perf script -s "$PERF_EXEC_PATH"/scripts/python/flamegraph.py -- "$@" +perf script -s "$PERF_EXEC_PATH"/scripts/python/flamegraph.py -i - -- "$@"Signature · 1 line
2.48.1