Flametrace can generate per-core thread and function exectution flamegraph SVGs,
an SVG thread activity diagram, and runtime statistics from a gem5 Trace.txt
file.
Tested on Python 3.10.6
. To install all dependencies, simply run
python -m pip install -r requirements.txt
As per usual the option -h|--help
can be used to show some basic usage information.
Some more information regarding some of the options:
-
--limit LIMIT
: Can be used to limit the region that should be analyzed/plotted byflametrace
. Its argumentLIMIT
is of the form<begin>:<end>
and specifies the begin and end of the region.<begin>
and<end>
must themselves belimit_spec
s. Alimit_spec
can be of the form<number>(%|a|c|s|t)
. Here%
specifies a percentage of the entire trace duration at which the region should start/end, anda
an absolute time (if specifying an absolute time, thea
-suffix is optional).c
,s
,t
specify the beginning/end of a call, slice, or thread respectively, at which the region itself should begin/end, and<number>
that object's ID. If you want to specify a swapper thread for<begin>
/<end
>, you must use the<limit_spec>
syntaxswapper/<cpu>
, as they all have ID 0. Additionally for the region of interest and the benchmark region,roi
andbenchmark
can be used as<limit_spec>
s as well.One of
<begin>
or<end>
can be missing (keeping the:
however, e.g.<begin>:
), which results in a region that runs from the beginning of the trace to<end>
, or from<begin>
to the end of the trace respectively. For thelimit_spec
typesc
,s
,t
, as well asroi
andbenchmark
, the syntax<limit_spec>
can be used as a shorthand version of<limit_spec>:<limit_spec>
. -
--limit-context LIMIT_CONTEXT
: Can be used to include context around the--limit
region. Its argument is a percentage, specifying how much context - in percent of the size of the original--limit
region - should be included to the left and to the right. -
--no-filter-pre-m5
: If specified, tracepoints before the first tracepoint belonging to them5
thread will be filtered fromTrace.txt
. This can be useful as sometimes the tracefile seems to be buggy before this point. -
--no-trace-convert-to-cycles
: Do not convert the timestamps in theTrace.txt
from picoseconds into cycles when parsing it. By default,--cpu-ghz
(or its default value) will be used for the conversion. -
--reset-cache
: When running,flametrace
caches all slices (before applying any--limit
s) for a tracefile to allow for faster subsequent generating of flamegraphs and statistics. If you do not want to use these cached slices (for example, because the tracefile has changed), you can use this option to force regeneration.
-
Process the file
Trace.txt
, generating an SVG flamegraph and thread activity diagrampython3 flametrace.py --fg-svg
-
Process the file
Trace2.txt
, generating an SVG flamegraph and thread activity diagram that spans only the region of interestpython3 flametrace.py Trace2.txt --fg-svg --limit roi
-
Process multiple tracefiles (all beginning with the prefix "
Trace
"), generating an SVG flamegraph, thread activity diagram and statistical information that spans from the beginning of the ROI to the end of the tracepython3 flametrace.py Trace* --fg-svg --stats --limit roi:
-
Process the file
Trace.txt
, generating an SVG flamegraph and thread activity diagram that spans just one slice from the flamegraph/activity diagram generated in example 1python3 flametrace.py --fg-svg --limit <slice-id-as-seen-in-svg>s
Some defaults and other things can be configured in flametrace/config.py