|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T c
Length: 1338 (0x53a) Types: TextFile Names: »chrono.c«
└─⟦db229ac7e⟧ Bits:30007240 EUUGD20: SSBA 1.2 / AFW Benchmarks └─⟦this⟧ »EUUGD20/AFUU-ssba1.21/ssba1.21F/config/chrono.c«
/* @(#) chrono.c Reecriture de time(1) */ /* * Programme adpate a partir du programme time_a.c de l'EUUGD5 * * Adapatble a un HZ donne (#include hz.h) : * HZ = 50 ou 60 ou 100 * Format de sortie mieux adapte pour l'interpretaion des resultats * sur stderr. * * programme real_time user_time system_time * * Historique : EUUG creation * Philippe Dax modification 7/7/87 */ #include <stdio.h> #include <sys/types.h> #include <sys/times.h> #include "hz.h" main(argc, argv) char **argv; { struct tms tbuffer; long start, stop; int pid, status, ret; char cmd[BUFSIZ]; if (argc == 1) { fprintf(stderr, "Usage: %s command\n", argv[0]); exit (1); } argv[argc] = 0; time(&start); times(&tbuffer); switch (pid = fork()) { case -1: fprintf(stderr, "Can't fork\n"); exit (2); case 0: argv++; execvp(*argv, argv); sleep(1); fprintf(stderr, "not found\n"); exit (3); default: cmd[0] = '\0'; while (*++argv) { strcat(cmd, *argv); strcat(cmd, " "); } strcat(cmd, ": "); fprintf(stderr, "%s", cmd); fflush(stderr); while ((ret = wait(&status)) != pid && ret != -1) ; } times(&tbuffer); time(&stop); fprintf(stderr, "\t%8.2f\t%8.2f\t%8.2f\n", (double) (stop-start), (double) (tbuffer.tms_cutime / (double) HZ), (double) (tbuffer.tms_cstime / (double) HZ) ); exit (0); }