blob: 140d2e1dd3a5e8dd061b515db40cf991651a1f38 [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
Benjamin Petersonfeb7edc2016-09-09 18:09:52 -070028inline void PyDTrace_LINE(const char *arg0, const char *arg1, int arg2) {}
29inline void PyDTrace_FUNCTION_ENTRY(const char *arg0, const char *arg1, int arg2) {}
30inline void PyDTrace_FUNCTION_RETURN(const char *arg0, const char *arg1, int arg2) {}
31inline void PyDTrace_GC_START(int arg0) {}
32inline void PyDTrace_GC_DONE(int arg0) {}
33inline void PyDTrace_INSTANCE_NEW_START(int arg0) {}
34inline void PyDTrace_INSTANCE_NEW_DONE(int arg0) {}
35inline void PyDTrace_INSTANCE_DELETE_START(int arg0) {}
36inline void PyDTrace_INSTANCE_DELETE_DONE(int arg0) {}
Łukasz Langaa785c872016-09-09 17:37:37 -070037
Benjamin Petersonfeb7edc2016-09-09 18:09:52 -070038inline int PyDTrace_LINE_ENABLED(void) { return 0; }
39inline int PyDTrace_FUNCTION_ENTRY_ENABLED(void) { return 0; }
40inline int PyDTrace_FUNCTION_RETURN_ENABLED(void) { return 0; }
41inline int PyDTrace_GC_START_ENABLED(void) { return 0; }
42inline int PyDTrace_GC_DONE_ENABLED(void) { return 0; }
43inline int PyDTrace_INSTANCE_NEW_START_ENABLED(void) { return 0; }
44inline int PyDTrace_INSTANCE_NEW_DONE_ENABLED(void) { return 0; }
45inline int PyDTrace_INSTANCE_DELETE_START_ENABLED(void) { return 0; }
46inline int PyDTrace_INSTANCE_DELETE_DONE_ENABLED(void) { return 0; }
Łukasz Langaa785c872016-09-09 17:37:37 -070047
48#endif /* !WITH_DTRACE */
49
Benjamin Peterson39e10612016-09-10 17:34:15 -070050#ifdef __cplusplus
51}
52#endif
Łukasz Langaa785c872016-09-09 17:37:37 -070053#endif /* !Py_DTRACE_H */