home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / progjrn / pj_6_1.arc / LISTING3.C < prev    next >
Text File  |  1987-12-28  |  768b  |  21 lines

  1.   /*  Copyright Frank D. Greco, 1987
  2.    *  Page 50, Volume 6.1 Programmer's Journal
  3.    */
  4.   #define DEBUG                   /* Turn on timing statistics */
  5.   
  6.   #define TIX_PER_SEC         18.20648            /* For the PC */
  7.   #define START()             _t1 = gettime()
  8.   #define STOP()              _t2 = gettime()
  9.   #define TIX_DIFF            (_t2 - _t1)
  10.   #define PRINT_TIME(cp)      fprintf(stderr,"%s: %lf secs.\n",\
  11.                                   cp, TIX_DIFF/TIX_PER_SEC)
  12.   
  13.   #ifdef DEBUG
  14.   #   define TIME(code, string)   START(); code; STOP(); PRINT_TIME(string)
  15.   #else
  16.   #   define TIME(code, string)   code
  17.   #endif
  18.   
  19.   
  20.   static long _t1, _t2;           /* Tick values for calc. elapsed time */
  21.