Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alamvic/xcvmprofiler

VM Profiler based on instruments
https://github.com/alamvic/xcvmprofiler

Last synced: about 2 months ago
JSON representation

VM Profiler based on instruments

Awesome Lists containing this project

README

        

# XCVMProfiler
VM Profiler based on [instruments](https://help.apple.com/instruments/mac/current/#/dev7b09c84f5) and [perf](https://perf.wiki.kernel.org/)

## Instruments 🍎
### Install
```smalltalk
Metacello new
baseline: 'XCTrace';
repository: 'github://Alamvic/XCVMProfiler:main/src';
load.
```

### How to use
```smalltalk
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.
```
---
## perf 🐧
### Install
```smalltalk
Metacello new
baseline: 'PerfTreeParser';
repository: 'github://Alamvic/XCVMProfiler:main/src';
load.
```

### How to use
#### For perf
You need to use these parameters in order for the parser to work as intended:
```console
sudo perf record -a -g --call-graph=dwarf -- ./script.sh
sudo perf report --header --call-graph=callee --stdio > perf_example.txt
```

#### For Pharo
```smalltalk
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
```