void arena::dump_arena_statistics () { statistics_counters total; for( unsigned i = 0; i < my_num_slots; ++i ) { #if __TBB_STATISTICS_EARLY_DUMP generic_scheduler* s = my_slots[i].my_scheduler; if ( s ) *my_slots[i].my_counters += s->my_counters; #else __TBB_ASSERT( !my_slots[i].my_scheduler, NULL ); #endif if ( i != 0 ) { total += *my_slots[i].my_counters; dump_statistics( *my_slots[i].my_counters, i ); } } dump_statistics( *my_slots[0].my_counters, 0 ); #if __TBB_STATISTICS_STDOUT #if !__TBB_STATISTICS_TOTALS_ONLY printf( "----------------------------------------------\n" ); #endif dump_statistics( total, workers_counters_total ); total += *my_slots[0].my_counters; dump_statistics( total, arena_counters_total ); #if !__TBB_STATISTICS_TOTALS_ONLY printf( "==============================================\n" ); #endif #endif /* __TBB_STATISTICS_STDOUT */ }
void EXP_Class::finalise_genotypes_loop( void ){ if( !(generation%param->dump_stats_every) ) dump_statistics( param->statsFileDir, param->statsFileName, generation); if( !(generation%param->dump_genome_every) ) param->ga->dump_genome_into_file( param->genomeFileDir, param->genomeFileName, generation ); //This is the function that create s a new generation of solutions (genotypes) param->ga->breeding(); }
// called at atexit() to free malloced memory in variable global; void release_default_global() { // clean threads; if (global.cluster_mode == CLUSTER_CLIENT || global.cluster_mode == CLUSTER_SINGLETON) { release_client(); } else { // TODO(weizhenwei): master thread clean utils; release_server(); } pthread_mutex_destroy(&total_thread_mutex); dmd_log(LOG_ERR, "in function %s, before dump stats!\n", __func__); // dump and release global statistics; pthread_mutex_lock(&global_stats->mutex); dump_statistics(global_stats); pthread_mutex_unlock(&global_stats->mutex); release_statistics(global_stats); // close database connection; close_db(opendmd_db); }
/**************************************************************************************** * Function name - dump_snapshot_interval * * Description - Dumps summary statistics since the start of load * Input - *bctx - pointer to batch structure * now - current time in msec since epoch * Return Code/Output - None ****************************************************************************************/ void dump_snapshot_interval (batch_context* bctx, unsigned long now) { if (!stop_loading) { fprintf(stdout, "\033[2J"); } int i; int total_current_clients = 0; for (i = 0; i <= threads_subbatches_num; i++) { total_current_clients += pending_active_and_waiting_clients_num_stat (bctx + i); } dump_snapshot_interval_and_advance_total_statistics (bctx, now, total_current_clients); int seconds_run = (int)(now - bctx->start_time)/ 1000; if (!seconds_run) { seconds_run = 1; } fprintf(stdout,"--------------------------------------------------------------------------------\n"); fprintf(stdout,"Summary stats (runs:%d secs, CAPS-average:%ld):\n", seconds_run, bctx->op_total.call_init_count / seconds_run); dump_statistics (seconds_run, &bctx->http_total, &bctx->https_total); fprintf(stdout,"============================================================" "=====================\n"); long total_clients_rampup_inc = 0; int total_client_num_max = 0; for (i = 0; i <= threads_subbatches_num; i++) { total_clients_rampup_inc += (bctx + i)->clients_rampup_inc; total_client_num_max += (bctx + i)->client_num_max; } if (bctx->do_client_num_gradual_increase && (bctx->stop_client_num_gradual_increase == 0)) { fprintf(stdout," Automatic: adding %ld clients/sec. Stop inc and manual [M].\n", total_clients_rampup_inc); } else { const int current_clients = pending_active_and_waiting_clients_num_stat (bctx); fprintf(stdout," Manual: clients:max[%d],curr[%d]. Inc num: [+|*].", total_client_num_max, total_current_clients); if (bctx->stop_client_num_gradual_increase && bctx->clients_rampup_inc && current_clients < bctx->client_num_max) { fprintf(stdout," Automatic: [A].\n"); } else { fprintf(stdout,"\n"); } } fprintf(stdout,"============================================================" "=====================\n"); fflush (stdout); }
/**************************************************************************************** * 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); }
/*---------------------------------------------------------------------*/ static void bmem_dump( int _ ) { ____GC_gcollect(); dump_statistics(); }