int create_client(t_info *info, char **buf) { while (strncmp(*buf, END_LIST_PLAYER, strlen(END_LIST_PLAYER))) if (loop(info, buf) < 0) return (-1); skip_from_buf(buf); dump_clients(info); return (0); }
/**************************************************************************************** * Function name - dump_final_statistics * * Description - Dumps final statistics counters to stdout and statistics file using * print_snapshot_interval_statistics and print_statistics_* functions. * At the end calls dump_clients () to dump the clients table. * * Input - *cctx - pointer to client context, where the decision to * complete loading (and dump) has been made. * Return Code/Output - None ****************************************************************************************/ void dump_final_statistics (client_context* cctx) { int i; batch_context* bctx = cctx->bctx; unsigned long now = get_tick_count(); for (i = 0; i <= threads_subbatches_num; i++) { if (i) { stat_point_add (&bctx->http_delta, &(bctx + i)->http_delta); stat_point_add (&bctx->https_delta, &(bctx + i)->https_delta); /* Other threads statistics - reset just after collecting */ stat_point_reset (&(bctx + i)->http_delta); stat_point_reset (&(bctx + i)->https_delta); } } print_snapshot_interval_statistics (now - bctx->last_measure, &bctx->http_delta, &bctx->https_delta); stat_point_add (&bctx->http_total, &bctx->http_delta); stat_point_add (&bctx->https_total, &bctx->https_delta); fprintf(stdout,"\n===================================================" "====================================\n"); fprintf(stdout,"End of the test for batch: %-10.10s\n", bctx->batch_name); fprintf(stdout,"======================================================" "=================================\n\n"); now = get_tick_count(); const int seconds_run = (int)(now - bctx->start_time)/ 1000; if (!seconds_run) return; fprintf(stdout,"\nTest total duration was %d seconds and CAPS average %ld:\n", seconds_run, bctx->op_total.call_init_count / seconds_run); dump_statistics (seconds_run, &bctx->http_total, &bctx->https_total); for (i = 0; i <= threads_subbatches_num; i++) { if (i) { op_stat_point_add (&bctx->op_delta, &(bctx + i)->op_delta ); /* Other threads operational statistics - reset just after collecting */ op_stat_point_reset (&(bctx + i)->op_delta); } } op_stat_point_add (&bctx->op_total, &bctx->op_delta); print_operational_statistics (bctx->opstats_file, &bctx->op_delta, &bctx->op_total, bctx->url_ctx_array); if (bctx->statistics_file) { print_statistics_footer_to_file (bctx->statistics_file); print_statistics_header (bctx->statistics_file); const unsigned long loading_t = now - bctx->start_time; const unsigned long loading_time = loading_t ? loading_t : 1; print_statistics_data_to_file (bctx->statistics_file, loading_time/1000, UNSECURE_APPL_STR, pending_active_and_waiting_clients_num_stat (bctx), &bctx->http_total, loading_time); print_statistics_data_to_file (bctx->statistics_file, loading_time/1000, SECURE_APPL_STR, pending_active_and_waiting_clients_num_stat (bctx), &bctx->https_total, loading_time); } dump_clients (cctx); (void)fprintf (stderr, "\nExited. For details look in the files:\n" "- %s.log for errors and traces;\n" "- %s.txt for loading statistics;\n" "- %s.ctx for virtual client based statistics.\n", bctx->batch_name, bctx->batch_name, bctx->batch_name); if (bctx->dump_opstats) (void)fprintf (stderr,"- %s.ops for operational statistics.\n", bctx->batch_name); (void)fprintf (stderr, "Add -v and -u options to the command line for " "verbose output to %s.log file.\n",bctx->batch_name); }