예제 #1
0
파일: main.c 프로젝트: nkarkala/pollution
/* 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);
}
예제 #2
0
파일: main.c 프로젝트: alanxiaoyi/XAMP_GOOD
/* 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");
}
예제 #3
0
//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);
}
예제 #5
0
/* 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);
}
예제 #6
0
파일: sim-cheetah.c 프로젝트: plessl/zippy
/* local machine state accessor */
static char *					/* err str, NULL for no err */
cheetah_mstate_obj(FILE *stream,		/* output stream */
		   char *cmd,			/* optional command string */
		   struct regs_t *regs,		/* registers to access */
		   struct mem_t *mem)		/* memory to access */
{
  sim_end_time = time((time_t *)NULL);
  sim_elapsed_time = MAX(sim_end_time - sim_start_time, 1);

  /* print simulation stats */
  fprintf(stream, "\nsim: ** simulation statistics **\n");
  stat_print_stats(sim_sdb, stream);

  /* print libcheetah stats */
  cheetah_stats(stream, /* mid */TRUE);

  /* no error */
  return NULL;
}
예제 #7
0
/* 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");
}
예제 #8
0
파일: stats.c 프로젝트: kirtgoh/emics
void
main(void)
{
  struct stat_sdb_t *sdb;
  struct stat_stat_t *stat, *stat1, *stat2, *stat3, *stat4, *stat5;
  int an_int;
  unsigned int a_uint;
  float a_float;
  double a_double;
  static char *my_imap[8] = {
    "foo", "bar", "uxxe", "blah", "gaga", "dada", "mama", "googoo"
  };

  /* make stats database */
  sdb = stat_new();

  /* register stat variables */
  stat_reg_int(sdb, "stat.an_int", "An integer stat variable.",
	       &an_int, 1, NULL);
  stat_reg_uint(sdb, "stat.a_uint", "An unsigned integer stat variable.",
		&a_uint, 2, "%u (unsigned)");
  stat_reg_float(sdb, "stat.a_float", "A float stat variable.",
		 &a_float, 3, NULL);
  stat_reg_double(sdb, "stat.a_double", "A double stat variable.",
		  &a_double, 4, NULL);
  stat_reg_formula(sdb, "stat.a_formula", "A double stat formula.",
		   "stat.a_float / stat.a_uint", NULL);
  stat_reg_formula(sdb, "stat.a_formula1", "A double stat formula #1.",
		   "2 * (stat.a_formula / (1.5 * stat.an_int))", NULL);
  stat_reg_formula(sdb, "stat.a_bad_formula", "A double stat formula w/error.",
		   "stat.a_float / (stat.a_uint - 2)", NULL);
  stat = stat_reg_dist(sdb, "stat.a_dist", "An array distribution.",
		       0, 8, 1, PF_ALL, NULL, NULL, NULL);
  stat1 = stat_reg_dist(sdb, "stat.a_dist1", "An array distribution #1.",
			0, 8, 4, PF_ALL, NULL, NULL, NULL);
  stat2 = stat_reg_dist(sdb, "stat.a_dist2", "An array distribution #2.",
			0, 8, 1, (PF_PDF|PF_CDF), NULL, NULL, NULL);
  stat3 = stat_reg_dist(sdb, "stat.a_dist3", "An array distribution #3.",
			0, 8, 1, PF_ALL, NULL, my_imap, NULL);
  stat4 = stat_reg_sdist(sdb, "stat.a_sdist", "A sparse array distribution.",
			 0, PF_ALL, NULL, NULL);
  stat5 = stat_reg_sdist(sdb, "stat.a_sdist1",
			 "A sparse array distribution #1.",
			 0, PF_ALL, "0x%08lx        %10lu %6.2f %6.2f",
			 NULL);

  /* print initial stats */
  fprintf(stdout, "** Initial stats...\n");
  stat_print_stats(sdb, stdout);

  /* adjust stats */
  an_int++;
  a_uint++;
  a_float *= 2;
  a_double *= 4;

  stat_add_sample(stat, 8);
  stat_add_sample(stat, 8);
  stat_add_sample(stat, 1);
  stat_add_sample(stat, 3);
  stat_add_sample(stat, 4);
  stat_add_sample(stat, 4);
  stat_add_sample(stat, 7);

  stat_add_sample(stat1, 32);
  stat_add_sample(stat1, 32);
  stat_add_sample(stat1, 1);
  stat_add_sample(stat1, 12);
  stat_add_sample(stat1, 17);
  stat_add_sample(stat1, 18);
  stat_add_sample(stat1, 30);

  stat_add_sample(stat2, 8);
  stat_add_sample(stat2, 8);
  stat_add_sample(stat2, 1);
  stat_add_sample(stat2, 3);
  stat_add_sample(stat2, 4);
  stat_add_sample(stat2, 4);
  stat_add_sample(stat2, 7);

  stat_add_sample(stat3, 8);
  stat_add_sample(stat3, 8);
  stat_add_sample(stat3, 1);
  stat_add_sample(stat3, 3);
  stat_add_sample(stat3, 4);
  stat_add_sample(stat3, 4);
  stat_add_sample(stat3, 7);

  stat_add_sample(stat4, 800);
  stat_add_sample(stat4, 800);
  stat_add_sample(stat4, 1123);
  stat_add_sample(stat4, 3332);
  stat_add_sample(stat4, 4000);
  stat_add_samples(stat4, 4001, 18);
  stat_add_sample(stat4, 7);

  stat_add_sample(stat5, 800);
  stat_add_sample(stat5, 800);
  stat_add_sample(stat5, 1123);
  stat_add_sample(stat5, 3332);
  stat_add_sample(stat5, 4000);
  stat_add_samples(stat5, 4001, 18);
  stat_add_sample(stat5, 7);

  /* print final stats */
  fprintf(stdout, "** Final stats...\n");
  stat_print_stats(sdb, stdout);

  /* all done */
  stat_delete(sdb);
  exit(0);
}