Staging
v0.5.1
https://github.com/python/cpython
Revision 42af3cedd9e072d6a6d2dd0cb17b38d00e19f397 authored by Thomas Wouters on 09 July 2001, 14:34:16 UTC, committed by Thomas Wouters on 09 July 2001, 14:34:16 UTC
The block/unblock thread macros are called 'Py_BLOCK_THREADS' and
'Py_UNBLOCK_THREADS', not 'Py_BEGIN_BLOCK_THREADS' and
'Py_BEGIN_UNBLOCK_THREADS'.
1 parent 4c633be
Raw File
Tip revision: 42af3cedd9e072d6a6d2dd0cb17b38d00e19f397 authored by Thomas Wouters on 09 July 2001, 14:34:16 UTC
Fix for SF bug #436525, reported by Greg Kochanski:
Tip revision: 42af3ce
timingmodule.c
/*
 * Author: George V. Neville-Neil
 */

#include "Python.h"

/* Our stuff... */
#include "timing.h"

static PyObject *
start_timing(PyObject *self, PyObject *args)
{
	if (!PyArg_Parse(args, ""))
		return NULL;

	Py_INCREF(Py_None);
	BEGINTIMING;
	return Py_None;
}

static PyObject *
finish_timing(PyObject *self, PyObject *args)
{
	if (!PyArg_Parse(args, ""))
		return NULL;

	ENDTIMING    
	Py_INCREF(Py_None);
	return Py_None;
}

static PyObject *
seconds(PyObject *self, PyObject *args)
{
	if (!PyArg_Parse(args, ""))
		return NULL;

	return PyInt_FromLong(TIMINGS);

}

static PyObject *
milli(PyObject *self, PyObject *args)
{
	if (!PyArg_Parse(args, ""))
		return NULL;

	return PyInt_FromLong(TIMINGMS);

}
static PyObject *
micro(PyObject *self, PyObject *args)
{
	if (!PyArg_Parse(args, ""))
		return NULL;

	return PyInt_FromLong(TIMINGUS);

}


static PyMethodDef timing_methods[] = {
	{"start",   start_timing},
	{"finish",  finish_timing},
	{"seconds", seconds},
	{"milli",   milli},
	{"micro",   micro},
	{NULL,      NULL}
};


DL_EXPORT(void) inittiming(void)
{
	(void)Py_InitModule("timing", timing_methods);
}
back to top