24.10.4.1. gem5 config.dot
The m5out/config.dot
file contains a graphviz .dot
file that provides a simplified graphical view of a subset of the gem5 config.ini.
This file gets automatically converted to .svg
and .pdf
, which you can view after running gem5 with:
xdg-open "$(./getvar --arch arm --emulator gem5 m5out_dir)/config.dot.pdf" xdg-open "$(./getvar --arch arm --emulator gem5 m5out_dir)/config.dot.svg"
An example of such file can be seen at: config.dot.svg
for a TimingSimpleCPU without caches..
On Ubuntu 20.04, you can also see the dot file "directly" with xdot:
xdot "$(./getvar --arch arm --emulator gem5 m5out_dir)/config.dot"
which is kind of really cool because it allows you to view graph arrows on hover. This can be very useful because the PDF and SVG often overlap so many arrows together that you just can’t know which one is coming from/going to where.
It is worth noting that if you are running a bunch of short simulations, dot/SVG/PDF generation could have a significant impact in simulation startup time, so it is something to watch out for. As per https://gem5-review.googlesource.com/c/public/gem5/+/29232 it can be turned off with:
gem5.opt --dot-config=''
or in LKMC:
./run --gem5-exe-args='--dot-config= --json-config= --dump-config='
The time difference can be readily observed on minimal examples by running gem5 with time
.
By looking into gem5 872cb227fdc0b4d60acc7840889d567a6936b6e1 src/python/m5/util/dot_writer.py
are can try to remove the SVG/PDF conversion to see if those dominate the runtime:
def do_dot(root, outdir, dotFilename): if not pydot: warn("No dot file generated. " + "Please install pydot to generate the dot file and pdf.") return # * use ranksep > 1.0 for for vertical separation between nodes # especially useful if you need to annotate edges using e.g. visio # which accepts svg format # * no need for hoizontal separation as nothing moves horizonally callgraph = pydot.Dot(graph_type='digraph', ranksep='1.3') dot_create_nodes(root, callgraph) dot_create_edges(root, callgraph) dot_filename = os.path.join(outdir, dotFilename) callgraph.write(dot_filename) try: # dot crashes if the figure is extremely wide. # So avoid terminating simulation unnecessarily callgraph.write_svg(dot_filename + ".svg") callgraph.write_pdf(dot_filename + ".pdf") except: warn("failed to generate dot output from %s", dot_filename)
but nope, they don’t, dot_create_nodes
and dot_create_edges
are the culprits, so the only way to gain speed is to remove .dot
generation altogether. It is tempting to do this by default on LKMC and add an option to enable dot generation when desired so we can be a bit faster by default… but I’m lazy to document the option right now. When it annoys me further maybe :-)