1: #ifndef lint
   2: static char sccsid[] = "@(#)tick.c	4.2 (Berkeley) 8/11/83";
   3: #endif
   4: 
   5: /* time programs */
   6: # include "stdio.h"
   7: # include "sys/types.h"
   8: # include "sys/timeb.h"
   9: struct tbuffer {
  10:     long    proc_user_time;
  11:     long    proc_system_time;
  12:     long    child_user_time;
  13:     long    child_system_time;
  14: };
  15: static long start, user, system;
  16: tick()
  17: {
  18:     struct tbuffer tx;
  19:     struct timeb tp;
  20:     times (&tx);
  21:     ftime (&tp);
  22:     user =  tx.proc_user_time;
  23:     system= tx.proc_system_time;
  24:     start = tp.time*1000+tp.millitm;
  25: }
  26: tock()
  27: {
  28:     struct tbuffer tx;
  29:     struct timeb tp;
  30:     float lap, use, sys;
  31:     if (start==0) return;
  32:     times (&tx);
  33:     ftime (&tp);
  34:     lap = (tp.time*1000+tp.millitm-start)/1000.;
  35:     use = (tx.proc_user_time - user)/60.;
  36:     sys = (tx.proc_system_time - system)/60.;
  37:     printf("Elapsed %.2f CPU %.2f (user %.2f, sys %.2f)\n",
  38:         lap, use+sys, use, sys);
  39: }

Defined functions

tick defined in line 16; used 1 times
tock defined in line 26; used 1 times

Defined variables

sccsid defined in line 2; never used
start defined in line 15; used 3 times
system defined in line 15; used 2 times
user defined in line 15; used 2 times

Defined struct's

tbuffer defined in line 9; used 4 times
  • in line 18(2), 28(2)
Last modified: 1987-02-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2301
Valid CSS Valid XHTML 1.0 Strict