mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Renamed.
This commit is contained in:
parent
5b456645fb
commit
58d40a7400
1 changed files with 45 additions and 49 deletions
|
@ -2,77 +2,74 @@
|
||||||
* Author: George V. Neville-Neil
|
* Author: George V. Neville-Neil
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "allobjects.h"
|
#include "Python.h"
|
||||||
#include "import.h"
|
|
||||||
#include "modsupport.h"
|
|
||||||
#include "ceval.h"
|
|
||||||
|
|
||||||
/* Our stuff... */
|
/* Our stuff... */
|
||||||
#include "timing.h"
|
#include "timing.h"
|
||||||
|
|
||||||
static object *
|
static PyObject *
|
||||||
start_timing(self, args)
|
start_timing(self, args)
|
||||||
object *self;
|
PyObject *self;
|
||||||
object *args;
|
PyObject *args;
|
||||||
{
|
{
|
||||||
if (!getargs(args, ""))
|
if (!PyArg_Parse(args, ""))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
INCREF(None);
|
Py_INCREF(Py_None);
|
||||||
BEGINTIMING;
|
BEGINTIMING;
|
||||||
return None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
static object *
|
static PyObject *
|
||||||
finish_timing(self, args)
|
finish_timing(self, args)
|
||||||
object *self;
|
PyObject *self;
|
||||||
object *args;
|
PyObject *args;
|
||||||
{
|
{
|
||||||
if (!getargs(args, ""))
|
if (!PyArg_Parse(args, ""))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ENDTIMING
|
ENDTIMING
|
||||||
INCREF(None);
|
Py_INCREF(Py_None);
|
||||||
return None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
static object *
|
static PyObject *
|
||||||
seconds(self, args)
|
seconds(self, args)
|
||||||
object *self;
|
PyObject *self;
|
||||||
object *args;
|
PyObject *args;
|
||||||
{
|
{
|
||||||
if (!getargs(args, ""))
|
if (!PyArg_Parse(args, ""))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return newintobject(TIMINGS);
|
return PyInt_FromLong(TIMINGS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static object *
|
static PyObject *
|
||||||
milli(self, args)
|
milli(self, args)
|
||||||
object *self;
|
PyObject *self;
|
||||||
object *args;
|
PyObject *args;
|
||||||
{
|
{
|
||||||
if (!getargs(args, ""))
|
if (!PyArg_Parse(args, ""))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return newintobject(TIMINGMS);
|
return PyInt_FromLong(TIMINGMS);
|
||||||
|
|
||||||
}
|
}
|
||||||
static object *
|
static PyObject *
|
||||||
micro(self, args)
|
micro(self, args)
|
||||||
object *self;
|
PyObject *self;
|
||||||
object *args;
|
PyObject *args;
|
||||||
{
|
{
|
||||||
if (!getargs(args, ""))
|
if (!PyArg_Parse(args, ""))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return newintobject(TIMINGUS);
|
return PyInt_FromLong(TIMINGUS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct methodlist timing_methods[] = {
|
static PyMethodDef timing_methods[] = {
|
||||||
{"start", start_timing},
|
{"start", start_timing},
|
||||||
{"finish", finish_timing},
|
{"finish", finish_timing},
|
||||||
{"seconds", seconds},
|
{"seconds", seconds},
|
||||||
|
@ -84,8 +81,7 @@ static struct methodlist timing_methods[] = {
|
||||||
|
|
||||||
void inittiming()
|
void inittiming()
|
||||||
{
|
{
|
||||||
object *m;
|
(void)Py_InitModule("timing", timing_methods);
|
||||||
|
if (PyErr_Occurred())
|
||||||
m = initmodule("timing", timing_methods);
|
Py_FatalError("can't initialize module timing");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue