File: timing.h

package info (click to toggle)
psyco-doc 1.6-1
  • links: PTS
  • area: contrib
  • in suites: lenny
  • size: 1,832 kB
  • ctags: 3,236
  • sloc: ansic: 23,895; python: 5,646; perl: 1,309; makefile: 153
file content (32 lines) | stat: -rw-r--r-- 777 bytes parent folder | download | duplicates (4)
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
 /***************************************************************/
/***                   Measuring processor time                ***/
 /***************************************************************/

#ifndef _TIMING_H
#define _TIMING_H

#include "psyco.h"
#include "Python/pyver.h"


#define measure_is_zero(m)  ((m) == (time_measure_t) 0)


/***************************************************************/
/* Use the tick_counter field of the PyThreadState for timing  */

#define MEASURE_ALL_THREADS    1

typedef int time_measure_t;

PSY_INLINE time_measure_t get_measure(PyThreadState* tstate)
{
	int result = tstate->tick_counter;
	tstate->tick_counter = 0;
	return result;
}

/***************************************************************/


#endif /* _TIMING_H */