1*9a7741deSElliott Hughes #include <stdio.h>
2*9a7741deSElliott Hughes #include <string.h>
3*9a7741deSElliott Hughes #include <stdlib.h>
4*9a7741deSElliott Hughes #include <sys/types.h>
5*9a7741deSElliott Hughes #include <sys/times.h>
6*9a7741deSElliott Hughes #include <time.h>
7*9a7741deSElliott Hughes
main(int argc,char * argv[])8*9a7741deSElliott Hughes int main(int argc, char *argv[])
9*9a7741deSElliott Hughes {
10*9a7741deSElliott Hughes struct tms before, after;
11*9a7741deSElliott Hughes char cmd[10000];
12*9a7741deSElliott Hughes int i;
13*9a7741deSElliott Hughes double fudge = 100.0; /* should be CLOCKS_PER_SEC but that gives nonsense */
14*9a7741deSElliott Hughes
15*9a7741deSElliott Hughes times(&before);
16*9a7741deSElliott Hughes
17*9a7741deSElliott Hughes /* ... place code to be timed here ... */
18*9a7741deSElliott Hughes cmd[0] = 0;
19*9a7741deSElliott Hughes for (i = 1; i < argc; i++)
20*9a7741deSElliott Hughes sprintf(cmd+strlen(cmd), "%s ", argv[i]);
21*9a7741deSElliott Hughes sprintf(cmd+strlen(cmd), "\n");
22*9a7741deSElliott Hughes /* printf("cmd = [%s]\n", cmd); */
23*9a7741deSElliott Hughes system(cmd);
24*9a7741deSElliott Hughes
25*9a7741deSElliott Hughes times(&after);
26*9a7741deSElliott Hughes
27*9a7741deSElliott Hughes fprintf(stderr, "user %6.3f\n", (after.tms_cutime - before.tms_cutime)/fudge);
28*9a7741deSElliott Hughes fprintf(stderr, "sys %6.3f\n", (after.tms_cstime - before.tms_cstime)/fudge);
29*9a7741deSElliott Hughes
30*9a7741deSElliott Hughes return 0;
31*9a7741deSElliott Hughes }
32