Example #1
0
int
main(int ac, char **av)
{
	int	i;
	int	c;
	int	parallel = 1;
	int	warmup = 0;
	int	repetitions = TRIES;
        size_t	len;
	size_t	range;
	size_t	stride;
	char   *usage = "[-P <parallelism>] [-W <warmup>] [-N <repetitions>] [-t] len [stride...]\n";

	while (( c = getopt(ac, av, "tP:W:N:")) != EOF) {
		switch(c) {
		case 't':
			fpInit = thrash_initialize;
			break;
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0) lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}
	if (optind == ac) {
		lmbench_usage(ac, av, usage);
	}

        len = atoi(av[optind]);
	len *= 1024 * 1024;

	if (optind == ac - 1) {
		fprintf(stderr, "\"stride=%d\n", (int)STRIDE);
		for (range = LOWER; range <= len; range = step(range)) {
			loads(len, range, STRIDE, parallel, 
			      warmup, repetitions);
		}
	} else {
		for (i = optind + 1; i < ac; ++i) {
			stride = bytes(av[i]);
			fprintf(stderr, "\"stride=%d\n", (int)stride);
			for (range = LOWER; range <= len; range = step(range)) {
				loads(len, range, stride, parallel, 
				      warmup, repetitions);
			}
			fprintf(stderr, "\n");
		}
	}
	return(0);
}
Example #2
0
int main(int ac, char **av)
{
	int parallel = 1;
	int warmup = 0;
	int repetitions = TRIES;
	char	*usage = "-s\n OR [-P <parallelism>] [-W <warmup>] [-N <repetitions>]\n OR -S\n";
	int	c;

	/* Start the server "-s" or Shut down the server "-S" */
	if (ac == 2) {
		if (!strcmp(av[1], "-s")) {
#ifdef CONFIG_NOMMU
			if (fork() == 0) {
				server_main();
				_exit(0);
			}
#else
			if (fork() == 0) {
				server_main();
			}
#endif
			exit(0);
		}
		if (!strcmp(av[1], "-S")) {
			int sock = unix_connect(CONNAME);
			write(sock, "0", 1);
			close(sock);
			exit(0);
		}
	}

	/*
	 * Rest is client
	 */
	while (( c = getopt(ac, av, "P:W:N:")) != EOF) {
		switch(c) {
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0) lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}

	if (optind != ac) {
		lmbench_usage(ac, av, usage);
	}

	benchmp(NULL, benchmark, NULL, 0, parallel, warmup, repetitions, NULL);
	micro("UNIX connection cost", get_n());
}
Example #3
0
int
main(int argc, char *argv[])
{
	struct _state state;
	int parallel = 1;
	int warmup = 0;
	int repetitions = TRIES;
	int c;
	char* usage = "[-m <message size>] [-M <total bytes>] [-P <parallelism>] [-W <warmup>] [-N <repetitions>]\n";

	state.xfer = XFERSIZE;	/* per-packet size */
	state.bytes = XFER;	/* total bytes per call */

	while (( c = getopt(argc,argv,"m:M:P:W:N:")) != EOF) {
		switch(c) {
		case 'm':
			state.xfer = bytes(optarg);
			break;
		case 'M':
			state.bytes = bytes(optarg);
			break;
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0) lmbench_usage(argc, argv, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(argc, argv);
			break;
		}
	}
	if (optind == argc - 1) {
		state.bytes = bytes(argv[optind]);
	} else if (optind < argc - 1) {
		lmbench_usage(argc, argv);
	}

	state.pid = 0;

	/* round up total byte count to a multiple of xfer */
	if (state.bytes % state.xfer) {
		state.bytes += state.bytes - state.bytes % state.xfer;
	}

	benchmp(initialize, reader, cleanup, MEDIUM, parallel, 
		warmup, repetitions, &state);

	if (gettime() > 0) {
		fprintf(stderr, "AF_UNIX sock stream bandwidth: ");
		mb(get_n() * parallel * XFER);
	}
	return(0);
}
Example #4
0
int
main(int ac, char **av)
{
	int i;
	int parallel = 1;
	int warmup = 0;
	int repetitions = TRIES;
	static	int	sizes[] = { 0, 1024, 4096, 10*1024 };
	struct _state state;
	int c;
	char* usage = "[-s <file size>] [-n <max files per dir>] [-P <parallelism>] [-W <warmup>] [-N <repetitions>] [<dir>]\n";

	state.size = 0;
	state.max = 100;
	state.tmpdir = NULL;

	while (( c = getopt(ac, av, "s:n:P:W:N:")) != EOF) {
		switch(c) {
		case 's':
			state.size = bytes(optarg);
			break;
		case 'n':
			state.max = bytes(optarg);
			break;
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0) lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}
	if (optind < ac - 1) {
		lmbench_usage(ac, av, usage);
	}
	if (optind == ac - 1) {
		state.tmpdir = av[1];
	}

	if (state.size) {
		measure(state.size, parallel, warmup, repetitions, &state);
	} else {
		for (i = 0; i < sizeof(sizes)/sizeof(int); ++i) {
			state.size = sizes[i];
			measure(state.size, 
				parallel, warmup, repetitions, &state);
		}
	}
	return(0);
}
Example #5
0
int
main(int ac, char **av)
{
	int parallel = 1;
	int warmup = 0;
	int repetitions = -1;
	int c;
	char* usage = "[-P <parallelism>] [-W <warmup>] [-N <repetitions>] procedure|fork|exec|shell\n";

	while (( c = getopt(ac, av, "P:W:N:")) != EOF) {
		switch(c) {
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0) lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}

	if (optind + 1 != ac) { /* should have one argument left */
		lmbench_usage(ac, av, usage);
	}

	if (!strcmp("procedure", av[optind])) {
		benchmp(NULL, do_procedure, cleanup, 0, parallel, 
			warmup, repetitions, &ac);
		micro("Procedure call", get_n());
	} else if (!strcmp("fork", av[optind])) {
		benchmp(NULL, do_fork, cleanup, 0, parallel, 
			warmup, repetitions, NULL);
		micro(STATIC_PREFIX "Process fork+exit", get_n());
	} else if (!strcmp("exec", av[optind])) {
		benchmp(NULL, do_forkexec, cleanup, 0, parallel,
			warmup, repetitions, NULL);
		micro(STATIC_PREFIX "Process fork+execve", get_n());
	} else if (!strcmp("shell", av[optind])) {
		benchmp(NULL, do_shell, cleanup, 0, parallel,
			warmup, repetitions, NULL);
		micro(STATIC_PREFIX "Process fork+/bin/sh -c", get_n());
	} else {
		lmbench_usage(ac, av, usage);
	}
	return(0);
}
int
main(int ac, char **av)
{
	state_t state;
	int rc, c, repetitions = -1, warmup = 0;
	char	buf[256];
	char	*usage = "-s\n OR [-S] [-W <warmup>] [-N <repetitions>] server\n";

	while (( c = getopt(ac, av, "sSP:W:N:")) != EOF) {
		switch(c) {
		case 's': /* Server */
			if (fork() == 0) {
				server_main();
			}
			exit(0);
		case 'S': /* shutdown serverhost */
		{
			int sock = tcp_connect(av[optind],
					       TCP_CONNECT,
					       SOCKOPT_NONE);
			rc = write(sock, "0", 1);
			if (rc < 0)
				DIE_PERROR("write failed");
			close(sock);
			exit(0);
		}
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}

	if (optind + 1 != ac) {
		lmbench_usage(ac, av, usage);
	}

	handle_scheduler(benchmp_childid(), 0, 0);

	state.server = av[optind];
	benchmp(NULL, doclient, NULL, 0, 1, warmup, repetitions, &state);

	sprintf(buf, "TCP/IP connection cost to %s", state.server);
	micro(buf, get_n());
	exit(0);
}
int 
main(int ac, char **av)
{
	state_t state;
	int parallel = 1;
	int warmup = 0;
	int repetitions = -1;
	int c;
	double time;
	uint64	usecs;
	char buf[1024];
	char* usage = "[-P <parallelism>] [-W <warmup>] [-N <repetitions>] Njobs usecs...\n";

	while (( c = getopt(ac, av, "P:W:N:")) != EOF) {
		switch(c) {
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0) lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}
	if (ac < optind + 2) {
		lmbench_usage(ac, av, usage);
	}
	state.jobs = atoi(av[optind]);
	state.pids = NULL;
	fprintf(stderr, "\"pmake jobs=%d\n", state.jobs);
	while (++optind < ac) {
		usecs = bytes(av[optind]);
		benchmp(setup, work, NULL, 0, 1, 0, TRIES, &state);
		if (gettime() == 0) exit(1);
		state.iterations = (iter_t)((usecs * get_n()) / gettime());

		benchmp(setup, bench, NULL, 0, parallel, 
			warmup, repetitions, &state);
		time = gettime();
		time /= get_n();
		if (time > 0.0)
			fprintf(stderr, "%llu %.2f\n", usecs, time);
	}
	return (0);
}
Example #8
0
int 
main(int ac, char **av)
{
	int parallel = 1;
	int warmup = 0;
	int repetitions = TRIES;
	int c;
	char* usage = "[-P <parallelism>] [-W <warmup>] [-N <repetitions>]\n";

	while (( c = getopt(ac, av, "P:W:N:")) != EOF) {
		switch(c) {
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0) lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}
	if (optind < ac) {
		lmbench_usage(ac, av, usage);
	}

#ifdef HAVE_DRAND48
	benchmp(NULL, bench_drand48, NULL,
		0, parallel, warmup, repetitions, NULL);
	nano("drand48 latency", get_n());

	benchmp(NULL, bench_lrand48, NULL,
		0, parallel, warmup, repetitions, NULL);
	nano("lrand48 latency", get_n());
#endif
#ifdef HAVE_RAND
	benchmp(NULL, bench_rand, NULL,
		0, parallel, warmup, repetitions, NULL);
	nano("rand latency", get_n());
#endif
#ifdef HAVE_RANDOM
	benchmp(NULL, bench_random, NULL,
		0, parallel, warmup, repetitions, NULL);
	nano("random latency", get_n());
#endif
	return (0);
}
Example #9
0
int
main(int ac, char **av)
{
	int parallel = 1;
	int warmup = 0;
	int repetitions = TRIES;
	int c;
	char* usage = "[-P <parallelism>] [-W <warmup>] [-N <repetitions>] install|catch|prot [file]\n";

	while (( c = getopt(ac, av, "P:W:N:")) != EOF) {
		switch(c) {
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0) lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}
	if (optind != ac - 1 && optind != ac - 2) {
		lmbench_usage(ac, av, usage);
	}

	if (!strcmp("install", av[optind])) {
		benchmp(NULL, do_install, NULL, 0, parallel, 
			warmup, repetitions, NULL);
		micro("Signal handler installation", get_n());
	} else if (!strcmp("catch", av[optind])) {
		bench_catch(parallel, warmup, repetitions);
		micro("Signal handler overhead", get_n());
	} else if (!strcmp("prot", av[optind]) && optind == ac - 2) {
		bench_prot(av[optind+1], parallel, warmup, repetitions);
		micro("Protection fault", get_n());
	} else {
		lmbench_usage(ac, av, usage);
	}
	return(0);
}
Example #10
0
int 
main(int ac, char **av)
{
	int c;
	int i;
	int parallel = 1;
	int warmup = 0;
	int repetitions = TRIES;
	char buf[1024];
	state_t state;
	char* usage = "[-P <parallelism>] [-W <warmup>] [-N <repetitions>] cmdline...\n";

	while (( c = getopt(ac, av, "P:W:N:")) != EOF) {
		switch(c) {
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0) lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}
	if (optind >= ac) {
		lmbench_usage(ac, av, usage);
	}
	state.argv = (char**)malloc((ac - optind + 1) * sizeof(char*));
	state.pid = 0;
	for (i = 0; i < ac - optind; ++i) {
		state.argv[i] = av[optind + i];
	}
	state.argv[i] = NULL;

	benchmp(NULL, bench, NULL, 0, parallel, warmup, repetitions, &state);
	micro("lat_cmd", get_n());
	return (0);
}
Example #11
0
int
main(int ac, char **av)
{
	int parallel = 1;
	int warmup = 0;
	int repetitions = -1;
	struct _state state;
	int c;
	char* usage = "[-m <message size>] [-P <parallelism>] [-W <warmup>] [-N <repetitions>]\n";

	state.msize = 1;
	state.pid = 0;

	while (( c = getopt(ac, av, "m:P:W:N:")) != EOF) {
		switch(c) {
		case 'm':
			state.msize = atoi(optarg);
			break;
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0) lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}
	if (optind < ac) {
		lmbench_usage(ac, av, usage);
	}

	benchmp(initialize, benchmark, cleanup, 0, parallel, 
		warmup, repetitions, &state);

	micro("AF_UNIX sock stream latency", get_n());
	return(0);
}
Example #12
0
/*
 * Assumptions:
 *
 * 1) Cache lines are a multiple of pointer-size words
 * 2) Cache lines are no larger than 1/8 of a page (typically 512 bytes)
 * 3) Pages are an even multiple of cache lines
 */
int
main(int ac, char **av)
{
	int	i;
	int	c;
	int	warmup = 0;
	int	repetitions = TRIES;
	int	print_cost = 0;
	size_t	len;
	size_t	maxlen = 64 * 1024 * 1024;
	double	par;
	struct mem_state state;
	char   *usage = "[-c] [-L <line size>] [-M len[K|M]] [-W <warmup>] [-N <repetitions>]\n";

	state.line = getpagesize() / 16;
	state.pagesize = getpagesize();

	while (( c = getopt(ac, av, "cL:M:W:N:")) != EOF) {
		switch(c) {
		case 'c':
			print_cost = 1;
			break;
		case 'L':
			state.line = atoi(optarg);
			if (state.line < sizeof(char*))
				state.line = sizeof(char*);
			break;
		case 'M':
			maxlen = bytes(optarg);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}

	for (i = MAX_MEM_PARALLELISM * state.line; i <= maxlen; i<<=1) { 
		par = par_mem(i, warmup, repetitions, &state);

		if (par > 0.) {
			fprintf(stderr, "%.6f %.2f\n", 
				i / (1000. * 1000.), par);
		}
	}

	exit(0);
}
Example #13
0
int 
main(int ac, char **av)
{
	state_t state;
	int parallel = 1;
	int warmup = 0;
	int repetitions = TRIES;
	int c;
	char* usage = "[-P <parallelism>] [-W <warmup>] [-N <repetitions>]\n";

	while (( c = getopt(ac, av, "P:W:N:")) != EOF) {
		switch(c) {
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0) lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}
	if (optind < ac) {
		lmbench_usage(ac, av, usage);
	}

	state.pid = 0;

	benchmp(initialize, doit, cleanup, SHORT, parallel, 
		warmup, repetitions, &state);
	micro("Pipe latency", get_n());
	return (0);
}
int
main(int ac, char **av)
{
	int	maxlen = 64 * 1024 * 1024;
	int	warmup = 0;
	int	repetitions = -1;
	int	c;
	struct dram_page_state state;
	double	dram_hit, dram_miss;
	char   *usage = "[-v] [-W <warmup>] [-N <repetitions>][-M len[K|M]]\n";

	state.mstate.width = 1;
	state.mstate.line = sizeof(char*);
	state.mstate.pagesize = getpagesize();
	state.group = 16;

	while (( c = getopt(ac, av, "aL:T:M:W:N:")) != EOF) {
		switch(c) {
		case 'L':
			state.mstate.line = bytes(optarg);
			break;
		case 'T':
			state.group = bytes(optarg);
			break;
		case 'M':
			maxlen = bytes(optarg);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}

	dram_hit = loads(mem_initialize, maxlen, warmup, repetitions, &state);
	dram_miss = loads(dram_page_initialize, maxlen, warmup, repetitions, &state);

	if (dram_hit < 0.95 * dram_miss) {
		fprintf(stderr, "%f\n", dram_miss - dram_hit);
	} else {
		fprintf(stderr, "0.0\n");
	}

	return (0);
}
Example #15
0
/*
 * Assumptions:
 *
 * 1) Cache lines are a multiple of pointer-size words
 * 2) Cache lines are no larger than 1/4 a page size
 * 3) Pages are an even multiple of cache lines
 */
int
main(int ac, char **av)
{
	int	i, j, l;
	int	verbose = 0;
	int	warmup = 0;
	int	repetitions = TRIES;
	int	c;
	size_t	maxlen = 64 * 1024 * 1024;
	struct mem_state state;
	char   *usage = "[-v] [-W <warmup>] [-N <repetitions>][-M len[K|M]]\n";

	state.line = sizeof(char*);
	state.pagesize = getpagesize();

	while (( c = getopt(ac, av, "avM:W:N:")) != EOF) {
		switch(c) {
		case 'v':
			verbose = 1;
			break;
		case 'M':
			maxlen = bytes(optarg);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}

	if ((l = line_find(maxlen, warmup, repetitions, &state)) > 0) {
		if (verbose) {
			printf("cache line size: %d bytes\n", l);
		} else {
			printf("%d\n", l);
		}
	}

	return (0);
}
Example #16
0
int
main(int ac, char **av)
{
	state_t state;
	int parallel = 1;
	int warmup = 0;
	int repetitions = -1;
	int c;
	char* usage = "[-n <#descriptors>] [-P <parallelism>] [-W <warmup>] [-N <repetitions>] file|tcp\n";
	char	buf[256];

	morefds();  /* bump fd_cur to fd_max */
	state.num = 200;
	while (( c = getopt(ac, av, "P:W:N:n:")) != EOF) {
		switch(c) {
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0) lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		case 'n':
			state.num = bytes(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}

	if (optind + 1 != ac) {
		lmbench_usage(ac, av, usage);
	}

	if (streq("tcp", av[optind])) {
		state.fid_f = open_socket;
		server(&state);
		benchmp(initialize, doit, cleanup, 0, parallel, 
			warmup, repetitions, &state);
		sprintf(buf, "Select on %d tcp fd's", state.num);
		kill(state.pid, SIGKILL);
		waitpid(state.pid, NULL, 0);
		micro(buf, get_n());
	} else if (streq("file", av[optind])) {
		state.fid_f = open_file;
		server(&state);
		benchmp(initialize, doit, cleanup, 0, parallel, 
			warmup, repetitions, &state);
		unlink(state.fname);
		sprintf(buf, "Select on %d fd's", state.num);
		micro(buf, get_n());
	} else {
		lmbench_usage(ac, av, usage);
	}

	exit(0);
}
Example #17
0
int
main(int ac, char **av)
{
	int	i, maxprocs;
	int	c;
	int	parallel = 1;
	int	warmup = 0;
	int	repetitions = -1;
	struct _state state;
	char *usage = "[-P <parallelism>] [-W <warmup>] [-N <repetitions>] [-s kbytes] processes [processes ...]\n";
	double	time;

	/*
	 * Need 4 byte ints.
	 */
	if (sizeof(int) != 4) {
		fprintf(stderr, "Fix sumit() in ctx.c.\n");
		exit(1);
	}

	state.process_size = 0;
	state.overhead = 0.0;
	state.pids = NULL;

	/*
	 * If they specified a context size, or parallelism level, get them.
	 */
	while (( c = getopt(ac, av, "s:P:W:N:")) != EOF) {
		switch(c) {
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0) lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		case 's':
			state.process_size = atoi(optarg) * 1024;
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}

	if (optind > ac - 1)
		lmbench_usage(ac, av, usage);

	/* compute pipe + sumit overhead */
	maxprocs = atoi(av[optind]);
	for (i = optind; i < ac; ++i) {
		state.procs = atoi(av[i]);
		if (state.procs > maxprocs)
			maxprocs = state.procs;
	}
	state.procs = maxprocs;
	benchmp(initialize_overhead, benchmark_overhead, cleanup_overhead, 
		0, 1, warmup, repetitions, &state);
	if (gettime() == 0) return(0);
	state.overhead = gettime();
	state.overhead /= get_n();
	fprintf(stderr, "\n\"size=%dk ovr=%.2f\n", 
		state.process_size/1024, state.overhead);

	/* compute the context switch cost for N processes */
	for (i = optind; i < ac; ++i) {
		state.procs = atoi(av[i]);
		benchmp(initialize, benchmark, cleanup, 0, parallel, 
			warmup, repetitions, &state);

		time = gettime();
		time /= get_n();
		time /= state.procs;
		time -= state.overhead;

		if (time > 0.0)
			fprintf(stderr, "%d %.2f\n", state.procs, time);
	}

	return (0);
}
Example #18
0
int
main(int ac, char **av)
{
	int	parallel = 1;
	int	warmup = LONGER;
	int	repetitions = -1;
	int	shutdown = 0;
	state_t state;
	char	*usage = "-s\n OR [-m <message size>] [-M <bytes to move>] [-P <parallelism>] [-W <warmup>] [-N <repetitions>] server\n OR -S serverhost\n";
	int	c;
	
	state.msize = 0;
	state.move = 0;

	/* Rest is client argument processing */
	while (( c = getopt(ac, av, "sS:m:M:P:W:N:")) != EOF) {
		switch(c) {
		case 's': /* Server */
			if (fork() == 0) {
				server_main();
			}
			exit(0);
			break;
		case 'S': /* shutdown serverhost */
		{
			int	conn;
			conn = tcp_connect(optarg, TCP_DATA, SOCKOPT_NONE);
			write(conn, "0", 1);
			exit(0);
		}
		case 'm':
			state.msize = bytes(optarg);
			break;
		case 'M':
			state.move = bytes(optarg);
			break;
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0) lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}

	if (optind < ac - 2 || optind >= ac) {
		lmbench_usage(ac, av, usage);
	}

	state.server = av[optind++];

	if (state.msize == 0 && state.move == 0) {
		state.msize = state.move = XFERSIZE;
	} else if (state.msize == 0) {
		state.msize = state.move;
	} else if (state.move == 0) {
		state.move = state.msize;
	}

	/* make the number of bytes to move a multiple of the message size */
	if (state.move % state.msize) {
		state.move += state.msize - state.move % state.msize;
	}

	/*
	 * Default is to warmup the connection for seven seconds, 
	 * then measure performance over each timing interval.
	 * This minimizes the effect of opening and initializing TCP 
	 * connections.
	 */
	benchmp(initialize, loop_transfer, cleanup, 
		0, parallel, warmup, repetitions, &state);
	if (gettime() > 0) {
		fprintf(stderr, "%.6f ", state.msize / (1000. * 1000.));
		mb(state.move * get_n() * parallel);
	}
	return(0);
}
Example #19
0
int
main(int ac, char **av)
{
	int	parallel = 1;
	int	warmup = 0;
	int	repetitions = -1;
	int	server = 0;
	state_t state;
	char	*usage = "-s\n OR [-m <message size>] [-W <warmup>] [-N <repetitions>] server [size]\n OR -S serverhost\n";
	int	c;
	uint64	usecs;
	
	state.msize = 0;
	state.move = 10*1024*1024;

	/* Rest is client argument processing */
	while (( c = getopt(ac, av, "sS:m:W:N:")) != EOF) {
		switch(c) {
		case 's': /* Server */
#ifdef CONFIG_NOMMU
			if (vfork() == 0) {
				server_main();
				_exit(0);
			}
#else
			if (fork() == 0) {
				server_main();
			}
#endif
			exit(0);
		case 'S': /* shutdown serverhost */
		{
			int seq, n;
			int sock = udp_connect(optarg,
					       UDP_XACT,
					       SOCKOPT_NONE);
			for (n = -1; n > -5; --n) {
				seq = htonl(n);
				(void) send(sock, &seq, sizeof(int), 0);
			}
			close(sock);
			exit (0);
		}
		case 'm':
			state.msize = atoi(optarg);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}

	if (optind < ac - 2 || optind >= ac) {
		lmbench_usage(ac, av, usage);
	}

	state.server = av[optind++];
	if (optind < ac) {
		state.move = bytes(av[optind]);
	}
	if (state.msize == 0) {
		state.msize = state.move;
	}
	/* make the number of bytes to move a multiple of the message size */
	if (state.move % state.msize) {
		state.move += state.move - state.move % state.msize;
	}

	state.buf = valloc(state.msize);
	if (!state.buf) {
		perror("valloc");
		exit(1);
	}
	touch(state.buf, state.msize);

	/*
	 * Make one run take at least 5 seconds.
	 * This minimizes the effect of connect & reopening TCP windows.
	 */
	benchmp(init, loop_transfer, cleanup, LONGER, parallel, warmup, repetitions, &state );

out:	(void)fprintf(stderr, "socket UDP bandwidth using %s: ", state.server);
	mb(state.move * get_n() * parallel);
}
Example #20
0
int
main(int ac, char **av)
{
	int parallel = 1;
	int warmup = 0;
	int repetitions = TRIES;
	int c;
	struct _state state;
	char* usage = "[-P <parallelism>] [-W <warmup>] [-N <repetitions>] null|read|write|stat|fstat|open [file]\n";

	while (( c = getopt(ac, av, "P:W:N:")) != EOF) {
		switch(c) {
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0) lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}
	if (optind != ac - 1 && optind != ac - 2 ) {
		lmbench_usage(ac, av, usage);
	}
	
	state.file = FNAME;
	if (optind == ac - 2) 
		state.file = av[optind + 1];

	if (!strcmp("null", av[optind])) {
		benchmp(NULL, do_getppid, NULL, 0, parallel, 
			warmup, repetitions, &state);
		micro("Simple syscall", get_n());
	} else if (!strcmp("write", av[optind])) {
		state.fd = open("/dev/null", 1);
		benchmp(NULL, do_write, NULL, 0, parallel, 
			warmup, repetitions, &state);
		micro("Simple write", get_n());
		close(state.fd);
	} else if (!strcmp("read", av[optind])) {
		state.fd = open("/dev/zero", 0);
		if (state.fd == -1) {
			fprintf(stderr, "Simple read: -1\n");
			return(1);
		}
		benchmp(NULL, do_read, NULL, 0, parallel, 
			warmup, repetitions, &state);
		micro("Simple read", get_n());
		close(state.fd);
	} else if (!strcmp("stat", av[optind])) {
		benchmp(NULL, do_stat, NULL, 0, parallel, 
			warmup, repetitions, &state);
		micro("Simple stat", get_n());
	} else if (!strcmp("fstat", av[optind])) {
		state.fd = open(state.file, 0);
		benchmp(NULL, do_fstat, NULL, 0, parallel, 
			warmup, repetitions, &state);
		micro("Simple fstat", get_n());
		close(state.fd);
	} else if (!strcmp("open", av[optind])) {
		benchmp(NULL, do_openclose, NULL, 0, parallel, 
			warmup, repetitions, &state);
		micro("Simple open/close", get_n());
	} else {
		lmbench_usage(ac, av, usage);
	}
	return(0);
}
int
main(int ac, char **av)
{
	int	fd;
	state_t state;
	int	parallel = 1;
	int	warmup = 0;
	int	repetitions = -1;
	int	c;
	char	usage[1024];

	sprintf(usage,"[-C] [-P <parallelism>] [-W <warmup>] [-N <repetitions>]"
		" [-D <path>] [-I isolate_paths ] [-U uid/gid] \n"
		" [-L <lock_uid>] [-w <open for write>] <filename>\n");

	state.clone = 0;
	state.write = 1;
	state.lock_uid = 0;
	while (( c = getopt(ac, av, "P:W:N:L:D:CIUw")) != EOF) {
		switch(c) {
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0) lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		case 'L':
			state.lock_uid = atoi(optarg);
			break;
		case 'D':
			strcpy(state.path, optarg);
			break;
		case 'C':
			state.clone = 1;
			break;
		case 'I':
			state.isolate = 1;
			break;
		case 'U':
			state.use_uid = 1;
			break;
		case 'w':
			state.write = 1;
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}

	if (optind + 1 != ac) { /* should have three arguments left */
		lmbench_usage(ac, av, usage);
	}

	strcpy(state.filename,av[optind]);
	benchmp(initialize, time_with_loop, cleanup,
			0, parallel, warmup, repetitions, &state);

	mili_op("res ", get_n(), parallel);
	return (0);
}
Example #22
0
int
main(int ac, char **av)
{
	state_t state;
	int	parallel = 1;
	int	warmup = 0;
	int	repetitions = TRIES;
	int 	c;
	char	buf[256];
	char	*usage = "-s\n OR [-m <message size>] [-P <parallelism>] [-W <warmup>] [-N <repetitions>] server\n OR -S server\n";

	state.msize = 1;

	while (( c = getopt(ac, av, "sS:m:P:W:N:")) != EOF) {
		switch(c) {
		case 's': /* Server */
#ifdef CONFIG_NOMMU
			server_main();
#else
			if (fork() == 0) {
				server_main();
			}
#endif
			exit(0);
		case 'S': /* shutdown serverhost */
			state.sock = tcp_connect(optarg,
						 TCP_XACT,
						 SOCKOPT_NONE);
			close(state.sock);
			exit(0);
		case 'm':
			state.msize = atoi(optarg);
			break;
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0)
				lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}

	if (optind != ac - 1) {
		lmbench_usage(ac, av, usage);
	}

	state.server = av[optind];
	benchmp(init, doclient, cleanup, MEDIUM, parallel, 
		warmup, repetitions, &state);

	sprintf(buf, "TCP latency using %s", state.server);
	micro(buf, get_n());

	exit(0);
}
int main(int ac, char **av)
{
    int             realtime = 0;
    int		    parallel = 1;
    int             warmup = 0;
    int             repetitions = -1;
    int             c;
    char            buf[512];
    timer_e	    what = USLEEP;
    state_t         state;
    char           *scheduler = "";
    char           *mechanism = "usleep";
    char           *usage = "[-r] [-u <method>] [-P <parallelism>] [-W <warmup>] [-N <repetitions>] usecs\nmethod=usleep|nanosleep|select|pselect|itimer\n";

    realtime = 0;

    while ((c = getopt(ac, av, "ru:W:N:")) != EOF) {
	switch (c) {
	case 'r':
	    realtime = 1;
	    break;
	case 'u':
	    if (strcmp(optarg, "usleep") == 0) {
		what = USLEEP;
		mechanism = "usleep";
	    } else if (strcmp(optarg, "nanosleep") == 0) {
		what = NANOSLEEP;
		mechanism = "nanosleep";
	    } else if (strcmp(optarg, "select") == 0) {
		what = SELECT;
		mechanism = "select";
#ifdef _POSIX_SELECT
	    } else if (strcmp(optarg, "pselect") == 0) {
		what = PSELECT;
		mechanism = "pselect";
#endif /* _POSIX_SELECT */
	    } else if (strcmp(optarg, "itimer") == 0) {
		what = ITIMER;
		mechanism = "itimer";
	    } else {
		lmbench_usage(ac, av, usage);
	    }
	    break;
	case 'P':
	    parallel = atoi(optarg);
	    if (parallel <= 0) lmbench_usage(ac, av, usage);
	    break;
	case 'W':
	    warmup = atoi(optarg);
	    break;
	case 'N':
	    repetitions = atoi(optarg);
	    break;
	default:
	    lmbench_usage(ac, av, usage);
	    break;
	}
    }
    if (optind != ac - 1) {
	lmbench_usage(ac, av, usage);
    }

    state.usecs = bytes(av[optind]);
    if (realtime && set_realtime()) scheduler = "realtime ";

    switch (what) {
    case USLEEP:
	benchmp(NULL, bench_usleep, NULL, 
		0, parallel, warmup, repetitions, &state);
	break;
    case NANOSLEEP:
	benchmp(NULL, bench_nanosleep, NULL, 
		0, parallel, warmup, repetitions, &state);
	break;
    case SELECT:
	benchmp(NULL, bench_select, NULL, 
		0, parallel, warmup, repetitions, &state);
	break;
#ifdef _POSIX_SELECT
    case PSELECT:
	benchmp(NULL, bench_pselect, NULL, 
		0, parallel, warmup, repetitions, &state);
	break;
#endif /* _POSIX_SELECT */
    case ITIMER:
	benchmp(initialize, bench_itimer, NULL, 
		0, parallel, warmup, repetitions, &state);
	break;
    default:
	lmbench_usage(ac, av, usage);
	break;
    }
    sprintf(buf, "%s%s %lu microseconds", scheduler, mechanism, state.usecs);
    micro(buf, get_n());
    return (0);
}
Example #24
0
int
main(int ac, char **av)
{
	state_t state;
	int	c;
	int	parallel = 1;
	int	warmup = 0;
	int	repetitions = TRIES;
	int	msize = 4;
 	char	buf[256];
	char	*usage = "-s\n OR [-S] [-m <message size>] [-P <parallelism>] [-W <warmup>] [-N <repetitions>] server\n NOTE: message size must be >= 4\n";

	if (sizeof(int) != 4) {
		fprintf(stderr, "lat_udp: Wrong sequence size\n");
		return(1);
	}

	while (( c = getopt(ac, av, "sS:m:P:W:N:")) != EOF) {
		switch(c) {
		case 's': /* Server */
			if (fork() == 0) {
				server_main();
			}
			exit(0);
		case 'S': /* shutdown serverhost */
		{
			int seq, n;
			int sock = udp_connect(optarg,
					       UDP_XACT,
					       SOCKOPT_NONE);
			for (n = -1; n > -5; --n) {
				seq = htonl(n);
				(void) send(sock, &seq, sizeof(int), 0);
			}
			close(sock);
			exit (0);
		}
		case 'm':
			msize = atoi(optarg);
			if (msize < sizeof(int)) {
				lmbench_usage(ac, av, usage);
				msize = 4;
			}
			if (msize > MAX_MSIZE) {
				lmbench_usage(ac, av, usage);
				msize = MAX_MSIZE;
			}
			break;
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0)
				lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}

	if (optind + 1 != ac) {
		lmbench_usage(ac, av, usage);
	}

	state.server = av[optind];
	state.msize = msize;
	benchmp(init, doit, cleanup, SHORT, parallel, 
		warmup, repetitions, &state);
	sprintf(buf, "UDP latency using %s", state.server);
	micro(buf, get_n());
	exit(0);
}
Example #25
0
int
main(int ac, char **av)
{
	int	fd;
	struct	stat sbuf;
	void	*buf;
	int	parallel = 1;
	int	warmup = 0;
	int	repetitions = TRIES;
	size_t	nbytes;
	state_t	state;
	int	c;
	char	*usage = "[-C] [-P <parallelism>] [-W <warmup>] [-N <repetitions>] <size> open2close|mmap_only <filename>";

	state.clone = 0;

	while (( c = getopt(ac, av, "P:W:N:C")) != EOF) {
		switch(c) {
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0) lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		case 'C':
			state.clone = 1;
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}

	/* should have three arguments left (bytes type filename) */
	if (optind + 3 != ac) {
		lmbench_usage(ac, av, usage);
	}

	nbytes = state.nbytes = bytes(av[optind]);
	strcpy(state.filename,av[optind+2]);
	CHK(stat(state.filename, &sbuf));
	if ((S_ISREG(sbuf.st_mode) && nbytes > sbuf.st_size) 
	    || (nbytes < MINSZ)) {
		fprintf(stderr,"<size> out of range!\n");
		exit(1);
	}

	if (!strcmp("open2close", av[optind+1])) {
		benchmp(initialize, time_with_open, cleanup,
			0, parallel, warmup, repetitions, &state);
	} else if (!strcmp("mmap_only", av[optind+1])) {
		benchmp(init_open, time_no_open, cleanup,
			0, parallel, warmup, repetitions, &state);
	} else {
		lmbench_usage(ac, av, usage);
	}
	bandwidth(nbytes, get_n() * parallel, 0);
	return (0);
}
Example #26
0
int
main(int ac, char **av)
{
	int 	c;
	int	parallel = 1;
	int	warmup = 0;
	int	repetitions = -1;
	state_t	state;
	CLIENT	*cl;
	char	buf[1024];
	char	*protocol = NULL;
	char	*usage = "-s\n OR [-p <tcp|udp>] [-P parallel] [-W <warmup>] [-N <repetitions>] serverhost\n OR -S serverhost\n";

	state.msize = 1;
	state.server = NULL;

	while (( c = getopt(ac, av, "sS:m:p:P:W:N:")) != EOF) {
		switch(c) {
		case 's': /* Server */
			if (fork() == 0) {
				server_main();
			}
			exit(0);
		case 'S': /* shutdown serverhost */
		{
			cl = clnt_create(optarg, XACT_PROG, XACT_VERS, "udp");
			if (!cl) {
				clnt_pcreateerror(state.server);
				exit(1);
			}
			clnt_call(cl, RPC_EXIT, (xdrproc_t)xdr_void, 0, 
				  (xdrproc_t)xdr_void, 0, TIMEOUT);
			exit(0);
		}
		case 'm':
			state.msize = atoi(optarg);
			break;
		case 'p':
			protocol = optarg;
			break;
		case 'P':
			parallel = atoi(optarg);
			if (parallel <= 0)
				lmbench_usage(ac, av, usage);
			break;
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}

	if (optind != ac - 1) {
		lmbench_usage(ac, av, usage);
	}

	state.server = av[optind++];

	if (protocol == NULL || !strcasecmp(protocol, proto[0])) {
		state.protocol = proto[0];
		benchmp(initialize, benchmark, NULL, MEDIUM, parallel, 
			warmup, repetitions, &state);
		sprintf(buf, "RPC/%s latency using %s", proto[0], state.server);
		micro(buf, get_n());
	}

	if (protocol == NULL || !strcasecmp(protocol, proto[1])) {
		state.protocol = proto[1];
		benchmp(initialize, benchmark, NULL, MEDIUM, parallel, 
			warmup, repetitions, &state);
		sprintf(buf, "RPC/%s latency using %s", proto[1], state.server);
		micro(buf, get_n());
	}
		
	exit(0);
}
Example #27
0
int
main(int ac, char **av)
{
	int	c;
	int	warmup = 0;
	int	repetitions = TRIES;
	double	par;
	struct _state	state;
	char   *usage = "[-W <warmup>] [-N <repetitions>]\n";

	state.N = 1;
	state.M = 1000;
	state.K = -1023;

	while (( c = getopt(ac, av, "W:N:")) != EOF) {
		switch(c) {
		case 'W':
			warmup = atoi(optarg);
			break;
		case 'N':
			repetitions = atoi(optarg);
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}

	par = max_parallelism(integer_bit_benchmarks, 
			      warmup, repetitions, &state);
	if (par > 0.)
		fprintf(stderr, "integer bit parallelism: %.2f\n", par);

	par = max_parallelism(integer_add_benchmarks, 
			      warmup, repetitions, &state);
	if (par > 0.)
		fprintf(stderr, "integer add parallelism: %.2f\n", par);

	par = max_parallelism(integer_mul_benchmarks, 
			      warmup, repetitions, &state);
	if (par > 0.)
		fprintf(stderr, "integer mul parallelism: %.2f\n", par);

	par = max_parallelism(integer_div_benchmarks, 
			      warmup, repetitions, &state);
	if (par > 0.)
		fprintf(stderr, "integer div parallelism: %.2f\n", par);

	par = max_parallelism(integer_mod_benchmarks, 
			      warmup, repetitions, &state);
	if (par > 0.)
		fprintf(stderr, "integer mod parallelism: %.2f\n", par);

	par = max_parallelism(int64_bit_benchmarks, 
			      warmup, repetitions, &state);
	if (par > 0.)
		fprintf(stderr, "int64 bit parallelism: %.2f\n", par);

	par = max_parallelism(int64_add_benchmarks, 
			      warmup, repetitions, &state);
	if (par > 0.)
		fprintf(stderr, "int64 add parallelism: %.2f\n", par);

	par = max_parallelism(int64_mul_benchmarks, 
			      warmup, repetitions, &state);
	if (par > 0.)
		fprintf(stderr, "int64 mul parallelism: %.2f\n", par);

	par = max_parallelism(int64_div_benchmarks, 
			      warmup, repetitions, &state);
	if (par > 0.)
		fprintf(stderr, "int64 div parallelism: %.2f\n", par);

	par = max_parallelism(int64_mod_benchmarks, 
			      warmup, repetitions, &state);
	if (par > 0.)
		fprintf(stderr, "int64 mod parallelism: %.2f\n", par);

	par = max_parallelism(float_add_benchmarks, 
			      warmup, repetitions, &state);
	if (par > 0.)
		fprintf(stderr, "float add parallelism: %.2f\n", par);

	par = max_parallelism(float_mul_benchmarks, 
			      warmup, repetitions, &state);
	if (par > 0.)
		fprintf(stderr, "float mul parallelism: %.2f\n", par);

	par = max_parallelism(float_div_benchmarks, 
			      warmup, repetitions, &state);
	if (par > 0.)
		fprintf(stderr, "float div parallelism: %.2f\n", par);

	par = max_parallelism(double_add_benchmarks, 
			      warmup, repetitions, &state);
	if (par > 0.)
		fprintf(stderr, "double add parallelism: %.2f\n", par);

	par = max_parallelism(double_mul_benchmarks, 
			      warmup, repetitions, &state);
	if (par > 0.)
		fprintf(stderr, "double mul parallelism: %.2f\n", par);

	par = max_parallelism(double_div_benchmarks, 
			      warmup, repetitions, &state);
	if (par > 0.)
		fprintf(stderr, "double div parallelism: %.2f\n", par);


	return(0);
}
Example #28
0
int
main(int ac, char **av)
{
	char	*server;
	int     i, prog;
	int	c;
	int	shutdown = 0;
	uint64	total = 0;
	uint64	usecs = 0;
	double	avg;
	char	*name = av[0];
	char	file[1024];
	char	*usage = "[-d] [-e] [-S] serverhost [port] < list\n";

	while (( c = getopt(ac, av, "deS")) != EOF) {
		switch(c) {
		case 'd':
			debug++;
			break;
		case 'e':
			echo++;
			break;
		case 'S': /* shutdown serverhost */
			shutdown = 1;
			break;
		default:
			lmbench_usage(ac, av, usage);
			break;
		}
	}
	
	if (optind >= ac || optind < ac - 2) {
		lmbench_usage(ac, av, usage);
		exit(0);
	}
	server = av[optind++];

	if (optind < ac && atoi(av[optind]) != 0) {
		prog = -atoi(av[optind]);
	} else {
		prog = -80;
	}

	if (shutdown) {
		killhttp(server, prog);
		exit(0);
	}

	i = 0;
	buf = valloc(XFERSIZE);
	bzero(buf, XFERSIZE);
	while (fgets(file, sizeof(file), stdin)) {
		chop(file);
		start(0);
		total += http(server, file, prog);
		usecs += stop(0,0);
		i++;
	}
	avg = total;
	avg /= (i - 1);
	if (avg > 1000) {
		avg /= 1000;
		fprintf(stderr, "Avg xfer: %.1fKB, ", avg);
	} else {
		fprintf(stderr, "Avg xfer %d, ", (int)avg);
	}
	settime(usecs);
	latency((uint64)1, total);
	exit(0);
}