Skip to main content

Module perf_map

Module perf_map 

Source
Expand description

LOGOS_PERF_MAP — name the JIT’s machine code for perf.

Linux perf symbolizes a JIT’s anonymous executable memory through /tmp/perf-<pid>.map: one START SIZE name line per code region, addresses and sizes in hex. When the env var is set (and non-empty, non-"0"), the VM appends a line each time native code is installed for a function or a loop region, named after the LOGOS source (logos::fib [jit], logos::main::loop@42 [jit]), so a profile of largo run --interpret reads in the program’s own terms instead of [unknown].

LOGOS_JIT_CODE=<dir> keeps the machine code itself: each extent’s bytes go to <dir>/<n>.bin, listed in <dir>/index.tsv as n START SIZE name (hex START and SIZE, the map’s names), for a disassembler.

Functions§

enabled
Whether LOGOS_PERF_MAP requests the map (set, non-empty, not "0").
format_line
One map line. Pure — the unit under test.
function_symbol
The symbol a natively compiled function is named under.
map_path
The map file perf reads for this process.
observed
Whether a caller has anything to record: the perf map or the code dump is on.
record
Append one line per code extent iff the map is enabled. A write failure disables nothing and never reaches the program: the map is observability only.
record_code
Record installed native code under symbol: one perf-map line per extent, and its bytes when LOGOS_JIT_CODE names a directory. Each extent must be sealed code the native tier owns, readable for its whole length.
region_symbol
The symbol a natively compiled loop region is named under: its enclosing function and the pc of its loop head.