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