Skip to content

Commit

Permalink
Merge pull request #7834 from huaxiangfan/per-conn-info
Browse files Browse the repository at this point in the history
APPS/IODEMO: print per-connection info
  • Loading branch information
yosefe authored Jan 31, 2022
2 parents 9c10fa7 + 1740446 commit 32af88c
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion test/apps/iodemo/io_demo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ typedef struct {
unsigned progress_count;
const char* src_addr;
bool prereg;
bool per_conn_info;
} options_t;

#define LOG_PREFIX "[DEMO]"
Expand Down Expand Up @@ -2388,6 +2389,9 @@ class DemoClient : public P2pDemoCommon {
server_info_t& server_info = _server_info[server_index];
long total_completed = 0;
size_t total_bytes_completed = 0;
UcxLog conn_log(server_info.conn->get_log_prefix(),
opts().per_conn_info);

for (int op = 0; op <= IO_OP_MAX; ++op) {
size_t bytes_completed;
long num_completed;
Expand Down Expand Up @@ -2422,6 +2426,17 @@ class DemoClient : public P2pDemoCommon {
std::max(num_completed, io_op_perf_info[op].max);
io_op_perf_info[op].total += num_completed;
io_op_perf_info[op].total_bytes += bytes_completed;

if (opts().per_conn_info) {
double mbs = bytes_completed / (elapsed * UCS_MBYTE);
long iops = (long)(num_completed / elapsed);
const char *name = (op == IO_OP_MAX) ?
"total" : io_op_names[op];
const char *tail = (op == IO_OP_MAX) ? "" : " | ";

conn_log << name << " " << mbs << "MBs " << "iops: "
<< iops << tail;
}
}
}

Expand Down Expand Up @@ -2658,9 +2673,10 @@ static int parse_args(int argc, char **argv, options_t *test_opts)
test_opts->progress_count = 1;
test_opts->src_addr = NULL;
test_opts->prereg = false;
test_opts->per_conn_info = false;

while ((c = getopt(argc, argv,
"p:c:r:d:b:i:w:a:k:o:t:n:l:s:y:vqeADHP:m:L:I:z")) != -1) {
"p:c:r:d:b:i:w:a:k:o:t:n:l:s:y:vqeADHP:m:L:I:zV")) != -1) {
switch (c) {
case 'p':
test_opts->port_num = atoi(optarg);
Expand Down Expand Up @@ -2811,6 +2827,9 @@ static int parse_args(int argc, char **argv, options_t *test_opts)
case 'z':
test_opts->prereg = true;
break;
case 'V':
test_opts->per_conn_info = true;
break;
case 'h':
default:
std::cout << "Usage: io_demo [options] [server_address]" << std::endl;
Expand Down Expand Up @@ -2853,6 +2872,7 @@ static int parse_args(int argc, char **argv, options_t *test_opts)
std::cout << " -L <progress_count> Maximal number of consecutive ucp_worker_progress invocations" << std::endl;
std::cout << " -I <src_addr> Set source IP address to select network interface on client side" << std::endl;
std::cout << " -z Enable pre-register buffers for zero-copy" << std::endl;
std::cout << " -V Print per-connection info" << std::endl;
return -1;
}
}
Expand Down

0 comments on commit 32af88c

Please sign in to comment.