TESTCASE() { ThreadVarPtr t_ip1 = CREATE_THREAD(insertpair_routine1, (void*)&multiset); ThreadVarPtr t_ip2 = CREATE_THREAD(insertpair_routine2, (void*)&multiset); ThreadVarPtr t_ip3 = CREATE_THREAD(insertpair_routine3, (void*)&multiset); ThreadVarPtr t_lu1 = CREATE_THREAD(lookup_routine1, (void*)&multiset); ThreadVarPtr t_lu2 = CREATE_THREAD(lookup_routine2, (void*)&multiset); ThreadVarPtr t_lu3 = CREATE_THREAD(lookup_routine3, (void*)&multiset); printf("=============================================\n" "=============================================\n"); //---------------------------------------------------------------------------------- //---------------------------------------------------------------------------------- FORALL(t1, BY(t_ip1) || BY(t_ip2) || BY(t_ip3)); RUN_UNTIL(BY(t1), ENDS(), __); FORALL(t2, (BY(t_ip1) || BY(t_ip2) || BY(t_ip3)) && NOT(t1)); RUN_UNTIL(BY(t2), ENDS(), __); FORALL(t3, (BY(t_ip1) || BY(t_ip2) || BY(t_ip3)) && NOT(t1) && NOT(t2)); RUN_UNTIL(BY(t3), ENDS(), __); RUN_UNTIL(BY(t_lu2), ENDS(), __); RUN_UNTIL(BY(t_lu1), ENDS(), __); RUN_UNTIL(BY(t_lu3), ENDS(), __); WHILE_STAR { EXISTS(t); RUN_UNTIL(PTRUE && !FINAL(), FINAL(t)) } RUN_UNTIL(PTRUE, FINAL()) }
coeff_t optcost(cfset_t &coeffs) { coeff_t res = 0; FORALL(coeffs,i) res += COSTS[*i]; return res; }
coeff_t bitscost(cfset_t &coeffs) { coeff_t res = 0; FORALL(coeffs,i) res += nonzero_bits(*i) - 1; return res; }
coeff_t csdcost(cfset_t &coeffs) { coeff_t res = 0; FORALL(coeffs,i) res += csd_bits(*i); return res; }