Exemplo n.º 1
0
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);
}
Exemplo n.º 2
0
static PyObject*
perf_counter(_Py_clock_info_t *info)
{
#ifdef WIN32_PERF_COUNTER
    return win_perf_counter(info);
#else
    return pymonotonic(info);
#endif
}
Exemplo n.º 3
0
static PyObject*
pyclock(_Py_clock_info_t *info)
{
#ifdef WIN32_PERF_COUNTER
    return win_perf_counter(info);
#else
    return floatclock(info);
#endif
}
Exemplo n.º 4
0
static PyObject*
pyclock(_Py_clock_info_t *info)
{
#ifdef WIN32_PERF_COUNTER
    PyObject *res;
    if (win_perf_counter(info, &res) == 0)
        return res;
#endif
    return floatclock(info);
}