From: Peizhao Ou Date: Tue, 25 Mar 2014 21:22:26 +0000 (-0700) Subject: save the correct hashtable test driver X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=ca4ad174498d9e8eba6380eb2453cd181728ebb8;p=cdsspec-compiler.git save the correct hashtable test driver --- diff --git a/benchmark/cliffc-hashtable/main.cc b/benchmark/cliffc-hashtable/main.cc index 302a7ae..088c209 100644 --- a/benchmark/cliffc-hashtable/main.cc +++ b/benchmark/cliffc-hashtable/main.cc @@ -55,23 +55,34 @@ IntWrapper *k0, *k1, *k2, *k3, *k4, *k5; IntWrapper *v0, *v1, *v2, *v3, *v4, *v5; void threadA(void *arg) { - table->put(k3, v3); - val1 = table->get(k2); - - + IntWrapper *Res; + int res; + Res = table->put(k3, v3); + res = Res == NULL ? 0 : Res->_val; + model_print("Put1: key_%d, val_%d, res_%d\n", k3->_val, v3->_val, res); + + Res = table->get(k2); + res = Res == NULL ? 0 : Res->_val; + model_print("Get2: key_%d, res_%d\n", k2->_val, res); } void threadB(void *arg) { - } + IntWrapper *Res; + int res; + Res = table->put(k2, v2); + res = Res == NULL ? 0 : Res->_val; + model_print("Put3: key_%d, val_%d, res_%d\n", k2->_val, v2->_val, res); + + Res = table->get(k3); + res = Res == NULL ? 0 : Res->_val; + model_print("Get4: key_%d, res_%d\n", k3->_val, res); +} -void threadMain(void *arg) { - table->put(k2, v2); - val1 = table->get(k3); - +void threadC(void *arg) { } int user_main(int argc, char *argv[]) { - thrd_t t1, t2; + thrd_t t1, t2, t3; table = new cliffc_hashtable(32); k1 = new IntWrapper(3); k2 = new IntWrapper(5); @@ -79,19 +90,19 @@ int user_main(int argc, char *argv[]) { k4 = new IntWrapper(7); k5 = new IntWrapper(13); + v0 = new IntWrapper(2048); v1 = new IntWrapper(1024); v2 = new IntWrapper(47); v3 = new IntWrapper(73); v4 = new IntWrapper(81); v5 = new IntWrapper(99); - v0 = new IntWrapper(2048); - thrd_create(&t1, threadA, NULL); + thrd_create(&t1, threadA, NULL); thrd_create(&t2, threadB, NULL); - threadMain(NULL); - + thrd_create(&t3, threadB, NULL); thrd_join(t1); thrd_join(t2); + thrd_join(t3); return 0; }