File: tc.h

package info (click to toggle)
python-numarray 1.5.2-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,668 kB
  • ctags: 11,384
  • sloc: ansic: 113,864; python: 22,422; makefile: 197; sh: 11
file content (38 lines) | stat: -rw-r--r-- 1,316 bytes parent folder | download | duplicates (2)
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