src/ccKVS/cache.c
void update_cache_stats(int op_num, int thread_id, struct extended_cache_op **op, struct mica_resp *resp, long long stalled_brcs) {
	int i = 0;
	for(i = 0; i < op_num; ++i){
		switch(resp[i].type) {
			case CACHE_GET_SUCCESS:
				cache.meta[thread_id].num_get_success++;
				break;
			case CACHE_PUT_SUCCESS:
				cache.meta[thread_id].num_put_success++;
				break;
			case CACHE_UPD_SUCCESS:
				cache.meta[thread_id].num_upd_success++;
				break;
			case CACHE_INV_SUCCESS:
				cache.meta[thread_id].num_inv_success++;
				break;
			case CACHE_ACK_SUCCESS:
			case CACHE_LAST_ACK_SUCCESS:
				cache.meta[thread_id].num_ack_success++;
				break;
			case CACHE_MISS:
				if((*op)[i].opcode == CACHE_OP_GET)
					cache.meta[thread_id].num_get_miss++;
				else if((*op)[i].opcode == CACHE_OP_PUT)
					cache.meta[thread_id].num_put_miss++;
				else assert(0);
				break;
			case CACHE_GET_STALL:
				cache.meta[thread_id].num_get_stall++;
				break;
			case CACHE_PUT_STALL:
				cache.meta[thread_id].num_put_stall++;
				break;
			case CACHE_UPD_FAIL:
				cache.meta[thread_id].num_upd_fail++;
				break;
			case CACHE_INV_FAIL:
				cache.meta[thread_id].num_inv_fail++;
				break;
			case CACHE_ACK_FAIL:
				cache.meta[thread_id].num_ack_fail++;
				break;
			case UNSERVED_CACHE_MISS:
				if((*op)[i].opcode == CACHE_OP_GET)
					cache.meta[thread_id].num_unserved_get_miss++;
				else if((*op)[i].opcode == CACHE_OP_PUT)
					cache.meta[thread_id].num_unserved_put_miss++;
				else assert(0);
				break;
			default: assert(0);
		}
	}
	cache.meta[thread_id].num_put_success -= stalled_brcs;
}
/*
 * WARNING: the following functions related to cache stats are not tested on this version of code
 */
the following functions related to cache stats are not tested on this version of code
the following functions related to cache stats are not tested on this version of code
void update_cache_stats(int op_num, int thread_id, struct extended_cache_op **op, struct mica_resp *resp, long long stalled_brcs) {
	int i = 0;
	for(i = 0; i < op_num; ++i){
		switch(resp[i].type) {
			case CACHE_GET_SUCCESS:
				cache.meta[thread_id].num_get_success++;
				break;
			case CACHE_PUT_SUCCESS:
				cache.meta[thread_id].num_put_success++;
				break;
			case CACHE_UPD_SUCCESS:
				cache.meta[thread_id].num_upd_success++;
				break;
			case CACHE_INV_SUCCESS:
				cache.meta[thread_id].num_inv_success++;
				break;
			case CACHE_ACK_SUCCESS:
			case CACHE_LAST_ACK_SUCCESS:
				cache.meta[thread_id].num_ack_success++;
				break;
			case CACHE_MISS:
				if((*op)[i].opcode == CACHE_OP_GET)
					cache.meta[thread_id].num_get_miss++;
				else if((*op)[i].opcode == CACHE_OP_PUT)
					cache.meta[thread_id].num_put_miss++;
				else assert(0);
				break;
			case CACHE_GET_STALL:
				cache.meta[thread_id].num_get_stall++;
				break;
			case CACHE_PUT_STALL:
				cache.meta[thread_id].num_put_stall++;
				break;
			case CACHE_UPD_FAIL:
				cache.meta[thread_id].num_upd_fail++;
				break;
			case CACHE_INV_FAIL:
				cache.meta[thread_id].num_inv_fail++;
				break;
			case CACHE_ACK_FAIL:
				cache.meta[thread_id].num_ack_fail++;
				break;
			case UNSERVED_CACHE_MISS:
				if((*op)[i].opcode == CACHE_OP_GET)
					cache.meta[thread_id].num_unserved_get_miss++;
				else if((*op)[i].opcode == CACHE_OP_PUT)
					cache.meta[thread_id].num_unserved_put_miss++;
				else assert(0);
				break;
			default: assert(0);
		}
	}
	cache.meta[thread_id].num_put_success -= stalled_brcs;
}
void update_cache_stats ( int op_num , int thread_id , struct extended_cache_op * * op , struct mica_resp * resp , long long stalled_brcs ) { int i = 0 ; for ( i = 0 ; i < op_num ; ++ i ) { switch ( resp [ i ] . type ) { case CACHE_GET_SUCCESS : cache . meta [ thread_id ] . num_get_success ++ ; break ; case CACHE_PUT_SUCCESS : cache . meta [ thread_id ] . num_put_success ++ ; break ; case CACHE_UPD_SUCCESS : cache . meta [ thread_id ] . num_upd_success ++ ; break ; case CACHE_INV_SUCCESS : cache . meta [ thread_id ] . num_inv_success ++ ; break ; case CACHE_ACK_SUCCESS : case CACHE_LAST_ACK_SUCCESS : cache . meta [ thread_id ] . num_ack_success ++ ; break ; case CACHE_MISS : if ( ( * op ) [ i ] . opcode == CACHE_OP_GET ) cache . meta [ thread_id ] . num_get_miss ++ ; else if ( ( * op ) [ i ] . opcode == CACHE_OP_PUT ) cache . meta [ thread_id ] . num_put_miss ++ ; else assert ( 0 ) ; break ; case CACHE_GET_STALL : cache . meta [ thread_id ] . num_get_stall ++ ; break ; case CACHE_PUT_STALL : cache . meta [ thread_id ] . num_put_stall ++ ; break ; case CACHE_UPD_FAIL : cache . meta [ thread_id ] . num_upd_fail ++ ; break ; case CACHE_INV_FAIL : cache . meta [ thread_id ] . num_inv_fail ++ ; break ; case CACHE_ACK_FAIL : cache . meta [ thread_id ] . num_ack_fail ++ ; break ; case UNSERVED_CACHE_MISS : if ( ( * op ) [ i ] . opcode == CACHE_OP_GET ) cache . meta [ thread_id ] . num_unserved_get_miss ++ ; else if ( ( * op ) [ i ] . opcode == CACHE_OP_PUT ) cache . meta [ thread_id ] . num_unserved_put_miss ++ ; else assert ( 0 ) ; break ; default : assert ( 0 ) ; } } cache . meta [ thread_id ] . num_put_success -= stalled_brcs ; }
WARNING: the following functions related to cache stats are not tested on this version of code
WARNING : the following functions related to cache stats are not tested on this version of code