static PyObject* perf_counter(_Py_clock_info_t *info) { #if defined(WIN32_PERF_COUNTER) || defined(PYMONOTONIC) PyObject *res; #endif #if defined(WIN32_PERF_COUNTER) static int use_perf_counter = 1; #endif #ifdef PYMONOTONIC static int use_monotonic = 1; #endif #ifdef WIN32_PERF_COUNTER if (use_perf_counter) { if (win_perf_counter(info, &res) == 0) return res; use_perf_counter = 0; } #endif #ifdef PYMONOTONIC if (use_monotonic) { res = pymonotonic(info); if (res != NULL) return res; use_monotonic = 0; PyErr_Clear(); } #endif return floattime(info); }
static PyObject* perf_counter(_Py_clock_info_t *info) { #ifdef WIN32_PERF_COUNTER return win_perf_counter(info); #else return pymonotonic(info); #endif }
_PyTime_t _PyTime_GetMonotonicClock(void) { _PyTime_t t; if (pymonotonic(&t, NULL, 0) < 0) { /* should not happen, _PyTime_Init() checked that monotonic clock at startup */ assert(0); /* use a fixed value instead of a random value from the stack */ t = 0; } return t; }
static PyObject * time_monotonic(PyObject *self, PyObject *unused) { return pymonotonic(NULL); }
int _PyTime_GetMonotonicClockWithInfo(_PyTime_t *tp, _Py_clock_info_t *info) { return pymonotonic(tp, info, 1); }