Debian Codegraph @

rpython/rlib/rvmprof/src/shared/_vmprof.h

raw symbols SCIP
1 #pragma once
2
3 #include "vmprof.h"
4
5 #ifdef VMPROF_WINDOWS
6
7 #include <Python.h>
8 // CPython 3.6 defines all the inttypes for us, we do not need the msiinttypes
9 // library for that version or any newer!
10 #if (PY_VERSION_HEX < 0x3060000)
11 #include "msiinttypes/inttypes.h"
12 #include "msiinttypes/stdint.h"
13 #endif
14
15 #else
16 #include <inttypes.h>
17 #include <stdint.h>
18 #include <stddef.h>
19 #endif
20
21 /**
22 * This whole setup is very strange. There was just one C file called
23 * _vmprof.c which included all *.h files to copy code. Unsure what
24 * the goal was with this design, but I assume it just 'GREW'
25 *
26 * Thus I'm (plan_rich) slowly trying to separate this. *.h files
27 * should not have complex implementations (all of them currently have them)
28 */
29
30
31 #define SINGLE_BUF_SIZE (8192 - 2 * sizeof(unsigned int))
32
33 #define ROUTINE_IS_PYTHON(RIP) ((unsigned long long)RIP & 0x1) == 0
34 #define ROUTINE_IS_C(RIP) ((unsigned long long)RIP & 0x1) == 1
35
36 /* This returns the address of the code object
37 as the identifier. The mapping from identifiers to string
38 representations of the code object is done elsewhere, namely:
39
40 * If the code object dies while vmprof is enabled,
41 PyCode_Type.tp_dealloc will emit it. (We don't handle nicely
42 for now the case where several code objects are created and die
43 at the same memory address.)
44
45 * When _vmprof.disable() is called, then we look around the
46 process for code objects and emit all the ones that we can
47 find (which we hope is very close to 100% of them).
48 */
49 #define CODE_ADDR_TO_UID(co) (((intptr_t)(co)))
50
51 #define CPYTHON_HAS_FRAME_EVALUATION PY_VERSION_HEX >= 0x30600B0
52
53 int vmp_write_all(const char *buf, size_t bufsize);