Basically this is cpgbench.c */
| 368 | |
| 369 | /* Basically this is cpgbench.c */ |
| 370 | static void cpg_flood ( |
| 371 | cpg_handle_t handle_in, |
| 372 | int write_size) |
| 373 | { |
| 374 | struct timeval tv1, tv2, tv_elapsed; |
| 375 | struct iovec iov; |
| 376 | unsigned int res = CS_OK; |
| 377 | |
| 378 | alarm_notice = 0; |
| 379 | iov.iov_base = data; |
| 380 | iov.iov_len = write_size; |
| 381 | |
| 382 | alarm (10); |
| 383 | packets_recvd1 = 0; |
| 384 | interim_avg_rtt = 0; |
| 385 | interim_max_rtt = 0; |
| 386 | interim_min_rtt = LONG_MAX; |
| 387 | |
| 388 | gettimeofday (&tv1, NULL); |
| 389 | do { |
| 390 | if (res == CS_OK) { |
| 391 | set_packet(write_size, send_counter); |
| 392 | } |
| 393 | |
| 394 | res = cpg_mcast_joined (handle_in, CPG_TYPE_AGREED, &iov, 1); |
| 395 | if (res == CS_OK) { |
| 396 | /* Only increment the packet counter if it was sucessfully sent */ |
| 397 | packets_sent++; |
| 398 | send_counter++; |
| 399 | } |
| 400 | else { |
| 401 | if (res == CS_ERR_TRY_AGAIN) { |
| 402 | send_retries++; |
| 403 | } |
| 404 | else { |
| 405 | send_fails++; |
| 406 | } |
| 407 | } |
| 408 | } while (!stopped && alarm_notice == 0 && (res == CS_OK || res == CS_ERR_TRY_AGAIN)); |
| 409 | gettimeofday (&tv2, NULL); |
| 410 | timersub (&tv2, &tv1, &tv_elapsed); |
| 411 | |
| 412 | if (!quiet) { |
| 413 | if (machine_readable) { |
| 414 | cpgh_log_printf (CPGH_LOG_PERF, "%d%c%d%c%f%c%f%c%f%c%ld%c%ld%c%ld\n", packets_recvd1, delimiter, write_size, delimiter, |
| 415 | (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)), delimiter, |
| 416 | ((float)packets_recvd1) / (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)), delimiter, |
| 417 | ((float)packets_recvd1) * ((float)write_size) / ((tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)) * 1000000.0), delimiter, |
| 418 | interim_min_rtt, delimiter, interim_avg_rtt, delimiter, interim_max_rtt); |
| 419 | } |
| 420 | else { |
| 421 | cpgh_log_printf (CPGH_LOG_PERF, "%5d messages received ", packets_recvd1); |
| 422 | cpgh_log_printf (CPGH_LOG_PERF, "%5d bytes per write ", write_size); |
| 423 | cpgh_log_printf (CPGH_LOG_PERF, "%7.3f Seconds runtime ", |
| 424 | (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0))); |
| 425 | cpgh_log_printf (CPGH_LOG_PERF, "%9.3f TP/s ", |
| 426 | ((float)packets_recvd1) / (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0))); |
| 427 | cpgh_log_printf (CPGH_LOG_PERF, "%7.3f MB/s ", |
no test coverage detected