All --
Does anyone object to this going in? Can anyone give me info on
platform compatibility of this? Can we add some check to Configure.pl
to figure out what we can do?
Without objection, I'll commit soon.
Regards,
-- Gregor
_____________________________________________________________________
/ perl -e 'srand(-2091643526); print chr rand 90 for (0..4)' \
Gregor N. Purdy [EMAIL PROTECTED]
Focus Research, Inc. http://www.focusresearch.com/
8080 Beckett Center Drive #203 513-860-3570 vox
West Chester, OH 45069 513-860-3579 fax
\_____________________________________________________________________/
? time.diff
Index: core.ops
===================================================================
RCS file: /home/perlcvs/parrot/core.ops,v
retrieving revision 1.3
diff -a -u -r1.3 core.ops
--- core.ops 2001/10/14 23:47:39 1.3
+++ core.ops 2001/10/15 20:48:12
@@ -74,9 +74,8 @@
=item B<time>(i)
-=item B<time>(n)
-
-Puts the current system time (represented as a number of seconds) in $1.
+Puts the current system time (represented as a whole number of seconds)
+in $1.
=cut
@@ -84,8 +83,20 @@
$1 = time(NULL);
}
+
+########################################
+
+=item B<time>(n)
+
+Puts the current system time (represented as a number of seconds, with
+microseconds) in $1.
+
+=cut
+
AUTO_OP time(n) {
- $1 = (FLOATVAL)time(NULL);
+ struct timeval t;
+ gettimeofday(&t, NULL);
+ $1 = (FLOATVAL)t.tv_sec + ((FLOATVAL)t.tv_usec / 1000000.0);
}
Index: t/test.pasm
===================================================================
RCS file: /home/perlcvs/parrot/t/test.pasm,v
retrieving revision 1.7
diff -a -u -r1.7 test.pasm
--- t/test.pasm 2001/10/15 11:28:09 1.7
+++ t/test.pasm 2001/10/15 20:48:12
@@ -12,60 +12,37 @@
set I3, 1
set I4, 100000000
- print "Iterations: "
- print I4
+ print "Iterations: "
+ print I4
print "\n"
-
- time I1
-
-REDO: eq I2, I4, DONE
- add I2, I2, I3
- branch REDO
-DONE: time I5
-
- print "Start time: "
- print I1
- print "\n"
+ set I1, 3
+ mul I5, I4, I1
- print "End time: "
+ print "Estimated ops: "
print I5
print "\n"
- print "Count: "
- print I2
- print "\n"
-
- sub I2, I5, I1
+ time N1
- print "Elapsed time: "
- print I2
- print "\n"
-
- set I1, 3
- mul I4, I4, I1
- iton N1, I4
- iton N2, I2
-
- print "Estimated ops: "
- print I4
- print "\n"
+REDO: eq I2, I4, DONE
+ add I2, I2, I3
+ branch REDO
- print "Estimated ops (numerically): "
- print N1
- print "\n"
+DONE: time N5
- print "Elapsed time: "
- print I2
- print "\n"
+ sub N2, N5, N1
- print "Elapsed time: "
+ print "Elapsed time: "
print N2
print "\n"
+ iton N1, I5
+ div N1, N1, N2
+ set N2, 1000000.0
div N1, N1, N2
- print "Ops/sec: "
+ print "M op/s: "
print N1
print "\n"