computation time information



Eric, here is another attempt at tick and tock.
(1) tock returns both run time and real time.
(2) tock returns Maxima rationals.
(3) tick returns [0, 0].

(let ((t0-run-time 0) (t0-real-time 0))

  (defun $tick ()
    (setq t0-run-time (get-internal-run-time))
    (setq t0-real-time (get-internal-real-time))
    '((mlist) 0 0))

  (defun $tock ()
    `((mlist)
      ,(m// (- (get-internal-run-time) t0-run-time)
internal-time-units-per-second)
      ,(m// (- (get-internal-real-time) t0-real-time)
internal-time-units-per-second))))


Example:

(%i1) display2d : false;
(%o1) false
(%i2) load ("./ticktock.lisp");
(%o2) ?\.\/ticktock\.lisp
(%i3) tick ();
(%o3) [0,0]
(%i4) tock ();
(%o4) [0,6435543/1000000]
(%i5) tock ();
(%o5) [0,16459571/1000000]
(%i6) (tick (), factor (exp (1729*x) - 1), tock ());
(%o6) [161/100,201793/125000]
(%i7) ''%, float;
(%o7) [1.61,1.614344]
(%i8) tock ();
(%o8) [161/100,13639803/1000000]
(%i9) ''%, float;
(%o9) [1.61,13.639803]


Hope this helps
Robert Dodier