Beispiel #1
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);
}
Beispiel #2
0
void ChronoTimer::update() const
{
    m_t1 = m_paused ? m_tp : clock::now();

    const auto delta = m_t1 - m_t0;  
    m_elapsed = nano(delta).count() + m_offset;
}
Beispiel #3
0
/*
 * Test Userland Thread Scheduler (UTS) suite for KSE.
 */
int
main(void)
{
	int i;

	runq_init(&runq1);
	init_uts(&data1, &runq1);
	init_uts(&data2, &runq1);
	thread_start(&data1, aaaa, '+');
	thread_start(&data1, aaaa, '-');
	start_uts(&data1, 0);
	start_uts(&data2, 0);

//	start second ksegrp
	runq_init(&runq2);
	init_uts(&data3, &runq2);
	init_uts(&data4, &runq2);
	thread_start(&data3, newkse, 0);
	thread_start(&data3, aaaa, '*');
	thread_start(&data3, aaaa, '.');
	start_uts(&data3, 1);

	for (i = 0;1;i++) {
//		if (i < 1000)
//			thread_start(aaaa, 'a' + (i % 26));
		pchar('A' + (i % 26));
		nano(5);
	}
	pstr("\n** main() exiting **\n");
	return (EX_OK);
}
Beispiel #4
0
void start(const char* str)
{
	cache_clear();
	compare_counter = 0;
	the_str = str;
	the_start = nano();
}
Beispiel #5
0
void
aaaa(int c)
{
	for (;;) {
		pchar(c);
		nano(1);
	}
}
Beispiel #6
0
void ChronoTimer::start()
{
    if(!m_paused)
        return;

    const time_point t2 = clock::now();
    m_offset -= nano(t2 - m_tp).count();

    m_t1 = t2;
    m_paused = false;
}
Beispiel #7
0
void stop()
{
	tommy_uint64_t the_stop = nano();
	printf("%25s %8u [ms], %8u [compare]\n", the_str, (unsigned)((the_stop - the_start) / 1000000), compare_counter);
}