Commit ea86e486 authored by Humberto Cristobal Bocos's avatar Humberto Cristobal Bocos
Browse files

Added working version with LD_PRELOAD

parent 9a98efba
......@@ -354,7 +354,7 @@ int imss_split_readv(const char *path, char *buf, size_t size, off_t offset)
end_offset = (offset+size) % IMSS_DATA_BSIZE;
size_t to_read = 0;
//printf("\n[CLIENT] [SPLIT_READ] size=%ld offset=%ld start block=%ld, end_block=%ld\n",size, offset, curr_blk, end_blk);
printf("\n[CLIENT] [SPLIT_READ] size=%ld offset=%ld start block=%ld, end_block=%ld\n",size, offset, curr_blk, end_blk);
//Needed variables
size_t byte_count = 0;
int64_t rbytes;
......@@ -644,7 +644,7 @@ int imss_sread(const char *path, char *buf, size_t size, off_t offset)
gettimeofday(&end2, NULL);
delta_us2 = (float) (end2.tv_usec - start2.tv_usec);
//printf("[CLIENT] [SREAD] curr_block=%ld delta_us=%6.3f\n",curr_blk,(delta_us2/1000.0F));
printf("[CLIENT] [SREAD] curr_block=%ld delta_us=%6.3f\n",curr_blk,(delta_us2/1000.0F));
pthread_mutex_unlock(&lock);
if( err != -1){
......@@ -689,7 +689,7 @@ int imss_sread(const char *path, char *buf, size_t size, off_t offset)
}
gettimeofday(&end1, NULL);
delta_us1 = (float) (end1.tv_usec - start1.tv_usec);
//printf("[CLIENT] [SREAD_END] delta_us=%6.3f\n",(delta_us1/1000.0F));
printf("[CLIENT] [SREAD_END] delta_us=%6.3f\n",(delta_us1/1000.0F));
free(rpath);
return byte_count;
}
......
......@@ -110,7 +110,7 @@ class map_records
return 0;
}
//printf("Nodename - %s GET-%s \n", detect.nodename, key.c_str());
printf("Nodename - %s GET-%s \n", detect.nodename, key.c_str());
//Assign the values obtained to the provided references.
//std::cout <<"Exist " << key << '\n';
*(add_) = it->second.first;
......
......@@ -2064,7 +2064,7 @@ split_readv(void * th_argv)
}
gettimeofday(&end, NULL);
delta_us = (float) (end.tv_usec - start.tv_usec);
// printf("\n[CLIENT] [S_SPLIT_READ] recv data delta_us=%6.3f\n",(delta_us/1000.0F));
printf("\n[CLIENT] [S_SPLIT_READ] recv data delta_us=%6.3f\n",(delta_us/1000.0F));
//Check if the requested key was correctly retrieved.
if (strncmp((const char *) arguments->buffer, "$ERRIMSS_NO_KEY_AVAIL$", 22)){
}
......@@ -2163,7 +2163,7 @@ get_data(int32_t dataset_id,
{
int32_t n_server;
//Server containing the corresponding data to be retrieved.
if ((n_server = get_data_location(dataset_id, data_id, GET)) == -1){
return -1;
......@@ -2228,12 +2228,13 @@ get_data(int32_t dataset_id,
gettimeofday(&end, NULL);
delta_us = (float) (end.tv_usec - start.tv_usec);
//printf("\n[CLIENT] [SREAD] send petition delta_us=%6.3f\n",(delta_us/1000.0F));
printf("\n[CLIENT] [GET DATA] send petition delta_us=%6.3f\n",(delta_us/1000.0F));
gettimeofday(&start, NULL);
//printf("GET_DATA after send petition to read\n");
//Receive data related to the previous read request directly into the buffer.
printf("GET_DATA comm_recv size=%d\n",curr_dataset.data_entity_size);
if (comm_recv(curr_imss.conns.sockets_[repl_servers[i]], buffer, curr_dataset.data_entity_size, 0) == -1)
{
if (errno != EAGAIN)
......@@ -2246,7 +2247,7 @@ get_data(int32_t dataset_id,
}
gettimeofday(&end, NULL);
delta_us = (float) (end.tv_usec - start.tv_usec);
//printf("\n[CLIENT] [SREAD] recv data delta_us=%6.3f\n",(delta_us/1000.0F));
printf("[CLIENT] [GET DATA] recv data delta_us=%6.3f\n",(delta_us/1000.0F));
//Check if the requested key was correctly retrieved.
if (strncmp((const char *) buffer, "$ERRIMSS_NO_KEY_AVAIL$", 22)){
......
......@@ -155,10 +155,13 @@ srv_worker (void * th_argv)
//Initialize ZeroMQ messages.
zmq_msg_init (&client_id);
zmq_msg_init (&client_req);
printf("[SRV_WORKER] waiting_massage\n");
//Save the identity of the requesting client.
comm_msg_recv(&client_id, socket, 0);
struct timeval start, end;
float delta_us;
gettimeofday(&start, NULL);
//Check if a timeout was triggered in the previous receive operation.
......@@ -205,9 +208,6 @@ srv_worker (void * th_argv)
//Save the request to be served.
comm_msg_recv(&client_req, socket, 0);
struct timeval start, end;
float delta_us;
gettimeofday(&start, NULL);
struct timeval start2, end2;
float delta_us2;
......@@ -220,13 +220,6 @@ srv_worker (void * th_argv)
pthread_exit(NULL);
}
gettimeofday(&end2, NULL);
delta_us2 = (float) (end2.tv_usec - start2.tv_usec);
//printf("\n[SERVER] getsockopt delta_us=%6.3f\n",(delta_us2/1000.0F));
//Expeted incomming message format: "SIZE_IN_KB KEY"
gettimeofday(&start2, NULL);
//Reference to the client request.
char * req = (char *) zmq_msg_data(&client_req);
......@@ -242,15 +235,10 @@ srv_worker (void * th_argv)
std::string key;
key.assign((const char *) uri_);
//printf("REQUEST: %s (%ld)\n", key.c_str(), block_size_recv);
//Information associated to the arriving key.
unsigned char * address_;
uint64_t block_size_rtvd;
gettimeofday(&end2, NULL);
delta_us2 = (float) (end2.tv_usec - start2.tv_usec);
//printf("\n[SERVER] variables delta_us=%6.3f\n",(delta_us2/1000.0F));
//Differentiate between READ and WRITE operations.
switch (more)
......@@ -305,11 +293,11 @@ srv_worker (void * th_argv)
}
gettimeofday(&end2, NULL);
delta_us2 = (float) (end2.tv_usec - start2.tv_usec);
//printf("\n[SERVER] send delta_us=%6.3f\n",(delta_us2/1000.0F));
printf("[SRV_WORKER] send delta_us=%6.3f\n",(delta_us2/1000.0F));
}
gettimeofday(&end, NULL);
delta_us = (float) (end.tv_usec - start.tv_usec);
//printf("\n[SERVER] [END] delta_us=%6.3f\n",(delta_us/1000.0F));
printf("[SRV_WORKER] [END] delta_us=%6.3f\n\n",(delta_us/1000.0F));
break;
}
......
......@@ -48,7 +48,7 @@ int32_t REPL_FACTOR = 1; //Default none
int32_t IMSS_DEBUG = 0;
uint16_t PREFETCH = 6;
uint16_t MULTIPLE_READ = 4;//1=vread with prefetch, 2=vread without prefetch,
uint16_t MULTIPLE_READ = 0;//1=vread with prefetch, 2=vread without prefetch,
//3=vread_2x 4=imss_split_readv else sread
uint16_t MULTIPLE_WRITE = 0;//1=writev, else sread
char prefetch_path[256];
......@@ -642,6 +642,7 @@ ssize_t write(int fd, const void *buf, size_t size){
ssize_t read(int fd, void *buf, size_t size){
real_read = dlsym(RTLD_NEXT,"read");
printf("read=%d\n",fd);
size_t ret;
unsigned long p = 0;
char * path = (char *) calloc(256, sizeof(char));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment