vvuk / mono-jitdump

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mono-profiler-jitdump

This is a simple Mono profiler plugin that writes jit-dump compatible data files on OSX (and Linux). It interfaces with compatible profilers such as samply (OSX + Linux) or perf (Linux) to provide them with JIT method information at runtime.

Install Rust and cargo via https://rustup.rs .

Install samply from source (via cargo install samply -- prebuilt version has issues):

git clone http://github.com/mstange/samply
cd samply/samply
cargo install --path .

Samply automatically handles domain reload (which causes all jit methods to be evicted) by simply evicting any jit method information if a new jit code block is received that overlaps any existing methods. Overlapping methods are removed from the data table.

It is not possible to attach to an existing process to begin profiling. samply must launch the process.

To verify that the profiler module is being loaded, Editor.log will contain ## Initialized jitdump profiler module.

Building and installing the profiler plugin

You need to build this profiler plugin and make it available to Unity.

  1. make
  2. cd path/to/Unity.app/Contents/lib (if the lib directory does not exist, create it)
  3. ln -s path-to-this-repo/build/libmono-profiler-jitdump.dylib . (or cp)

Profiling

Use samply record, together with passing -monoProfiler jitdump to Unity:

samply record --save-only -o profile-data.json -- path-to/Unity.app/Contents/MacOS/Unity -monoProfiler jitdump -projectpath path/to/Project
[... do things, exit or kill the process ...]
samply load profile-data.json

In the resulting view, JIT symbols will appear as purple (in the "JIT" category). Samply also profiles all threads and child processes, meaning you will see full profiles for out of process asset import, shader compilation, and similar.

About


Languages

Language:C 86.4%Language:Makefile 13.6%