include/ccKVS/inline_util.h
static inline void debug_coalescing(struct ibv_sge* rem_send_sgl, uint16_t local_client_id, uint16_t rem_req_i,
									uint16_t wr_i)
{
	uint16_t i, j;
	int send_cntr = 0;
	uint16_t clt_gid = machine_id * CLIENTS_PER_MACHINE + local_client_id;
	for (i = 0; i < wr_i; i++) {
		struct mica_op* tmp = (struct mica_op*)rem_send_sgl[i].addr;
		assert(tmp->opcode == MICA_OP_PUT || tmp->opcode == MICA_OP_GET ||
			   tmp->opcode == MICA_OP_MULTI_GET);
		if (tmp->opcode == MICA_OP_PUT) {send_cntr++; continue;}
		//		printf("Message %d: length %d, opcode %d\n", i, rem_send_sgl[i].length, tmp->opcode);
		if (rem_send_sgl[i].length > HERD_GET_REQ_SIZE + 1) {
			assert(tmp->opcode == MICA_OP_MULTI_GET);
			assert(rem_send_sgl[i].length == (tmp->val_len * HERD_GET_REQ_SIZE) + 1);
			send_cntr+= tmp->val_len;
			for (j = 0; j <  tmp->val_len; j++) {
				struct mica_op* tmp2 = (struct mica_op*)rem_send_sgl[i].addr;
				if (j > 0) {
					uint8_t* tmp3 = (uint8_t*)rem_send_sgl[i].addr + 1 + (j * HERD_GET_REQ_SIZE);
					tmp2 = (struct mica_op*)tmp3;
				}
				//if (j > 0 && tmp2->opcode != MICA_OP_GET){
				if((tmp2->key.rem_meta.clt_gid != clt_gid) && (MEASURE_LATENCY == 0)) {
					red_printf("Inside sends, wr_i %d val_len %d, clt_gid %d, req %d and sent clt_gid %d rem_send_sgl_addr %llu looking at %llu\n",
							   local_client_id, i, tmp->val_len, j, tmp2->key.rem_meta.clt_gid, tmp, tmp2);
					assert(false);
				}
			}
		}
		else send_cntr++;
	}
	//	printf("wr_i %d, rem_req_i %d, send_ctr %d \n", wr_i, rem_req_i, send_cntr);
	assert(send_cntr == rem_req_i);
}
// Used when sending remote requests to debug the coalescing feature
Used when sending remote requests to debug the coalescing feature
Used when sending remote requests to debug the coalescing feature
static inline void debug_coalescing(struct ibv_sge* rem_send_sgl, uint16_t local_client_id, uint16_t rem_req_i,
									uint16_t wr_i)
{
	uint16_t i, j;
	int send_cntr = 0;
	uint16_t clt_gid = machine_id * CLIENTS_PER_MACHINE + local_client_id;
	for (i = 0; i < wr_i; i++) {
		struct mica_op* tmp = (struct mica_op*)rem_send_sgl[i].addr;
		assert(tmp->opcode == MICA_OP_PUT || tmp->opcode == MICA_OP_GET ||
			   tmp->opcode == MICA_OP_MULTI_GET);
		if (tmp->opcode == MICA_OP_PUT) {send_cntr++; continue;}
		if (rem_send_sgl[i].length > HERD_GET_REQ_SIZE + 1) {
			assert(tmp->opcode == MICA_OP_MULTI_GET);
			assert(rem_send_sgl[i].length == (tmp->val_len * HERD_GET_REQ_SIZE) + 1);
			send_cntr+= tmp->val_len;
			for (j = 0; j <  tmp->val_len; j++) {
				struct mica_op* tmp2 = (struct mica_op*)rem_send_sgl[i].addr;
				if (j > 0) {
					uint8_t* tmp3 = (uint8_t*)rem_send_sgl[i].addr + 1 + (j * HERD_GET_REQ_SIZE);
					tmp2 = (struct mica_op*)tmp3;
				}
				if((tmp2->key.rem_meta.clt_gid != clt_gid) && (MEASURE_LATENCY == 0)) {
					red_printf("Inside sends, wr_i %d val_len %d, clt_gid %d, req %d and sent clt_gid %d rem_send_sgl_addr %llu looking at %llu\n",
							   local_client_id, i, tmp->val_len, j, tmp2->key.rem_meta.clt_gid, tmp, tmp2);
					assert(false);
				}
			}
		}
		else send_cntr++;
	}
	assert(send_cntr == rem_req_i);
}
static inline void debug_coalescing ( struct ibv_sge * rem_send_sgl , uint16_t local_client_id , uint16_t rem_req_i , uint16_t wr_i ) { uint16_t i , j ; int send_cntr = 0 ; uint16_t clt_gid = machine_id * CLIENTS_PER_MACHINE + local_client_id ; for ( i = 0 ; i < wr_i ; i ++ ) { struct mica_op * tmp = ( struct mica_op * ) rem_send_sgl [ i ] . addr ; assert ( tmp -> opcode == MICA_OP_PUT || tmp -> opcode == MICA_OP_GET || tmp -> opcode == MICA_OP_MULTI_GET ) ; if ( tmp -> opcode == MICA_OP_PUT ) { send_cntr ++ ; continue ; } if ( rem_send_sgl [ i ] . length > HERD_GET_REQ_SIZE + 1 ) { assert ( tmp -> opcode == MICA_OP_MULTI_GET ) ; assert ( rem_send_sgl [ i ] . length == ( tmp -> val_len * HERD_GET_REQ_SIZE ) + 1 ) ; send_cntr += tmp -> val_len ; for ( j = 0 ; j < tmp -> val_len ; j ++ ) { struct mica_op * tmp2 = ( struct mica_op * ) rem_send_sgl [ i ] . addr ; if ( j > 0 ) { uint8_t * tmp3 = ( uint8_t * ) rem_send_sgl [ i ] . addr + 1 + ( j * HERD_GET_REQ_SIZE ) ; tmp2 = ( struct mica_op * ) tmp3 ; } if ( ( tmp2 -> key . rem_meta . clt_gid != clt_gid ) && ( MEASURE_LATENCY == 0 ) ) { red_printf ( " \n " , local_client_id , i , tmp -> val_len , j , tmp2 -> key . rem_meta . clt_gid , tmp , tmp2 ) ; assert ( false ) ; } } } else send_cntr ++ ; } assert ( send_cntr == rem_req_i ) ; }
Used when sending remote requests to debug the coalescing feature
Used when sending remote requests to debug the coalescing feature
//		printf("Message %d: length %d, opcode %d\n", i, rem_send_sgl[i].length, tmp->opcode); //if (j > 0 && tmp2->opcode != MICA_OP_GET){ //	printf("wr_i %d, rem_req_i %d, send_ctr %d \n", wr_i, rem_req_i, send_cntr);