blob: f15b3fdb5ac64e5bccaa5dddd505378656d40502 [file] [log] [blame]
Guido van Rossum116857c1994-01-02 23:22:21 +00001/*
2 *
3 * File: $Id$
4 *
5 * Author: George V. Neville-Neil
6 *
7 * Update History: $Log$
Guido van Rossumcbcd8d71994-01-14 16:55:50 +00008 * Update History: Revision 2.2 1994/01/14 16:55:50 guido
9 * Update History: Make more robust against Minix and Mac
Guido van Rossum116857c1994-01-02 23:22:21 +000010 * Update History:
Guido van Rossumcbcd8d71994-01-14 16:55:50 +000011 * Revision 2.1 1994/01/02 23:22:21 guido
12 * Added George Neville-Neil's timing module
13 *
Guido van Rossum116857c1994-01-02 23:22:21 +000014 * Revision 1.1 93/12/28 13:14:39 gnn
15 * Initial revision
16 *
17 *
18 *
19 *
20 */
21
22#ifndef lint
Guido van Rossumcbcd8d71994-01-14 16:55:50 +000023#ifndef THINK_C
Guido van Rossum116857c1994-01-02 23:22:21 +000024static char rcsid [] = "$Header$" ;
Guido van Rossumcbcd8d71994-01-14 16:55:50 +000025#endif /* THINK_C */
26#endif /* lint */
Guido van Rossum116857c1994-01-02 23:22:21 +000027
28#include "allobjects.h"
29#include "import.h"
30#include "modsupport.h"
31#include "ceval.h"
32
33/* Our stuff... */
34#include "timing.h"
35
36static object *
37start_timing(self, args)
38 object *self;
39 object *args;
40{
41 if (!getargs(args, ""))
42 return NULL;
43
44 INCREF(None);
45 BEGINTIMING;
46 return None;
47}
48
49static object *
50finish_timing(self, args)
51 object *self;
52 object *args;
53{
54 if (!getargs(args, ""))
55 return NULL;
56
57 ENDTIMING
58 INCREF(None);
59 return None;
60}
61
62static object *
63seconds(self, args)
64 object *self;
65 object *args;
66{
67 if (!getargs(args, ""))
68 return NULL;
69
70 return newintobject(TIMINGS);
71
72}
73
74static object *
75milli(self, args)
76 object *self;
77 object *args;
78{
79 if (!getargs(args, ""))
80 return NULL;
81
82 return newintobject(TIMINGMS);
83
84}
85static object *
86micro(self, args)
87 object *self;
88 object *args;
89{
90 if (!getargs(args, ""))
91 return NULL;
92
93 return newintobject(TIMINGUS);
94
95}
96
97
98static struct methodlist timing_methods[] = {
99 {"start", start_timing},
100 {"finish", finish_timing},
101 {"seconds", seconds},
102 {"milli", milli},
103 {"micro", micro},
104 {NULL, NULL}
105};
106
107
108void inittiming()
109{
110 object *m;
111
112 m = initmodule("timing", timing_methods);
113
114}