blob: cfe192fc5d29eda736ad6e5efc266d5399354c32 [file] [log] [blame]
Łukasz Langaa785c872016-09-09 17:37:37 -07001/* Static DTrace probes interface */
2
3#ifndef Py_DTRACE_H
4#define Py_DTRACE_H
Benjamin Peterson39e10612016-09-10 17:34:15 -07005#ifdef __cplusplus
6extern "C" {
7#endif
Łukasz Langaa785c872016-09-09 17:37:37 -07008
9#ifdef WITH_DTRACE
10
11#include "pydtrace_probes.h"
12
13/* pydtrace_probes.h, on systems with DTrace, is auto-generated to include
14 `PyDTrace_{PROBE}` and `PyDTrace_{PROBE}_ENABLED()` macros for every probe
15 defined in pydtrace_provider.d.
16
17 Calling these functions must be guarded by a `PyDTrace_{PROBE}_ENABLED()`
18 check to minimize performance impact when probing is off. For example:
19
20 if (PyDTrace_FUNCTION_ENTRY_ENABLED())
21 PyDTrace_FUNCTION_ENTRY(f);
22*/
23
24#else
25
26/* Without DTrace, compile to nothing. */
27
Victor Stinner18618e652018-10-25 17:28:11 +020028Py_STATIC_INLINE(void) PyDTrace_LINE(const char *arg0, const char *arg1, int arg2) {}
29Py_STATIC_INLINE(void) PyDTrace_FUNCTION_ENTRY(const char *arg0, const char *arg1, int arg2) {}
30Py_STATIC_INLINE(void) PyDTrace_FUNCTION_RETURN(const char *arg0, const char *arg1, int arg2) {}
31Py_STATIC_INLINE(void) PyDTrace_GC_START(int arg0) {}
32Py_STATIC_INLINE(void) PyDTrace_GC_DONE(int arg0) {}
33Py_STATIC_INLINE(void) PyDTrace_INSTANCE_NEW_START(int arg0) {}
34Py_STATIC_INLINE(void) PyDTrace_INSTANCE_NEW_DONE(int arg0) {}
35Py_STATIC_INLINE(void) PyDTrace_INSTANCE_DELETE_START(int arg0) {}
36Py_STATIC_INLINE(void) PyDTrace_INSTANCE_DELETE_DONE(int arg0) {}
37Py_STATIC_INLINE(void) PyDTrace_IMPORT_FIND_LOAD_START(const char *arg0) {}
38Py_STATIC_INLINE(void) PyDTrace_IMPORT_FIND_LOAD_DONE(const char *arg0, int arg1) {}
Łukasz Langaa785c872016-09-09 17:37:37 -070039
Victor Stinner18618e652018-10-25 17:28:11 +020040Py_STATIC_INLINE(int) PyDTrace_LINE_ENABLED(void) { return 0; }
41Py_STATIC_INLINE(int) PyDTrace_FUNCTION_ENTRY_ENABLED(void) { return 0; }
42Py_STATIC_INLINE(int) PyDTrace_FUNCTION_RETURN_ENABLED(void) { return 0; }
43Py_STATIC_INLINE(int) PyDTrace_GC_START_ENABLED(void) { return 0; }
44Py_STATIC_INLINE(int) PyDTrace_GC_DONE_ENABLED(void) { return 0; }
45Py_STATIC_INLINE(int) PyDTrace_INSTANCE_NEW_START_ENABLED(void) { return 0; }
46Py_STATIC_INLINE(int) PyDTrace_INSTANCE_NEW_DONE_ENABLED(void) { return 0; }
47Py_STATIC_INLINE(int) PyDTrace_INSTANCE_DELETE_START_ENABLED(void) { return 0; }
48Py_STATIC_INLINE(int) PyDTrace_INSTANCE_DELETE_DONE_ENABLED(void) { return 0; }
49Py_STATIC_INLINE(int) PyDTrace_IMPORT_FIND_LOAD_START_ENABLED(void) { return 0; }
50Py_STATIC_INLINE(int) PyDTrace_IMPORT_FIND_LOAD_DONE_ENABLED(void) { return 0; }
Łukasz Langaa785c872016-09-09 17:37:37 -070051
52#endif /* !WITH_DTRACE */
53
Benjamin Peterson39e10612016-09-10 17:34:15 -070054#ifdef __cplusplus
55}
56#endif
Łukasz Langaa785c872016-09-09 17:37:37 -070057#endif /* !Py_DTRACE_H */