| id | perf-profiling |
|---|---|
| title | perf Profiling |
This document describes how to profile the performance of Static Hermes.
Currently, we rely on Linux perf tool for profiling JIT'ed code, and we only enable JIT on ARM64 platform. So you need to have a Linux machine with ARM64.
- Recording the trace.
-Xperf-profis to enable perf profiling,-Xperf-prof-diris to specify the output directory (by default it's/tmpso if you don't want to look into those generated files, you can skip this flag).-k monomeans we use CLOCK_MONOTONIC for clock id, as it's used in jitdump. Here we only sample user space events, but you could also sample kernel events and also specify different flags (e.g., -g for call graph). - Injecting the jitdump into the perf.data. This will create an ELF binary for each JIT'ed function.
- Reporting the trace.
perf record -g -k mono -e cycles:u ./bin/hermes ~/js/test.js -Xjit=force \
-Xperf-prof -Xperf-prof-dir ./
perf inject -j -i perf.data -o perf.data.jitted
perf report -i perf.data.jitted --call-graph=fractal,callee --children