Mercurial > cpython-lru_cache-weakref
view Modules/timingmodule.c @ 22360:c8a6ea00a9e1 legacy-trunk
restructure a bit to not rely on test case execution ordering
add test case for bug #482460
| author | Skip Montanaro <skip@pobox.com> |
|---|---|
| date | Sun, 17 Mar 2002 23:03:42 +0000 |
| parents | 40631ae74b17 |
| children | aea6dfeaaab8 |
line wrap: on
line source
/* * Author: George V. Neville-Neil */ #include "Python.h" /* Our stuff... */ #include "timing.h" static PyObject * start_timing(PyObject *self, PyObject *args) { if (!PyArg_Parse(args, "")) return NULL; Py_INCREF(Py_None); BEGINTIMING; return Py_None; } static PyObject * finish_timing(PyObject *self, PyObject *args) { if (!PyArg_Parse(args, "")) return NULL; ENDTIMING Py_INCREF(Py_None); return Py_None; } static PyObject * seconds(PyObject *self, PyObject *args) { if (!PyArg_Parse(args, "")) return NULL; return PyInt_FromLong(TIMINGS); } static PyObject * milli(PyObject *self, PyObject *args) { if (!PyArg_Parse(args, "")) return NULL; return PyInt_FromLong(TIMINGMS); } static PyObject * micro(PyObject *self, PyObject *args) { if (!PyArg_Parse(args, "")) return NULL; return PyInt_FromLong(TIMINGUS); } static PyMethodDef timing_methods[] = { {"start", start_timing, METH_OLDARGS}, {"finish", finish_timing, METH_OLDARGS}, {"seconds", seconds, METH_OLDARGS}, {"milli", milli, METH_OLDARGS}, {"micro", micro, METH_OLDARGS}, {NULL, NULL} }; DL_EXPORT(void) inittiming(void) { (void)Py_InitModule("timing", timing_methods); }
