DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T c

⟦66bb4c790⟧ TextFile

    Length: 1338 (0x53a)
    Types: TextFile
    Names: »chrono.c«

Derivation

└─⟦db229ac7e⟧ Bits:30007240 EUUGD20: SSBA 1.2 / AFW Benchmarks
    └─⟦this⟧ »EUUGD20/AFUU-ssba1.21/ssba1.21F/config/chrono.c« 

TextFile

/* @(#) 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);
}