blob: f4fd1ab835fee98ca8c4a4fdda8a445d8d40de52 [file] [log] [blame]
Guido van Rossum116857c1994-01-02 23:22:21 +00001/*
Guido van Rossum116857c1994-01-02 23:22:21 +00002 * Author: George V. Neville-Neil
Guido van Rossum116857c1994-01-02 23:22:21 +00003 */
4
Guido van Rossum116857c1994-01-02 23:22:21 +00005#include "allobjects.h"
6#include "import.h"
7#include "modsupport.h"
8#include "ceval.h"
9
10/* Our stuff... */
11#include "timing.h"
12
13static object *
14start_timing(self, args)
15 object *self;
16 object *args;
17{
18 if (!getargs(args, ""))
19 return NULL;
20
21 INCREF(None);
22 BEGINTIMING;
23 return None;
24}
25
26static object *
27finish_timing(self, args)
28 object *self;
29 object *args;
30{
31 if (!getargs(args, ""))
32 return NULL;
33
34 ENDTIMING
35 INCREF(None);
36 return None;
37}
38
39static object *
40seconds(self, args)
41 object *self;
42 object *args;
43{
44 if (!getargs(args, ""))
45 return NULL;
46
47 return newintobject(TIMINGS);
48
49}
50
51static object *
52milli(self, args)
53 object *self;
54 object *args;
55{
56 if (!getargs(args, ""))
57 return NULL;
58
59 return newintobject(TIMINGMS);
60
61}
62static object *
63micro(self, args)
64 object *self;
65 object *args;
66{
67 if (!getargs(args, ""))
68 return NULL;
69
70 return newintobject(TIMINGUS);
71
72}
73
74
75static struct methodlist timing_methods[] = {
76 {"start", start_timing},
77 {"finish", finish_timing},
78 {"seconds", seconds},
79 {"milli", milli},
80 {"micro", micro},
81 {NULL, NULL}
82};
83
84
85void inittiming()
86{
87 object *m;
88
89 m = initmodule("timing", timing_methods);
90
91}