instrumentation.c.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. /*[clinic input]
  2. preserve
  3. [clinic start generated code]*/
  4. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  5. # include "pycore_gc.h" // PyGC_Head
  6. # include "pycore_runtime.h" // _Py_ID()
  7. #endif
  8. PyDoc_STRVAR(monitoring_use_tool_id__doc__,
  9. "use_tool_id($module, tool_id, name, /)\n"
  10. "--\n"
  11. "\n");
  12. #define MONITORING_USE_TOOL_ID_METHODDEF \
  13. {"use_tool_id", _PyCFunction_CAST(monitoring_use_tool_id), METH_FASTCALL, monitoring_use_tool_id__doc__},
  14. static PyObject *
  15. monitoring_use_tool_id_impl(PyObject *module, int tool_id, PyObject *name);
  16. static PyObject *
  17. monitoring_use_tool_id(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  18. {
  19. PyObject *return_value = NULL;
  20. int tool_id;
  21. PyObject *name;
  22. if (!_PyArg_CheckPositional("use_tool_id", nargs, 2, 2)) {
  23. goto exit;
  24. }
  25. tool_id = _PyLong_AsInt(args[0]);
  26. if (tool_id == -1 && PyErr_Occurred()) {
  27. goto exit;
  28. }
  29. name = args[1];
  30. return_value = monitoring_use_tool_id_impl(module, tool_id, name);
  31. exit:
  32. return return_value;
  33. }
  34. PyDoc_STRVAR(monitoring_free_tool_id__doc__,
  35. "free_tool_id($module, tool_id, /)\n"
  36. "--\n"
  37. "\n");
  38. #define MONITORING_FREE_TOOL_ID_METHODDEF \
  39. {"free_tool_id", (PyCFunction)monitoring_free_tool_id, METH_O, monitoring_free_tool_id__doc__},
  40. static PyObject *
  41. monitoring_free_tool_id_impl(PyObject *module, int tool_id);
  42. static PyObject *
  43. monitoring_free_tool_id(PyObject *module, PyObject *arg)
  44. {
  45. PyObject *return_value = NULL;
  46. int tool_id;
  47. tool_id = _PyLong_AsInt(arg);
  48. if (tool_id == -1 && PyErr_Occurred()) {
  49. goto exit;
  50. }
  51. return_value = monitoring_free_tool_id_impl(module, tool_id);
  52. exit:
  53. return return_value;
  54. }
  55. PyDoc_STRVAR(monitoring_get_tool__doc__,
  56. "get_tool($module, tool_id, /)\n"
  57. "--\n"
  58. "\n");
  59. #define MONITORING_GET_TOOL_METHODDEF \
  60. {"get_tool", (PyCFunction)monitoring_get_tool, METH_O, monitoring_get_tool__doc__},
  61. static PyObject *
  62. monitoring_get_tool_impl(PyObject *module, int tool_id);
  63. static PyObject *
  64. monitoring_get_tool(PyObject *module, PyObject *arg)
  65. {
  66. PyObject *return_value = NULL;
  67. int tool_id;
  68. tool_id = _PyLong_AsInt(arg);
  69. if (tool_id == -1 && PyErr_Occurred()) {
  70. goto exit;
  71. }
  72. return_value = monitoring_get_tool_impl(module, tool_id);
  73. exit:
  74. return return_value;
  75. }
  76. PyDoc_STRVAR(monitoring_register_callback__doc__,
  77. "register_callback($module, tool_id, event, func, /)\n"
  78. "--\n"
  79. "\n");
  80. #define MONITORING_REGISTER_CALLBACK_METHODDEF \
  81. {"register_callback", _PyCFunction_CAST(monitoring_register_callback), METH_FASTCALL, monitoring_register_callback__doc__},
  82. static PyObject *
  83. monitoring_register_callback_impl(PyObject *module, int tool_id, int event,
  84. PyObject *func);
  85. static PyObject *
  86. monitoring_register_callback(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  87. {
  88. PyObject *return_value = NULL;
  89. int tool_id;
  90. int event;
  91. PyObject *func;
  92. if (!_PyArg_CheckPositional("register_callback", nargs, 3, 3)) {
  93. goto exit;
  94. }
  95. tool_id = _PyLong_AsInt(args[0]);
  96. if (tool_id == -1 && PyErr_Occurred()) {
  97. goto exit;
  98. }
  99. event = _PyLong_AsInt(args[1]);
  100. if (event == -1 && PyErr_Occurred()) {
  101. goto exit;
  102. }
  103. func = args[2];
  104. return_value = monitoring_register_callback_impl(module, tool_id, event, func);
  105. exit:
  106. return return_value;
  107. }
  108. PyDoc_STRVAR(monitoring_get_events__doc__,
  109. "get_events($module, tool_id, /)\n"
  110. "--\n"
  111. "\n");
  112. #define MONITORING_GET_EVENTS_METHODDEF \
  113. {"get_events", (PyCFunction)monitoring_get_events, METH_O, monitoring_get_events__doc__},
  114. static int
  115. monitoring_get_events_impl(PyObject *module, int tool_id);
  116. static PyObject *
  117. monitoring_get_events(PyObject *module, PyObject *arg)
  118. {
  119. PyObject *return_value = NULL;
  120. int tool_id;
  121. int _return_value;
  122. tool_id = _PyLong_AsInt(arg);
  123. if (tool_id == -1 && PyErr_Occurred()) {
  124. goto exit;
  125. }
  126. _return_value = monitoring_get_events_impl(module, tool_id);
  127. if ((_return_value == -1) && PyErr_Occurred()) {
  128. goto exit;
  129. }
  130. return_value = PyLong_FromLong((long)_return_value);
  131. exit:
  132. return return_value;
  133. }
  134. PyDoc_STRVAR(monitoring_set_events__doc__,
  135. "set_events($module, tool_id, event_set, /)\n"
  136. "--\n"
  137. "\n");
  138. #define MONITORING_SET_EVENTS_METHODDEF \
  139. {"set_events", _PyCFunction_CAST(monitoring_set_events), METH_FASTCALL, monitoring_set_events__doc__},
  140. static PyObject *
  141. monitoring_set_events_impl(PyObject *module, int tool_id, int event_set);
  142. static PyObject *
  143. monitoring_set_events(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  144. {
  145. PyObject *return_value = NULL;
  146. int tool_id;
  147. int event_set;
  148. if (!_PyArg_CheckPositional("set_events", nargs, 2, 2)) {
  149. goto exit;
  150. }
  151. tool_id = _PyLong_AsInt(args[0]);
  152. if (tool_id == -1 && PyErr_Occurred()) {
  153. goto exit;
  154. }
  155. event_set = _PyLong_AsInt(args[1]);
  156. if (event_set == -1 && PyErr_Occurred()) {
  157. goto exit;
  158. }
  159. return_value = monitoring_set_events_impl(module, tool_id, event_set);
  160. exit:
  161. return return_value;
  162. }
  163. PyDoc_STRVAR(monitoring_get_local_events__doc__,
  164. "get_local_events($module, tool_id, code, /)\n"
  165. "--\n"
  166. "\n");
  167. #define MONITORING_GET_LOCAL_EVENTS_METHODDEF \
  168. {"get_local_events", _PyCFunction_CAST(monitoring_get_local_events), METH_FASTCALL, monitoring_get_local_events__doc__},
  169. static int
  170. monitoring_get_local_events_impl(PyObject *module, int tool_id,
  171. PyObject *code);
  172. static PyObject *
  173. monitoring_get_local_events(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  174. {
  175. PyObject *return_value = NULL;
  176. int tool_id;
  177. PyObject *code;
  178. int _return_value;
  179. if (!_PyArg_CheckPositional("get_local_events", nargs, 2, 2)) {
  180. goto exit;
  181. }
  182. tool_id = _PyLong_AsInt(args[0]);
  183. if (tool_id == -1 && PyErr_Occurred()) {
  184. goto exit;
  185. }
  186. code = args[1];
  187. _return_value = monitoring_get_local_events_impl(module, tool_id, code);
  188. if ((_return_value == -1) && PyErr_Occurred()) {
  189. goto exit;
  190. }
  191. return_value = PyLong_FromLong((long)_return_value);
  192. exit:
  193. return return_value;
  194. }
  195. PyDoc_STRVAR(monitoring_set_local_events__doc__,
  196. "set_local_events($module, tool_id, code, event_set, /)\n"
  197. "--\n"
  198. "\n");
  199. #define MONITORING_SET_LOCAL_EVENTS_METHODDEF \
  200. {"set_local_events", _PyCFunction_CAST(monitoring_set_local_events), METH_FASTCALL, monitoring_set_local_events__doc__},
  201. static PyObject *
  202. monitoring_set_local_events_impl(PyObject *module, int tool_id,
  203. PyObject *code, int event_set);
  204. static PyObject *
  205. monitoring_set_local_events(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  206. {
  207. PyObject *return_value = NULL;
  208. int tool_id;
  209. PyObject *code;
  210. int event_set;
  211. if (!_PyArg_CheckPositional("set_local_events", nargs, 3, 3)) {
  212. goto exit;
  213. }
  214. tool_id = _PyLong_AsInt(args[0]);
  215. if (tool_id == -1 && PyErr_Occurred()) {
  216. goto exit;
  217. }
  218. code = args[1];
  219. event_set = _PyLong_AsInt(args[2]);
  220. if (event_set == -1 && PyErr_Occurred()) {
  221. goto exit;
  222. }
  223. return_value = monitoring_set_local_events_impl(module, tool_id, code, event_set);
  224. exit:
  225. return return_value;
  226. }
  227. PyDoc_STRVAR(monitoring_restart_events__doc__,
  228. "restart_events($module, /)\n"
  229. "--\n"
  230. "\n");
  231. #define MONITORING_RESTART_EVENTS_METHODDEF \
  232. {"restart_events", (PyCFunction)monitoring_restart_events, METH_NOARGS, monitoring_restart_events__doc__},
  233. static PyObject *
  234. monitoring_restart_events_impl(PyObject *module);
  235. static PyObject *
  236. monitoring_restart_events(PyObject *module, PyObject *Py_UNUSED(ignored))
  237. {
  238. return monitoring_restart_events_impl(module);
  239. }
  240. PyDoc_STRVAR(monitoring__all_events__doc__,
  241. "_all_events($module, /)\n"
  242. "--\n"
  243. "\n");
  244. #define MONITORING__ALL_EVENTS_METHODDEF \
  245. {"_all_events", (PyCFunction)monitoring__all_events, METH_NOARGS, monitoring__all_events__doc__},
  246. static PyObject *
  247. monitoring__all_events_impl(PyObject *module);
  248. static PyObject *
  249. monitoring__all_events(PyObject *module, PyObject *Py_UNUSED(ignored))
  250. {
  251. return monitoring__all_events_impl(module);
  252. }
  253. /*[clinic end generated code: output=11cc0803875b3ffa input=a9049054013a1b77]*/