include/ccKVS/inline_util.h
static inline void cache_hit_bookkeeping_LIN(struct extended_cache_op *ops, struct extended_cache_op *next_ops,
											 struct mica_resp *resp,
											 struct mica_resp *next_resp, struct key_home *key_homes,
											 struct key_home *next_key_homes,
											 uint16_t *op_i, uint16_t *next_op_i, uint16_t *stalled_ops_i,
											 uint16_t local_client_id,
											 struct latency_flags *latency_info, uint16_t *hottest_keys_pointers)
{
	while (resp[(*op_i)].type != CACHE_MISS && resp[(*op_i)].type != UNSERVED_CACHE_MISS && (*op_i) < CACHE_BATCH_SIZE) {
		if (ENABLE_ASSERTIONS == 1)
			if(!(resp[(*op_i)].type == CACHE_GET_SUCCESS || resp[(*op_i)].type == CACHE_PUT_SUCCESS ||
				 resp[(*op_i)].type == CACHE_GET_STALL || resp[(*op_i)].type == CACHE_PUT_STALL ||
				 resp[(*op_i)].type == CACHE_PUT_FAIL || ops[(*op_i)].opcode == CACHE_OP_INV ||
				 ops[(*op_i)].opcode == CACHE_OP_BRC)) {
				printf("Ops: %s\n",code_to_str(ops[(*op_i)].opcode));
				printf("Response: %s\n",code_to_str(resp[(*op_i)].type));
				assert(0);
			}
		if (STALLING_DEBUG_LIN) {
			if (resp[(*op_i)].type == CACHE_GET_STALL || resp[(*op_i)].type == CACHE_PUT_STALL)
				(*stalled_ops_i)++;
		}
		if (resp[(*op_i)].type == CACHE_GET_SUCCESS || ops[(*op_i)].opcode == CACHE_OP_INV ||
			resp[(*op_i)].type == CACHE_PUT_FAIL ) {// Empty the Reads and the broadcasts that have been sent
			if ((ENABLE_HOT_KEY_TRACKING == 1) && (resp[(*op_i)].type == CACHE_GET_SUCCESS)) {
				c_stats[local_client_id].cache_hits_per_client += (ops[(*op_i)].val_len + 1);
				if ((ops[(*op_i)].value[0]) < HOTTEST_KEYS_TO_TRACK) {
					if (hottest_keys_pointers[ops[(*op_i)].value[0]] == ((*op_i) + 1)) {
						hottest_keys_pointers[ops[(*op_i)].value[0]] = 0;
					}
				}
			}
			else c_stats[local_client_id].cache_hits_per_client++;
			resp[(*op_i)].type = EMPTY;
		}
		else {
			copy_op_to_next_op(ops, next_ops, resp, next_resp, key_homes, next_key_homes, (*op_i), next_op_i, latency_info, hottest_keys_pointers);
		}
		(*op_i)++;
	}
}
// Bookkeeping of requests that hit in the cache for LIN
Bookkeeping of requests that hit in the cache for LIN
Bookkeeping of requests that hit in the cache for LIN
static inline void cache_hit_bookkeeping_LIN(struct extended_cache_op *ops, struct extended_cache_op *next_ops,
											 struct mica_resp *resp,
											 struct mica_resp *next_resp, struct key_home *key_homes,
											 struct key_home *next_key_homes,
											 uint16_t *op_i, uint16_t *next_op_i, uint16_t *stalled_ops_i,
											 uint16_t local_client_id,
											 struct latency_flags *latency_info, uint16_t *hottest_keys_pointers)
{
	while (resp[(*op_i)].type != CACHE_MISS && resp[(*op_i)].type != UNSERVED_CACHE_MISS && (*op_i) < CACHE_BATCH_SIZE) {
		if (ENABLE_ASSERTIONS == 1)
			if(!(resp[(*op_i)].type == CACHE_GET_SUCCESS || resp[(*op_i)].type == CACHE_PUT_SUCCESS ||
				 resp[(*op_i)].type == CACHE_GET_STALL || resp[(*op_i)].type == CACHE_PUT_STALL ||
				 resp[(*op_i)].type == CACHE_PUT_FAIL || ops[(*op_i)].opcode == CACHE_OP_INV ||
				 ops[(*op_i)].opcode == CACHE_OP_BRC)) {
				printf("Ops: %s\n",code_to_str(ops[(*op_i)].opcode));
				printf("Response: %s\n",code_to_str(resp[(*op_i)].type));
				assert(0);
			}
		if (STALLING_DEBUG_LIN) {
			if (resp[(*op_i)].type == CACHE_GET_STALL || resp[(*op_i)].type == CACHE_PUT_STALL)
				(*stalled_ops_i)++;
		}
		if (resp[(*op_i)].type == CACHE_GET_SUCCESS || ops[(*op_i)].opcode == CACHE_OP_INV ||
			resp[(*op_i)].type == CACHE_PUT_FAIL ) {
			if ((ENABLE_HOT_KEY_TRACKING == 1) && (resp[(*op_i)].type == CACHE_GET_SUCCESS)) {
				c_stats[local_client_id].cache_hits_per_client += (ops[(*op_i)].val_len + 1);
				if ((ops[(*op_i)].value[0]) < HOTTEST_KEYS_TO_TRACK) {
					if (hottest_keys_pointers[ops[(*op_i)].value[0]] == ((*op_i) + 1)) {
						hottest_keys_pointers[ops[(*op_i)].value[0]] = 0;
					}
				}
			}
			else c_stats[local_client_id].cache_hits_per_client++;
			resp[(*op_i)].type = EMPTY;
		}
		else {
			copy_op_to_next_op(ops, next_ops, resp, next_resp, key_homes, next_key_homes, (*op_i), next_op_i, latency_info, hottest_keys_pointers);
		}
		(*op_i)++;
	}
}
static inline void cache_hit_bookkeeping_LIN ( struct extended_cache_op * ops , struct extended_cache_op * next_ops , struct mica_resp * resp , struct mica_resp * next_resp , struct key_home * key_homes , struct key_home * next_key_homes , uint16_t * op_i , uint16_t * next_op_i , uint16_t * stalled_ops_i , uint16_t local_client_id , struct latency_flags * latency_info , uint16_t * hottest_keys_pointers ) { while ( resp [ ( * op_i ) ] . type != CACHE_MISS && resp [ ( * op_i ) ] . type != UNSERVED_CACHE_MISS && ( * op_i ) < CACHE_BATCH_SIZE ) { if ( ENABLE_ASSERTIONS == 1 ) if ( ! ( resp [ ( * op_i ) ] . type == CACHE_GET_SUCCESS || resp [ ( * op_i ) ] . type == CACHE_PUT_SUCCESS || resp [ ( * op_i ) ] . type == CACHE_GET_STALL || resp [ ( * op_i ) ] . type == CACHE_PUT_STALL || resp [ ( * op_i ) ] . type == CACHE_PUT_FAIL || ops [ ( * op_i ) ] . opcode == CACHE_OP_INV || ops [ ( * op_i ) ] . opcode == CACHE_OP_BRC ) ) { printf ( " \n " , code_to_str ( ops [ ( * op_i ) ] . opcode ) ) ; printf ( " \n " , code_to_str ( resp [ ( * op_i ) ] . type ) ) ; assert ( 0 ) ; } if ( STALLING_DEBUG_LIN ) { if ( resp [ ( * op_i ) ] . type == CACHE_GET_STALL || resp [ ( * op_i ) ] . type == CACHE_PUT_STALL ) ( * stalled_ops_i ) ++ ; } if ( resp [ ( * op_i ) ] . type == CACHE_GET_SUCCESS || ops [ ( * op_i ) ] . opcode == CACHE_OP_INV || resp [ ( * op_i ) ] . type == CACHE_PUT_FAIL ) { if ( ( ENABLE_HOT_KEY_TRACKING == 1 ) && ( resp [ ( * op_i ) ] . type == CACHE_GET_SUCCESS ) ) { c_stats [ local_client_id ] . cache_hits_per_client += ( ops [ ( * op_i ) ] . val_len + 1 ) ; if ( ( ops [ ( * op_i ) ] . value [ 0 ] ) < HOTTEST_KEYS_TO_TRACK ) { if ( hottest_keys_pointers [ ops [ ( * op_i ) ] . value [ 0 ] ] == ( ( * op_i ) + 1 ) ) { hottest_keys_pointers [ ops [ ( * op_i ) ] . value [ 0 ] ] = 0 ; } } } else c_stats [ local_client_id ] . cache_hits_per_client ++ ; resp [ ( * op_i ) ] . type = EMPTY ; } else { copy_op_to_next_op ( ops , next_ops , resp , next_resp , key_homes , next_key_homes , ( * op_i ) , next_op_i , latency_info , hottest_keys_pointers ) ; } ( * op_i ) ++ ; } }
Bookkeeping of requests that hit in the cache for LIN
Bookkeeping of requests that hit in the cache for LIN
// Empty the Reads and the broadcasts that have been sent