X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=mcs-queue%2Fmain.c;h=015fbd4c7737175294b9952b697558dca7bf66af;hb=09755ab872436ab30326c2a2dcfe9f2a808b5075;hp=98ca29a26ac87a38ed745bd03a41c1859d7e0bd6;hpb=404f3f4a8d55aa8c511c049b732887df67a59468;p=model-checker-benchmarks.git diff --git a/mcs-queue/main.c b/mcs-queue/main.c index 98ca29a..015fbd4 100644 --- a/mcs-queue/main.c +++ b/mcs-queue/main.c @@ -1,148 +1,80 @@ #include "main.h" +#include #define NUM_PROCESSORS 12 struct tms tim; struct tms tim1; -usptr_t *Handle; -barrier_t *Barrier; -usptr_t *lock_handle; -ulock_t native_lock; - int shmid; unsigned pid; -unsigned backoff; -unsigned backoff_base; -unsigned backoff_cap; -unsigned backoff_addend; char* name = ""; -unsigned backoff_base_bits = 0; -unsigned backoff_cap_bits = 0; unsigned procs = 1; unsigned multi = 1; unsigned iterations = 1; unsigned initial_nodes = 0; unsigned repetitions = 1; -unsigned backoff_shift_bits = 0; unsigned work = 0; private_t private; shared_mem_t *smp; -void -native_acquire () +void time_test() { - ussetlock(native_lock); -} + unsigned i,j; + struct tms time_val; + clock_t t1, t2; + unsigned val; -void -native_release () -{ - usunsetlock(native_lock); + if(pid==0) { + init_queue(); + } + init_memory(); + init_private(); + for(i=0;i>1))/(procs*multi); -void main_task() -{ - unsigned processor; - unsigned i; + smp = (shared_mem_t *)calloc(1, sizeof(shared_mem_t)); + assert(smp); - processor = (pid/multi)+1; - processor %= NUM_PROCESSORS; - if(sysmp(MP_MUSTRUN, processor) == -1) { perror("Could not MUSTRUN"); } - if (pid==0) { - printf("--- %s\n", name); - fflush(stdout); - } - for (i=0; i>1))/(procs*multi); - setup_shmem(); - Handle = usinit("/tmp/foo_barrier"); - Barrier = new_barrier(Handle); - init_barrier(Barrier); - lock_handle = usinit("/tmp/foo_lock"); - native_lock = usnewlock(lock_handle); - my_m_fork(main_task, procs*multi); - shmctl(shmid, IPC_RMID, smp); - exit(0); + return 0; }