Skip to content

Commit

Permalink
Added batching as a paramter to camio_perf
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Jul 30, 2015
1 parent b7925b9 commit 472bd18
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 37 deletions.
14 changes: 7 additions & 7 deletions src/drivers/bring/bring_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ static inline ch_word get_head_seq(camio_buffer_t* buffers, ch_word idx)
const ch_word slot_mem_sz = buffers[idx].__internal.__mem_len;
volatile char* hdr_mem = slot_mem + slot_mem_sz;
volatile bring_slot_header_t* hdr = (volatile bring_slot_header_t*) hdr_mem;
__sync_synchronize();
//__sync_synchronize();
volatile ch_word result = ~0;
__sync_synchronize();
//__sync_synchronize();
result = *(volatile ch_word*)(&hdr->seq_no);
__sync_synchronize();

Expand All @@ -100,11 +100,11 @@ static inline ch_word get_head_size(camio_buffer_t* buffers, ch_word idx)
const ch_word slot_mem_sz = buffers[idx].__internal.__mem_len;
volatile char* hdr_mem = slot_mem + slot_mem_sz;
volatile bring_slot_header_t* hdr = (volatile bring_slot_header_t*) hdr_mem;
__sync_synchronize();
//__sync_synchronize();
volatile ch_word result = ~0;
__sync_synchronize();
//__sync_synchronize();
result = *(volatile ch_word*)(&hdr->data_size);
__sync_synchronize();
//__sync_synchronize();

return result;
}
Expand All @@ -119,9 +119,9 @@ static inline void set_head(camio_buffer_t* buffers, ch_word idx, ch_word seq_no
const ch_word slot_mem_sz = buffers[idx].__internal.__mem_len;
volatile char* hdr_mem = slot_mem + slot_mem_sz;
volatile bring_slot_header_t* hdr = (volatile bring_slot_header_t*) hdr_mem;
__sync_synchronize();
//__sync_synchronize();
*(volatile ch_word*)(&hdr->data_size) = data_size;
__sync_synchronize();
//__sync_synchronize();
*(volatile ch_word*)(&hdr->seq_no) = seq_no;
__sync_synchronize();

Expand Down
15 changes: 4 additions & 11 deletions tools/camio_perf/camio_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,10 @@ int main(int argc, char** argv)
printf("NDEBUG defined\n");
#endif
DBG("Starting camio perf!\n");
// ch_opt_addfi(CH_OPTION_OPTIONAL,'e',"fifth","This is the 5th option", &options.opt5, 42.0);
// ch_opt_addxi(CH_OPTION_OPTIONAL,'i',"eighth","This is the 8th option", &options.opt8, 0xDEADBEEF);
// ch_opt_adduu(CH_OPTION_REQUIRED,'a',"first","This is the 1st option", &options.opt1);
// ch_opt_addFU(CH_OPTION_UNLIMTED,'g',"seventh","This is the 7th option", &options.opt7);
// ch_opt_addsi(CH_OPTION_OPTIONAL,'d',"fourth","This is the 4th option", &options.opt4, "init string");
// ch_opt_addii(CH_OPTION_OPTIONAL,'b',"second","This is the 2nd option", &options.opt2, -42);
// ch_opt_addSI(CH_OPTION_OPTIONAL,'f',"sixth","This is the 6th option", &options.opt6, "init strig vector");

ch_opt_addsi(CH_OPTION_OPTIONAL,'c',"client","name or that the client should connect to", &options.client, NULL);
ch_opt_addsi(CH_OPTION_OPTIONAL, 's',"server","put camio_perf in server mode", &options.server, NULL);
ch_opt_addii(CH_OPTION_OPTIONAL,'l',"len","max length of read/write buffer. This may be smaller\n", &options.len, 8 * 1024);
ch_opt_addsi(CH_OPTION_OPTIONAL, 'c', "client","name or that the client should connect to", &options.client, NULL);
ch_opt_addsi(CH_OPTION_OPTIONAL, 's', "server","put camio_perf in server mode", &options.server, NULL);
ch_opt_addii(CH_OPTION_OPTIONAL, 'l', "len","max length of read/write buffer. This may be smaller\n", &options.len, 8 * 1024);
ch_opt_addii(CH_OPTION_OPTIONAL, 'b', "batching","Amount of batching to apply. This will affect the latency vs. throughput\n", &options.batching, 8);
ch_opt_parse(argc,argv);

if(options.client && options.server){
Expand Down
17 changes: 6 additions & 11 deletions tools/camio_perf/camio_perf_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static camio_error_t on_new_wr_datas(camio_muxable_t* muxable, camio_error_t err
return err;
}

data_msgs_len = MSGS_MAX;
data_msgs_len = MIN(MSGS_MAX,options.batching);
err = camio_chan_wr_data_res(muxable->parent.channel, data_msgs, &data_msgs_len );
if(err){
return err;
Expand Down Expand Up @@ -259,7 +259,7 @@ static camio_error_t on_new_wr_buffs(camio_muxable_t* muxable, camio_error_t err
return err;
}

data_msgs_len = MSGS_MAX;
data_msgs_len = MIN(MSGS_MAX,options.batching);
err = camio_chan_wr_buff_res(muxable->parent.channel, data_msgs, &data_msgs_len);
if(err){
ERR("Could not get a writing buffers\n");
Expand All @@ -283,8 +283,8 @@ static camio_error_t get_new_buffers(camio_channel_t* channel)
data_msgs[i].id = i;
}

data_msgs_len = MSGS_MAX;
DBG("Requesting %lli wirte_buffs\n", MSGS_MAX);
data_msgs_len = MIN(MSGS_MAX,options.batching);
DBG("Requesting %lli wirte_buffs\n", data_msgs_len);
camio_error_t err = camio_chan_wr_buff_req( channel, data_msgs, &data_msgs_len);
if(err){
DBG("Could not request buffers with error %lli\n", err);
Expand Down Expand Up @@ -388,12 +388,12 @@ static camio_error_t on_new_channels(camio_muxable_t* muxable, camio_error_t err
static camio_error_t get_new_channels()
{
//Initialize a batch of messages
for(int i = 0; i < MSGS_MAX; i++){
for(int i = 0; i < MIN(MSGS_MAX,options.batching); i++){
ctrl_msgs[i].type = CAMIO_MSG_TYPE_CHAN_REQ;
ctrl_msgs[i].id = i;
}

ctrl_msgs_len = MSGS_MAX;
ctrl_msgs_len = MIN(MSGS_MAX,options.batching);
//DBG("Requesting %lli wirte_buffs\n", MSGS_MAX);
camio_error_t err = camio_ctrl_chan_req(controller, ctrl_msgs, &ctrl_msgs_len);

Expand Down Expand Up @@ -488,11 +488,6 @@ int camio_perf_clinet(ch_cstr client_channel_uri, ch_word* stop)

}

// if(wr_buffer){
// camio_write_release(tmp_channel,&wr_buffer);
// }


return 0;

}
16 changes: 8 additions & 8 deletions tools/camio_perf/camio_perf_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static camio_error_t on_new_rd_datas(camio_muxable_t* muxable, camio_error_t err
return err;
}

data_msgs_len = MSGS_MAX;
data_msgs_len = MIN(MSGS_MAX,options.batching);
err = camio_chan_rd_data_res(muxable->parent.channel, data_msgs, &data_msgs_len );
if(err){
return err;
Expand Down Expand Up @@ -220,7 +220,7 @@ static camio_error_t on_new_rd_buffs(camio_muxable_t* muxable, camio_error_t err
return err;
}

data_msgs_len = MSGS_MAX;
data_msgs_len = MIN(MSGS_MAX,options.batching);
err = camio_chan_rd_buff_res(muxable->parent.channel, data_msgs, &data_msgs_len);
if(err){
ERR("Could not get a writing buffers\n");
Expand Down Expand Up @@ -269,7 +269,7 @@ static camio_error_t get_new_buffers(camio_channel_t* channel)
{

//Initialize a batch of messages to request some write buffers
for(int i = 0; i < MSGS_MAX; i++){
for(int i = 0; i < MIN(MSGS_MAX,options.batching); i++){
data_msgs[i].type = CAMIO_MSG_TYPE_READ_BUFF_REQ;
data_msgs[i].id = i;
camio_rd_buff_req_t* req = &data_msgs[i].rd_buff_req;
Expand All @@ -278,8 +278,8 @@ static camio_error_t get_new_buffers(camio_channel_t* channel)
req->read_size_hint = CAMIO_READ_REQ_SIZE_ANY;
}

data_msgs_len = MSGS_MAX;
DBG("Requesting %lli read_buffs\n", MSGS_MAX);
data_msgs_len = MIN(MSGS_MAX,options.batching);
DBG("Requesting %lli read_buffs\n", data_msgs_len);
camio_error_t err = camio_chan_rd_buff_req( channel, data_msgs, &data_msgs_len);
if(err){
DBG("Could not request buffers with error %lli\n", err);
Expand All @@ -305,7 +305,7 @@ static camio_error_t on_new_channels(camio_muxable_t* muxable, camio_error_t err
return err;
}

ctrl_msgs_len = MSGS_MAX;
ctrl_msgs_len = MIN(MSGS_MAX,options.batching);
err = camio_ctrl_chan_res(muxable->parent.controller, ctrl_msgs, &ctrl_msgs_len );
if(err){
return err;
Expand Down Expand Up @@ -364,12 +364,12 @@ static camio_error_t get_new_channels()
{
//DBG("Trying to get some new channels\n");
//Initialize a batch of messages
for(int i = 0; i < MSGS_MAX; i++){
for(int i = 0; i < MIN(MSGS_MAX,options.batching); i++){
ctrl_msgs[i].type = CAMIO_MSG_TYPE_CHAN_REQ;
ctrl_msgs[i].id = i;
}

ctrl_msgs_len = MSGS_MAX;
ctrl_msgs_len = MIN(MSGS_MAX,options.batching);
//DBG("Requesting %lli channel\n", MSGS_MAX);
camio_error_t err = camio_ctrl_chan_req(controller, ctrl_msgs, &ctrl_msgs_len);

Expand Down
1 change: 1 addition & 0 deletions tools/camio_perf/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ struct options_t {
ch_cstr client;
ch_cstr server;
ch_word len;
ch_word batching;
};

#endif /* OPTIONS_H_ */

0 comments on commit 472bd18

Please sign in to comment.