home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lifeos2.zip / LIFE-1.02 / LIB / TIMES.LF < prev    next >
Text File  |  1996-06-04  |  699b  |  33 lines

  1. %    $Id: times.lf,v 1.2 1994/12/09 00:26:05 duchier Exp $    
  2. module("times")?
  3.  
  4.  
  5. public(start_timer,reset_timer,print_timer)?
  6.  
  7.  
  8.  
  9. add_man([start_timer,reset_timer,print_timer],
  10.     "start_timer(?Timer,+String),print_timer(Timer),reset_timer(Timer)
  11.  
  12.          Simple timing utilities.
  13.  
  14.          Example use:
  15.  
  16.              start_timer(X,""CPU time is now:""),
  17.              ...,
  18.              print_timer(X),
  19.              reset_timer(X),
  20.              ...,
  21.              print_timer(X).")?
  22.  
  23.  
  24.  
  25. start_timer(X,S:{"CPU-time: ";string}) :- !,X<<-(cpu_time,S).
  26.  
  27. reset_timer(X) :- X=(@,S),X<<-(cpu_time,S).
  28.  
  29. print_timer(X) :-
  30.     write_err(X.2,M:floor(T:(cpu_time-X.1)/60),"min ",
  31.           floor((T-M*60)*100)/100,"sec"),nl_err.
  32.  
  33.