1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#if defined(MEASURE_TIMING)
#include <Python.h>
/* ----------------------------------------------------------------------- */
typedef struct
{
PyObject_HEAD
unsigned long start_count; /* Total count of starts */
unsigned long start; /* Last start time in usec */
unsigned long stop; /* Last stop time in usec */
double accum; /* Accumulated timing in usec for all start/stop cycles */
unsigned long entries; /* Incrementing/Decrementing count of starts */
unsigned long starts_on_entry; /* global start count at top level entry */
unsigned long cycles; /* Last count of nested teacup cycles (overhead) */
} PyTeaCupObject;
/* ----------------------------------------------------------------------- */
#include "libteacup.h"
/* ----------------------------------------------------------------------- */
#define tc_start_clock(x) { static void *cache; cache = _teacup_start_clock(__FILE__, x, cache); }
#define tc_stop_clock(x) { static void *cache; cache = _teacup_stop_clock(__FILE__, x, cache); }
#define import_libtc() import_libteacup()
/* ----------------------------------------------------------------------- */
#else
#define tc_start_clock(x)
#define tc_stop_clock(x)
#define import_libtc()
#endif
|