コード例 #1
0
ファイル: mctest.c プロジェクト: gparmer/PipeMeas
void *orchestrate_measurements(void *d)
{
	struct orch_meas_args *a = d;
	pthread_t *ts = &a->ts[0];
	int ncpus = a->ncpus;
	int i, j;

	for (i = 0 ; i < ncpus ; i++) {
		for (j = i+1 ; j < ncpus ; j++) {
//			int iter;
again:
			thd_set_affinity(ts[1], j);
			thd_set_affinity(ts[0], i);
			
			bounce = MEAS_ITER;
			while (mcsync.r != 0) ;
			mcsync.r = 1;
			bounce = MEAS_ITER;
			while (bounce > 0) {
				unsigned long t;

				t = bounce-1;
				bounce = t; /* write to cache line */
				if (bounce == 0) break;
				while (bounce == t) ;
			}
			assert(bounce == 0);
			while (mcsync.r != 0) ;

			if (mcsync.cost > 100000) goto again;
			printf("One-way cost is %d\n", mcsync.cost);
			fflush(stdout);
			
			//dist_mat[i][j] = dist_mat[j][i] = mcsync.cost;
		}
	}
	while (mcsync.r != 0) ;
	mcsync.r = -1;

	thd_set_affinity(ts[1], 1);
	thd_set_affinity(ts[0], 0);
	printf("running producer\n"); fflush(stdout);
	system("PCM/Intel/./main");
	//	rb_test_p();

	return NULL;
}
コード例 #2
0
ファイル: ns.c プロジェクト: ryuxin/cbuf-composite
int
main(void)
{
	thd_set_affinity(pthread_self(), 0);
	ps_init(&ps);
	test_slab_alloc_lkup();
	test_smr_alloc_lkup();
	test_perf();

	return 0;
}