-
Notifications
You must be signed in to change notification settings - Fork 337
Running toplev offline
When you cannot run toplev on the target system, it is possible to do the measurement separately just using perf:
On target system (only needed once):
cat /proc/cpuinfo > toplev_cpuinfo
find /sys/devices > toplev_topology
Copy cpuinfo and topology to system running toplev.
On toplev system:
toplev --force-topology topology --force-cpuinfo cpuinfo --gen-script <toplev options> > script
should be the intended configuration, e.g. which level or additional metrics.
If you don't want to copy topology/cpuinfo in advance it can be enough to use --force-cpu, however this typically requires disabling the uncore events if the systems are different (--no-uncore) or use --no-check.
It is probably a good idea to use -I 1000 or similar to get a time series measurement (it can still be summarized with --summary later) When the target is a virtual machine --hypervisor will be likely needed. When the target doesn't allow running as root --single-threaded might be needed.
It may be needed to disable the NMI watchdog on the target, unless the script generation ran with FORCE_NMI_WATCHDOG=0
echo 0 > /proc/sys/kernel/nmi_watchdog
Copy script to target system and run on target:
chmod +x script
./script sleep 1
This will measure the target system for 1s. Alternatively you can specify a command to measure (not it will still measure globally), or nothing (measure until Ctrl-C). Likely this will require root, unless --single-thread was used.
The output will be toplev_perf.csv (and also toplev_topology / toplev_cpuinfo, but these are not needed again from the earlier step). The name of the output can be overridden using the OUT environment variable.
OUT=mylog ./script myprogram
Then the output will be mylog_perf.csv
Copy the output file back to the toplev system and run
toplev.py <original toplev options> --import toplev_perf.csv --force-cpuinfo toplev_cpuinfo --force-topology toplev_topology
The toplev options need to match the options used with the original --gen-script.
There are some exceptions. For example it's possible to change the Output options, such as --global / --per-* / --columns / --summary and run it with the same --import input file. This is useful to summarize a single measurement in multiple ways (e.g. per core, per socket, graph, global summary).
If the data is collected and processed on the same system, it's not necessarily needed to run a script: the data file can also be generated with --perf-output from toplev.
toplev -I 1000 --perf-output foo.csv <options> <workload> # measure once
toplev --import foo.csv <options> --summary --global # generate global summary
toplev --import foo.csv <options> --summary --per-socket # generate per socket summary
toplev --import foo.csv <options> --summary --per-core # generate per core summary
toplev --import foo.csv <options> --core 0 --per-core # only look at core 0
# generate all outputs in CSV form with summary in foo.out-{core,socket,global,thread}
toplev --import foo.csv <options> -x, --split-output -o foo.out --per-thread --per-core --per-socket --global --summary
Sampling is currently not supported offline.