pydtrace.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* Static DTrace probes interface */
  2. #ifndef Py_DTRACE_H
  3. #define Py_DTRACE_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #ifdef WITH_DTRACE
  8. #include "pydtrace_probes.h"
  9. /* pydtrace_probes.h, on systems with DTrace, is auto-generated to include
  10. `PyDTrace_{PROBE}` and `PyDTrace_{PROBE}_ENABLED()` macros for every probe
  11. defined in pydtrace.d.
  12. Calling these functions must be guarded by a `PyDTrace_{PROBE}_ENABLED()`
  13. check to minimize performance impact when probing is off. For example:
  14. if (PyDTrace_FUNCTION_ENTRY_ENABLED())
  15. PyDTrace_FUNCTION_ENTRY(f);
  16. */
  17. #else
  18. /* Without DTrace, compile to nothing. */
  19. static inline void PyDTrace_LINE(const char *arg0, const char *arg1, int arg2) {}
  20. static inline void PyDTrace_FUNCTION_ENTRY(const char *arg0, const char *arg1, int arg2) {}
  21. static inline void PyDTrace_FUNCTION_RETURN(const char *arg0, const char *arg1, int arg2) {}
  22. static inline void PyDTrace_GC_START(int arg0) {}
  23. static inline void PyDTrace_GC_DONE(Py_ssize_t arg0) {}
  24. static inline void PyDTrace_INSTANCE_NEW_START(int arg0) {}
  25. static inline void PyDTrace_INSTANCE_NEW_DONE(int arg0) {}
  26. static inline void PyDTrace_INSTANCE_DELETE_START(int arg0) {}
  27. static inline void PyDTrace_INSTANCE_DELETE_DONE(int arg0) {}
  28. static inline void PyDTrace_IMPORT_FIND_LOAD_START(const char *arg0) {}
  29. static inline void PyDTrace_IMPORT_FIND_LOAD_DONE(const char *arg0, int arg1) {}
  30. static inline void PyDTrace_AUDIT(const char *arg0, void *arg1) {}
  31. static inline int PyDTrace_LINE_ENABLED(void) { return 0; }
  32. static inline int PyDTrace_FUNCTION_ENTRY_ENABLED(void) { return 0; }
  33. static inline int PyDTrace_FUNCTION_RETURN_ENABLED(void) { return 0; }
  34. static inline int PyDTrace_GC_START_ENABLED(void) { return 0; }
  35. static inline int PyDTrace_GC_DONE_ENABLED(void) { return 0; }
  36. static inline int PyDTrace_INSTANCE_NEW_START_ENABLED(void) { return 0; }
  37. static inline int PyDTrace_INSTANCE_NEW_DONE_ENABLED(void) { return 0; }
  38. static inline int PyDTrace_INSTANCE_DELETE_START_ENABLED(void) { return 0; }
  39. static inline int PyDTrace_INSTANCE_DELETE_DONE_ENABLED(void) { return 0; }
  40. static inline int PyDTrace_IMPORT_FIND_LOAD_START_ENABLED(void) { return 0; }
  41. static inline int PyDTrace_IMPORT_FIND_LOAD_DONE_ENABLED(void) { return 0; }
  42. static inline int PyDTrace_AUDIT_ENABLED(void) { return 0; }
  43. #endif /* !WITH_DTRACE */
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #endif /* !Py_DTRACE_H */