/* * Initialize usnic module statistics */ int opal_btl_usnic_stats_init(opal_btl_usnic_module_t *module) { if (mca_btl_usnic_component.stats_enabled) { usnic_stats_reset(module); module->stats.timeout.tv_sec = mca_btl_usnic_component.stats_frequency; module->stats.timeout.tv_usec = 0; opal_event_set(opal_event_base, &(module->stats.timer_event), -1, EV_TIMEOUT | EV_PERSIST, &usnic_stats_callback, module); opal_event_add(&(module->stats.timer_event), &(module->stats.timeout)); } return OPAL_SUCCESS; }
/* Prints a few terse statistics lines via opal_output(0,...). The first * line will be prefixed with the string "prefix". If "reset_stats" is true * then the statistics will be reset after printing. * * NOTE: this routine ignores the setting of stats_enable, so it can be used * for debugging routines even when normal stats reporting is not enabled. */ void opal_btl_usnic_print_stats( opal_btl_usnic_module_t *module, const char *prefix, bool reset_stats) { char tmp[128], str[2048]; /* The usuals */ snprintf(str, sizeof(str), "%s:MCW:%3u, ST(P+D)/F/C/R(T+F)/A:%8lu(%8u+%8u)/%8lu/%8lu/%4lu(%4lu+%4lu)/%8lu, RcvTot/Chk/F/C/L/H/D/BF/A:%8lu/%c%c/%8lu/%8lu/%4lu+%2lu/%4lu/%4lu/%6lu OA/DA %4lu/%4lu CRC:%4lu ", prefix, opal_proc_local_get()->proc_name.vpid, module->stats.num_total_sends, module->mod_channels[USNIC_PRIORITY_CHANNEL].num_channel_sends, module->mod_channels[USNIC_DATA_CHANNEL].num_channel_sends, module->stats.num_frag_sends, module->stats.num_chunk_sends, module->stats.num_resends, module->stats.num_timeout_retrans, module->stats.num_fast_retrans, module->stats.num_ack_sends, module->stats.num_total_recvs, (module->stats.num_total_recvs - module->stats.num_recv_reposts) == 0 ? 'g' : 'B', (module->stats.num_total_recvs - module->stats.num_frag_recvs - module->stats.num_chunk_recvs - module->stats.num_badfrag_recvs - module->stats.num_oow_low_recvs - module->stats.num_oow_high_recvs - module->stats.num_dup_recvs - module->stats.num_ack_recvs - module->stats.num_unk_recvs) == 0 ? 'g' : 'B', module->stats.num_frag_recvs, module->stats.num_chunk_recvs, module->stats.num_oow_low_recvs, module->stats.num_oow_high_recvs, module->stats.num_dup_recvs, module->stats.num_badfrag_recvs, module->stats.num_ack_recvs, module->stats.num_old_dup_acks, module->stats.num_dup_acks, module->stats.num_crc_errors); /* If our PML calls were 0, then show send and receive window extents instead */ if (module->stats.pml_module_sends + module->stats.pml_send_callbacks == 0) { int64_t send_unacked, su_min = WINDOW_SIZE * 2, su_max = 0; int64_t recv_depth, rd_min = WINDOW_SIZE * 2, rd_max = 0; opal_btl_usnic_endpoint_t *endpoint; opal_list_item_t *item; rd_min = su_min = WINDOW_SIZE * 2; rd_max = su_max = 0; opal_mutex_lock(&module->all_endpoints_lock); item = opal_list_get_first(&module->all_endpoints); while (item != opal_list_get_end(&(module->all_endpoints))) { endpoint = container_of(item, mca_btl_base_endpoint_t, endpoint_endpoint_li); item = opal_list_get_next(item); /* Number of un-acked sends (i.e., sends for which we're still waiting for ACK) */ send_unacked = endpoint->endpoint_next_seq_to_send - endpoint->endpoint_ack_seq_rcvd - 1; if (send_unacked > su_max) su_max = send_unacked; if (send_unacked < su_min) su_min = send_unacked; /* Receive window depth (i.e., difference between highest seq received and the next message we haven't ACKed yet) */ recv_depth = endpoint->endpoint_highest_seq_rcvd - endpoint->endpoint_next_contig_seq_to_recv; if (recv_depth > rd_max) rd_max = recv_depth; if (recv_depth < rd_min) rd_min = recv_depth; } opal_mutex_unlock(&module->all_endpoints_lock); snprintf(tmp, sizeof(tmp), "PML S:%1ld, Win!A/R:%4ld/%4ld %4ld/%4ld", module->stats.pml_module_sends, su_min, su_max, rd_min, rd_max); } else { snprintf(tmp, sizeof(tmp), "PML S/CB/Diff:%4lu/%4lu=%4ld", module->stats.pml_module_sends, module->stats.pml_send_callbacks, module->stats.pml_module_sends - module->stats.pml_send_callbacks); } strncat(str, tmp, sizeof(str) - strlen(str) - 1); opal_output(0, "%s", str); if (reset_stats) { usnic_stats_reset(module); } }