@@ -23,9 +23,12 @@ Note that holding the Global Interpreter Lock (GIL) is not required for these AP
2323 Open the ``/tmp/perf-$pid.map`` file, unless it's already opened, and create
2424 a lock to ensure thread-safe writes to the file (provided the writes are
2525 done through :c:func: `PyUnstable_WritePerfMapEntry `). Normally, there's no need
26- to call this explicitly, and it is safe to directly use :c:func:`PyUnstable_WritePerfMapEntry`
27- in your code. If the state isn't already initialized, it will be created on
28- the first call.
26+ to call this explicitly; just use :c:func:`PyUnstable_WritePerfMapEntry`
27+ and it will initialize the state on first call.
28+
29+ Returns ``0 `` on success, ``-1 `` on failure to create/open the perf map file,
30+ or ``-2 `` on failure to create a lock. Check :c:data: `errno ` for more
31+ information about the cause of a failure.
2932
3033.. c :function :: int PyUnstable_WritePerfMapEntry (const void *code_addr, unsigned int code_size, const char *entry_name)
3134
@@ -35,12 +38,13 @@ Note that holding the Global Interpreter Lock (GIL) is not required for these AP
3538 # address size name
3639 7f3529fcf759 b py::bar:/run/t.py
3740
38- Extensions are encouraged to directly call this API when needed, instead of
39- separately initializing the state by calling :c:func: `PyUnstable_PerfMapState_Init `.
41+ Will call :c:func: `PyUnstable_PerfMapState_Init ` before writing the entry, if
42+ the perf map file is not already opened. Returns ``0 `` on success, or the
43+ same error codes as :c:func: `PyUnstable_PerfMapState_Init ` on failure.
4044
41- .. c :function :: int PyUnstable_PerfMapState_Fini (void)
45+ .. c :function :: void PyUnstable_PerfMapState_Fini (void)
4246
43- Close the perf map file, which was opened in `` PyUnstable_PerfMapState_Init``. This
44- API is called by the runtime itself, during interpreter shut-down. In general,
45- there shouldn't be a reason to explicitly call this, except to handle specific
46- scenarios such as forking.
47+ Close the perf map file opened by :c:func:` PyUnstable_PerfMapState_Init`.
48+ This is called by the runtime itself during interpreter shut-down. In
49+ general, there shouldn't be a reason to explicitly call this, except to
50+ handle specific scenarios such as forking.
0 commit comments