A simple python script to generate dot files for vizualization of call graph from function call traces with trace-cmd
command.
usage: tracecmd-mkdot [-h] [-d OUTPUTDIR]
[-c FUNCTION | -f FUNCTION | -t FUNCTION]
FILE
positional arguments:
FILE input file
optional arguments:
-h, --help show this help message and exit
-d OUTPUTDIR, --dir OUTPUTDIR
output directory
-c FUNCTION, --contain FUNCTION
select call paths conain the function
-f FUNCTION, --from FUNCTION
select call paths from the function
-t FUNCTION, --to FUNCTION
select call paths to the function
-
Record function call traces with
trace-cmd
command.# trace-cmd reset # trace-cmd record -p function dd if=/dev/zero of=testfile bs=30M count=1 # trace-cmd report -O ftrace:parent=1 > trace-cmd_report.out
-
Run
tracecmd-mkdot
command with-c scsi_request_fn
option. It select call paths containsscsi_request_fn
function, and generate.gv
files.# mkdir results # tracecmd-mkdot -d ./results -c scsi_request_fn ./trace-cmd_report.out
-
Run
dot
command for each.gv
file to generate image files draw the selected call paths.# for FILE in $(ls *callpaths_*.gv); do echo "Processing $FILE"; dot -Tsvg -O $FILE; done
-
View the saved
.svg
files.
There are some example images in examples
directory.