/* print all simulator stats */ void sim_print_stats(FILE *fd) /* output stream */ { #if 0 /* not portable... :-( */ extern char etext, *sbrk(int); #endif if (!running) return; /* get stats time */ sim_end_time = time((time_t *)NULL); sim_elapsed_time = MAX(sim_end_time - sim_start_time, 1); #if 0 /* not portable... :-( */ /* compute simulator memory usage */ sim_mem_usage = (sbrk(0) - &etext) / 1024; #endif /********** Modification for ACAPP tool **********/ printCacheStats(); /* print simulation stats */ fprintf(fd, "\nsim: ** simulation statistics **\n"); stat_print_stats(sim_sdb, fd); sim_aux_stats(fd); fprintf(fd, "\n"); }
/* print all simulator stats */ void sim_print_stats(FILE *fd) /* output stream */ { #if 0 /* not portable... :-( */ extern char etext, *sbrk(int); #endif if (!running) return; /* get stats time */ sim_end_time = time((time_t *)NULL); sim_elapsed_time = MAX(sim_end_time - sim_start_time, 1); #if 0 /* not portable... :-( */ /* compute simulator memory usage */ sim_mem_usage = (sbrk(0) - &etext) / 1024; #endif /* print simulation stats */ fprintf(fd, "\nsim: ** simulation statistics **\n"); stat_print_stats(sim_sdb, fd); sim_aux_stats(fd); fprintf(fd, "\n"); printf(" Number of block polluted is %d\n",no_blks_polluted); }
//print all simulator stats to output stream fd void sim_print_stats(FILE *fd) { #if 0 //not portable... :-( extern char etext, *sbrk(int); #endif if(!running) { return; } //get stats time sim_end_time = time((time_t *)NULL); sim_elapsed_time = MAX(sim_end_time - sim_start_time, 1); #if 0 //not portable... :-( //compute simulator memory usag sim_mem_usage = (sbrk(0) - &etext) / 1024; #endif //print simulation stats fprintf(fd, "\nsim: ** simulation statistics **\n"); stat_print_stats(sim_sdb, fd); sim_aux_stats(fd); fprintf(fd, "\n"); }
/* print all simulator stats */ void sim_print_stats (FILE * fd) /* output stream */ { if (!running) return; /* get stats time */ sim_end_time = time ((time_t *) NULL); sim_elapsed_time = max2 (sim_end_time - sim_start_time, 1); /* compute this before calling stat_print_stats */ total_interconnect_power_stats (); /* print simulation stats */ fprintf (fd, "\nsim: ** simulation statistics **\n"); stat_print_stats (sim_sdb, fd); sim_aux_stats (fd); #ifdef POPNET power_report(fd); delay_report(fd); #endif fprintf (fd, "\n"); if(hotspot_active) hotspot_dumpstats(); fflush(fd); }
/* print all simulator stats */ void sim_print_stats(FILE *fd) /* output stream */ { #if 0 /* not portable... :-( */ extern char etext, *sbrk(int); #endif if (!running) return; /* get stats time */ sim_end_time = time((time_t *)NULL); sim_elapsed_time = MAX(sim_end_time - sim_start_time, 1); #if 0 /* not portable... :-( */ /* compute simulator memory usage */ sim_mem_usage = (sbrk(0) - &etext) / 1024; #endif /* print simulation stats */ fprintf(fd, "\nsim: ** simulation statistics **\n"); stat_print_stats(sim_sdb, fd); sim_aux_stats(fd); fprintf(fd, "\n"); //Yuanwen Added here struct stat_stat_t * stat_max_power = stat_find_stat(sim_sdb, "max_cycle_power_cc3"); FILE *f=fopen("MaxPower.txt", "w"); fprintf(f, "%g", *stat_max_power->variant.for_double.var); //Yuanwen Added /* instantiate a new evaluator to avoid recursion problems */ struct eval_state_t *es = eval_new(stat_eval_ident, sim_sdb); //stat_eval_ident() is a function char *endp; struct stat_stat_t * stat_avg_total_power = stat_find_stat(sim_sdb, "avg_total_power_cycle_cc3"); struct eval_value_t val = eval_expr(es, stat_avg_total_power->variant.for_formula.formula, &endp); // if (eval_error != ERR_NOERR || *endp != '\0') // fprintf(fd, "<error: %s>", eval_err_str[eval_error]); // else // myfprintf(fd, stat->format, eval_as_double(val)); // fprintf(fd, " # %s", stat->desc); fprintf(f, ",%g", eval_as_double(val)); struct stat_stat_t * stat_1 = stat_find_stat(sim_sdb, "avg_alu_power_cc3"); struct eval_value_t val_1 = eval_expr(es, stat_1->variant.for_formula.formula, &endp); fprintf(f, ",%g", eval_as_double(val_1)); struct stat_stat_t * stat_2 = stat_find_stat(sim_sdb, "avg_lsq_power_cc3"); struct eval_value_t val_2 = eval_expr(es, stat_2->variant.for_formula.formula, &endp); fprintf(f, ",%g", eval_as_double(val_2)); /* done with the evaluator */ eval_delete(es); fclose(f); }
/* print all simulator stats */ void sim_print_stats(FILE *fd) /* output stream */ { #if 0 /* not portable... :-( */ extern char etext, *sbrk(int); #endif if (!running) return; /* get stats time */ sim_end_time = time((time_t *)NULL); sim_elapsed_time = MAX(sim_end_time - sim_start_time, 1); #if 0 /* not portable... :-( */ /* compute simulator memory usage */ sim_mem_usage = (sbrk(0) - &etext) / 1024; #endif /********** Modification for ACAPP tool **********/ // printf("%d\n", profile_level); if(profile_level==2){ // int h = hitOrMissFunc(dset, dtag); int i; for(i=0; i<=profile_max-profile_min; i++){ printCacheStats(pcache2[i]); } } if(profile_level==1){ // int h = hitOrMissFunc(dset, dtag); int i; for(i=0; i<=profile_max-profile_min; i++){ printCacheStats(pcache1[i]); } } /* print simulation stats */ fprintf(fd, "\nsim: ** simulation statistics **\n"); stat_print_stats(sim_sdb, fd); sim_aux_stats(fd); fprintf(fd, "\n"); }
/* print all simulator stats */ void sim_print_stats(FILE *fd) /* output stream */ { char *s; time_t sim_current_time; #if 0 /* not portable... :-( */ extern char etext, *sbrk(int); #endif if (!running) return; if (fdump) fclose(fdump); /* get stats time */ sim_end_time = time((time_t *)NULL); sim_elapsed_time = MAX(sim_end_time - sim_start_time, 1); #if 0 /* not portable... :-( */ /* compute simulator memory usage */ sim_mem_usage = (sbrk(0) - &etext) / 1024; #endif /* print simulation stats */ sim_current_time = time((time_t *)NULL); s = ctime(&sim_current_time); if (s[strlen(s)-1] == '\n') s[strlen(s)-1] = '\0'; fprintf(fd, "\nsim: ** simulation statistics @ %s **\n", s); sim_aux_stats(fd); fprintf(fd, "\n"); }