VM Profiler based on instruments and perf
Metacello new
baseline: 'XCTrace';
repository: 'github://Alamvic/XCVMProfiler:main/src';
load.
fr := (FileLocator home / 'path/to/XCVMProfiler/resources/test-profile.trace') asFileReference.
"To get the XML data"
tree := XCTraceTree fromTimeProfileFileReference: fr.
samples := tree samples.
"To directly get the different classified profiles"
primitiveProfiles := (XCVMDifferentialPrimitiveProfiler onFiles: {fr}) profiles.
profiles := (XCVMDifferentialProfiler onFiles: {fr}) profiles.
Metacello new
baseline: 'PerfTreeParser';
repository: 'github://Alamvic/XCVMProfiler:main/src';
load.
You need to use these parameters in order for the parser to work as intended:
sudo perf record -a -g --call-graph=dwarf -- ./script.sh
sudo perf report --header --call-graph=callee --stdio > perf_example.txt
fr := (FileLocator home / 'path/to/XCVMProfiler/resources/perf_example_callee_multiple_children.txt') asFileReference.
"Use `parseFile:` to directly get the head of the node with all the parsing done"
node := PerfTreeParser parseFile: fr.
"To get the traces of the nodes:"
traces := node traces.
"You can use `fromFile:` if you want to play with the parser"
parser := PerfTreeParser fromFile: fr