/* register simulator-specific statistics */
void
sim_reg_stats(struct stat_sdb_t *sdb)
{
  stat_reg_counter(sdb, "sim_num_insn",
       "total number of instructions executed",
       &sim_num_insn, sim_num_insn, NULL);
  stat_reg_counter(sdb, "sim_num_refs",
       "total number of loads and stores executed",
       &sim_num_refs, 0, NULL);
  stat_reg_int(sdb, "sim_elapsed_time",
         "total simulation time in seconds",
         &sim_elapsed_time, 0, NULL);
  stat_reg_formula(sdb, "sim_inst_rate",
       "simulation speed (in insts/sec)",
       "sim_num_insn / sim_elapsed_time", NULL);

  stat_reg_counter(sdb, "sim_num_branches",
                   "total number of branches executed",
                   &sim_num_branches, /* initial value */0, /* format */NULL);
  stat_reg_formula(sdb, "sim_IPB",
                   "instruction per branch",
                   "sim_num_insn / sim_num_branches", /* format */NULL);

  /* register predictor stats */
  if (pred)
    bpred_reg_stats(pred, sdb);
}
示例#2
0
/* register simulator-specific statistics */
void
sim_reg_stats(struct stat_sdb_t *sdb)
{
  stat_reg_counter(sdb, "sim_num_insn",
           "total number of instructions executed",
           &sim_num_insn, sim_num_insn, NULL);

  stat_reg_uint(sdb, "sim_cycles",
           "total number of cycles",
           &sim_cycle, 0, NULL);
  stat_reg_formula(sdb, "sim_cpi",
           "cycles per instruction (CPI)",
           "sim_cycles / sim_num_insn", NULL);

  stat_reg_counter(sdb, "sim_num_refs",
           "total number of loads and stores executed",
           &sim_num_refs, 0, NULL);
  stat_reg_int(sdb, "sim_elapsed_time",
           "total simulation time in seconds",
           &sim_elapsed_time, 0, NULL);
  stat_reg_formula(sdb, "sim_inst_rate",
           "simulation speed (in insts/sec)",
           "sim_num_insn / sim_elapsed_time", NULL);
  ld_reg_stats(sdb);
  mem_reg_stats(mem, sdb);
}
示例#3
0
/* register simulator-specific statistics */
void
sim_reg_stats(struct stat_sdb_t *sdb)
{
  stat_reg_counter(sdb, "sim_num_insn",
		   "total number of instructions executed",
		   &sim_num_insn, sim_num_insn, NULL);
 

  stat_reg_counter(sdb, "sim_num_cond_branches" /* label for printing */,
			"total conditional branches executed" /* description */,
			&g_total_cond_branches /* pointer to the counter */,
			0 /* initial value for the counter */, NULL);
  stat_reg_formula(sdb, "sim_cond_branch_freq",
			"relative frequency of conditional branches",
			"sim_num_cond_branches / sim_num_insn", NULL);
  stat_reg_counter(sdb, "sim_num_uncond_branches",
			"total unconditional branches executed",
			&g_total_uncond_branches, 0, NULL);
  stat_reg_formula(sdb, "sim_uncond_branch_freq",
			"relative frequency of unconditional branches",
			"sim_num_uncond_branches / sim_num_insn", NULL);
  stat_reg_counter(sdb, "sim_num_fp_inst",
			"total number of floating-point instructions",
			&g_total_fp_inst, 0, NULL);
  stat_reg_formula(sdb, "sim_fp_inst_freq",
			"relative frequency of fp instructions",
			"sim_num_fp_inst / sim_num_insn", NULL);
  stat_reg_counter(sdb, "sim_num_store_inst",
			"total number of store instructions",
			&g_total_store_inst, 0, NULL);
  stat_reg_formula(sdb, "sim_store_inst_freq",
			"relative frequency of store instructions",
			"sim_num_store_inst / sim_num_insn", NULL);
  stat_reg_counter(sdb, "sim_num_ld_inst",
			"total number of load instructions",
			&g_total_ld_inst, 0, NULL);
  stat_reg_formula(sdb, "sim_ld_inst_freq",
			"relative frequency of load instructions",
			"sim_num_ld_inst / sim_num_insn", NULL);
  stat_reg_counter(sdb, "sim_num_imm_inst",
			"total number of instructions with immediate operands",
			&g_total_imm_inst, 0, NULL);
  stat_reg_formula(sdb, "sim_imm_inst_freq",
			"relative frequency of immediate instructions",
			"sim_num_imm_inst / sim_num_insn", NULL);

  
  stat_reg_counter(sdb, "sim_num_refs",
		   "total number of loads and stores executed",
		   &sim_num_refs, 0, NULL);
  stat_reg_int(sdb, "sim_elapsed_time",
	       "total simulation time in seconds",
	       &sim_elapsed_time, 0, NULL);
  stat_reg_formula(sdb, "sim_inst_rate",
		   "simulation speed (in insts/sec)",
		   "sim_num_insn / sim_elapsed_time", NULL);
  ld_reg_stats(sdb);
  mem_reg_stats(mem, sdb);
}
/* register simulator-specific statistics */
void
sim_reg_stats(struct stat_sdb_t *sdb)
{
  stat_reg_counter(sdb, "sim_num_insn",
		   "total number of instructions executed",
		   &sim_num_insn, sim_num_insn, NULL);
  stat_reg_counter(sdb, "sim_num_refs",
		   "total number of loads and stores executed",
		   &sim_num_refs, 0, NULL);
  stat_reg_int(sdb, "sim_elapsed_time",
	       "total simulation time in seconds",
	       &sim_elapsed_time, 0, NULL);
  stat_reg_formula(sdb, "sim_inst_rate",
		   "simulation speed (in insts/sec)",
		   "sim_num_insn / sim_elapsed_time", NULL);

  /* ECE552 Assignment 1 - BEGIN CODE */

  stat_reg_counter(sdb, "sim_num_RAW_hazard_q1",
		   "total number of RAW hazards (q1)",
		   &sim_num_RAW_hazard_q1, sim_num_RAW_hazard_q1, NULL);
  stat_reg_counter(sdb, "sim_num_RAW_hazard_q1_1",
		   "total number of RAW hazards with 1 cycle stall (q1)",
		   &sim_num_RAW_hazard_q1_1, sim_num_RAW_hazard_q1_1, NULL);
  stat_reg_counter(sdb, "sim_num_RAW_hazard_q1_2",
		   "total number of RAW hazards with 2 cycle stall (q1)",
		   &sim_num_RAW_hazard_q1_2, sim_num_RAW_hazard_q1_2, NULL);

  stat_reg_counter(sdb, "sim_num_RAW_hazard_q2",
		   "total number of RAW hazards (q2)",
		   &sim_num_RAW_hazard_q2, sim_num_RAW_hazard_q2, NULL);

  stat_reg_counter(sdb, "sim_num_RAW_hazard_q2_1",
                   "total number of RAW hazards with 1 cycle stall (q2)",
                   &sim_num_RAW_hazard_q2_1, sim_num_RAW_hazard_q2_1, NULL);


  stat_reg_counter(sdb, "sim_num_RAW_hazard_q2_2",
                   "total number of RAW hazards with 2 cycle stall (q2)",
                   &sim_num_RAW_hazard_q2_2, sim_num_RAW_hazard_q2_2, NULL);


  stat_reg_formula(sdb, "CPI_from_RAW_hazard_q1",
		   "CPI from RAW hazard (q1)",
		   "1*((sim_num_insn-sim_num_RAW_hazard_q1)/sim_num_insn)+2*(sim_num_RAW_hazard_q1_1/sim_num_insn)+3*(sim_num_RAW_hazard_q1_2/sim_num_insn)", NULL);

  stat_reg_formula(sdb, "CPI_from_RAW_hazard_q2",
		   "CPI from RAW hazard (q2)",
		   "1*((sim_num_insn-sim_num_RAW_hazard_q2)/sim_num_insn)+2*(sim_num_RAW_hazard_q2_1/sim_num_insn)+3*(sim_num_RAW_hazard_q2_2/sim_num_insn)", NULL);

  /* ECE552 Assignment 1 - END CODE */

  ld_reg_stats(sdb);
  mem_reg_stats(mem, sdb);
}
示例#5
0
/* register simulator-specific statistics */
void
sim_reg_stats(struct stat_sdb_t *sdb)
{
  stat_reg_counter(sdb, "sim_num_insn",
		   "total number of instructions executed",
		   &sim_num_insn, sim_num_insn, NULL);
  stat_reg_counter(sdb, "sim_num_refs",
		   "total number of loads and stores executed",
		   &sim_num_refs, 0, NULL);
  stat_reg_int(sdb, "sim_elapsed_time",
	       "total simulation time in seconds",
	       &sim_elapsed_time, 0, NULL);
  stat_reg_formula(sdb, "sim_inst_rate",
		   "simulation speed (in insts/sec)",
		   "sim_num_insn / sim_elapsed_time", NULL);

  /* ECE552 Pre-Assignment - BEGIN CODE*/  
  stat_reg_counter(sdb, "sim_num_loads",
		  "total number of load instructions",
		  &sim_num_loads, sim_num_loads, NULL);
  stat_reg_formula(sdb, "sim_load_ratio",
		  "load instruction fraction",
		  "sim_num_loads / sim_num_insn", NULL);
  stat_reg_counter(sdb, "sim_num_lduh",
		  "total number of load use hazards",
		  &sim_num_lduh, sim_num_lduh, NULL);
  stat_reg_formula(sdb, "sim_load_use_ratio",
		  "load use fraction",
		  "sim_num_lduh / sim_num_insn", NULL);
  /* ECE552 Pre-Assignment - END CODE*/
  /* ECE552 Assignment 1 - BEGIN CODE */

  stat_reg_counter(sdb, "sim_num_RAW_hazard_q1",
		   "total number of RAW hazards (q1)",
		   &sim_num_RAW_hazard_q1, sim_num_RAW_hazard_q1, NULL);

  stat_reg_counter(sdb, "sim_num_RAW_hazard_q2",
		   "total number of RAW hazards (q2)",
		   &sim_num_RAW_hazard_q2, sim_num_RAW_hazard_q2, NULL);

  stat_reg_formula(sdb, "CPI_from_RAW_hazard_q1",
		   "CPI from RAW hazard (q1)",
		   "1" /* ECE552 - MUST ADD YOUR FORMULA */, NULL);

  stat_reg_formula(sdb, "CPI_from_RAW_hazard_q2",
		   "CPI from RAW hazard (q2)",
		   "1" /* ECE552 - MUST ADD YOUR FORMULA */, NULL);

  /* ECE552 Assignment 1 - END CODE */

  ld_reg_stats(sdb);
  mem_reg_stats(mem, sdb);
}
示例#6
0
/* register simulator-specific statistics */
void
sim_reg_stats(struct stat_sdb_t *sdb)
{
  stat_reg_counter(sdb, "sim_num_insn",
		   "total number of instructions executed",
		   &sim_num_insn, sim_num_insn, NULL);
  stat_reg_counter(sdb, "sim_num_refs",
		   "total number of loads and stores executed",
		   &sim_num_refs, 0, NULL);
  stat_reg_int(sdb, "sim_elapsed_time",
	       "total simulation time in seconds",
	       (int *)&sim_elapsed_time, 0, NULL);
  stat_reg_formula(sdb, "sim_inst_rate",
		   "simulation speed (in insts/sec)",
		   "sim_num_insn / sim_elapsed_time", NULL);
}
示例#7
0
/* register simulator-specific statistics */
void
sim_reg_stats(struct stat_sdb_t *sdb)
{
#ifndef NO_INSN_COUNT
  stat_reg_counter(sdb, "sim_num_insn",
		   "total number of instructions executed",
		   &sim_num_insn, sim_num_insn, NULL);
#endif /* !NO_INSN_COUNT */
  stat_reg_int(sdb, "sim_elapsed_time",
	       "total simulation time in seconds",
	       &sim_elapsed_time, 0, NULL);
#ifndef NO_INSN_COUNT
  stat_reg_formula(sdb, "sim_inst_rate",
		   "simulation speed (in insts/sec)",
		   "sim_num_insn / sim_elapsed_time", NULL);
#endif /* !NO_INSN_COUNT */
  ld_reg_stats(sdb);
  mem_reg_stats(mem, sdb);
}
示例#8
0
/* register simulator-specific statistics */
void
ld_reg_stats(struct stat_sdb_t *sdb)	/* stats data base */
{
  stat_reg_addr(sdb, "ld_text_base",
		"program text (code) segment base",
		&ld_text_base, ld_text_base, "0x%08p");
  stat_reg_addr(sdb, "ld_text_bound",
		"program text (code) segment bound",
		&ld_text_bound, ld_text_bound, "0x%08p");
  stat_reg_uint(sdb, "ld_text_size",
		"program text (code) size in bytes",
		&ld_text_size, ld_text_size, NULL);
  stat_reg_addr(sdb, "ld_data_base",
		"program initialized data segment base",
		&ld_data_base, ld_data_base, "0x%08p");
  stat_reg_addr(sdb, "ld_data_bound",
		"program initialized data segment bound",
		&ld_data_bound, ld_data_bound, "0x%08p");
  stat_reg_uint(sdb, "ld_data_size",
		"program init'ed `.data' and uninit'ed `.bss' size in bytes",
		&ld_data_size, ld_data_size, NULL);
  stat_reg_addr(sdb, "ld_stack_base",
		"program stack segment base (highest address in stack)",
		&ld_stack_base, ld_stack_base, "0x%08p");
#if 0 /* FIXME: broken... */
  stat_reg_addr(sdb, "ld_stack_min",
		"program stack segment lowest address",
		&ld_stack_min, ld_stack_min, "0x%08p");
#endif
  stat_reg_uint(sdb, "ld_stack_size",
		"program initial stack size",
		&ld_stack_size, ld_stack_size, NULL);
  stat_reg_addr(sdb, "ld_prog_entry",
		"program entry point (initial PC)",
		&ld_prog_entry, ld_prog_entry, "0x%08p");
  stat_reg_addr(sdb, "ld_environ_base",
		"program environment base address address",
		&ld_environ_base, ld_environ_base, "0x%08p");
  stat_reg_int(sdb, "ld_target_big_endian",
	       "target executable endian-ness, non-zero if big endian",
	       &ld_target_big_endian, ld_target_big_endian, NULL);
}
示例#9
0
文件: loader.c 项目: hoangt/sim-mp
/* register simulator-specific statistics */
void
ld_reg_stats(struct stat_sdb_t *sdb, int threadid)	/* stats data base */
{
  context *current;
  current = thecontexts[threadid];

  stat_reg_uint(sdb, "threadid",
		"Thread id",
		&current->id, current->id, "0x%010p");
  stat_reg_addr(sdb, "ld_text_base",
		"program text (code) segment base",
		&current->ld_text_base, current->ld_text_base, "0x%010p");
  stat_reg_uint(sdb, "ld_text_size",
		"program text (code) size in bytes",
		&current->ld_text_size, current->ld_text_size, NULL);
  stat_reg_addr(sdb, "ld_data_base",
		"program initialized data segment base",
		&current->ld_data_base, current->ld_data_base, "0x%010p");
  stat_reg_uint(sdb, "ld_data_size",
		"program init'ed `.data' and uninit'ed `.bss' size in bytes",
		&current->ld_data_size, current->ld_data_size, NULL);
  stat_reg_addr(sdb, "ld_stack_base",
		"program stack segment base (highest address in stack)",
		&current->ld_stack_base, current->ld_stack_base, "0x%010p");
#if 0 /* FIXME: broken... */
  stat_reg_addr(sdb, "ld_stack_min",
		"program stack segment lowest address",
		&current->ld_stack_min, current->ld_stack_min, "0x%010p");
#endif
  stat_reg_uint(sdb, "ld_stack_size",
		"program initial stack size",
		&current->ld_stack_size, current->ld_stack_size, NULL);
  stat_reg_addr(sdb, "ld_prog_entry",
		"program entry point (initial PC)",
		&current->ld_prog_entry, current->ld_prog_entry, "0x%010p");
  stat_reg_addr(sdb, "ld_environ_base",
		"program environment base address address",
		&current->ld_environ_base, current->ld_environ_base, "0x%010p");
  stat_reg_int(sdb, "ld_target_big_endian",
	       "target executable endian-ness, non-zero if big endian",
	       &current->ld_target_big_endian, current->ld_target_big_endian, NULL);
}
示例#10
0
/* register simulator-specific statistics */
void
sim_reg_stats(struct stat_sdb_t *sdb)
{
  stat_reg_counter(sdb, "sim_num_insn",
		   "total number of instructions executed",
		   &sim_num_insn, sim_num_insn, NULL);
  stat_reg_counter(sdb, "sim_num_refs",
		   "total number of loads and stores executed",
		   &sim_num_refs, 0, NULL);
  stat_reg_int(sdb, "sim_elapsed_time",
	       "total simulation time in seconds",
	       &sim_elapsed_time, 0, NULL);
  stat_reg_formula(sdb, "sim_inst_rate",
		   "simulation speed (in insts/sec)",
		   "sim_num_insn / sim_elapsed_time", NULL);
/* this is a*/
  stat_reg_counter(sdb, "sim_num_icache_miss", "total number of instruction cache misses", &g_icache_miss, 0, NULL);
  stat_reg_formula(sdb, "sim_icache_miss_rate", "instruction cache miss rate (percentage)", "100*(sim_num_icache_miss / sim_num_insn)", NULL);

  stat_reg_counter(sdb, "sim_num_icache_miss_aii", "total number of instruction cache misses aii", &g_icache_miss_aii, 0, NULL);
  stat_reg_formula(sdb, "sim_icache_miss_rate_aii", "instruction cache miss rate aii (percentage)", "100*(sim_num_icache_miss_aii / sim_num_insn)", NULL);

/*B*/
  stat_reg_counter(sdb, "sim_num_load_total", "total number of load", &g_load_total, 0, NULL);
  stat_reg_counter(sdb, "sim_num_load_miss", "total number of load miss", &g_load_miss, 0, NULL);
  stat_reg_formula(sdb, "sim_load", "load miss rate (percentage)", "100*(sim_num_load_miss / sim_num_load_total)", NULL);

  stat_reg_counter(sdb, "sim_num_store_total", "total number of store", &g_store_total, 0, NULL);
  stat_reg_counter(sdb, "sim_num_store_miss", "total number of store miss", &g_store_miss, 0, NULL);
  stat_reg_formula(sdb, "sim_store", "store miss rate (percentage)", "100*(sim_num_store_miss / sim_num_store_total)", NULL);

  stat_reg_counter(sdb, "sim_writeback", "total number of writeback", &g_writeback, 0, NULL);
  stat_reg_formula(sdb, "sim_wb_ratio", "writeback to store ratio", "(sim_writeback / sim_num_store_total)", NULL);

//  stat_reg_formula(sdb, "sim_icache_miss_rate_aii", "instruction cache miss rate aii (percentage)", "100*(sim_num_icache_miss_aii / sim_num_insn)", NULL);

  ld_reg_stats(sdb);
  mem_reg_stats(mem, sdb);
}
示例#11
0
/* register simulator-specific statistics */
void
sim_reg_stats(struct stat_sdb_t *sdb)
{
  stat_reg_counter(sdb, "sim_num_insn",
		   "total number of instructions executed",
		   &sim_num_insn, sim_num_insn, NULL);
  stat_reg_counter(sdb, "sim_num_refs",
		   "total number of loads and stores executed",
		   &sim_num_refs, 0, NULL);
  stat_reg_int(sdb, "sim_elapsed_time",
	       "total simulation time in seconds",
	       &sim_elapsed_time, 0, NULL);
  stat_reg_formula(sdb, "sim_inst_rate",
		   "simulation speed (in insts/sec)",
		   "sim_num_insn / sim_elapsed_time", NULL);

  ld_reg_stats(sdb);
  mem_reg_stats(mem, sdb);

		   
  /* ECE552 Assignment 2 - STATS COUNTERS/FORMULAS - BEGIN */ 
  stat_reg_counter(sdb, "sim_num_br", "total number of conditional branches", &sim_num_br, sim_num_br, NULL);

  stat_reg_counter(sdb, "sim_num_mispred_static", "Static preditor: number of mispredicted branches", &sim_num_mispred_static, sim_num_mispred_static, NULL);
  stat_reg_formula(sdb, "sim_br_static_ratio", "Static predictor: branch misprediction rate", "sim_num_mispred_static / sim_num_br", NULL);	

  stat_reg_counter(sdb, "sim_num_mispred_2bitsat", "2-bit sat. counter preditor: number of mispred. branches", &sim_num_mispred_2bitsat, sim_num_mispred_2bitsat, NULL);
  stat_reg_formula(sdb, "sim_br_2bitsat_ratio", "2-bit sat. counter predictor: branch misprediction rate", "sim_num_mispred_2bitsat / sim_num_br", NULL);	

  stat_reg_counter(sdb, "sim_num_mispred_2level", "Two level preditor: number of mispredicted branches", &sim_num_mispred_2level, sim_num_mispred_2level, NULL);
  stat_reg_formula(sdb, "sim_br_2level_ratio", "Two level predictor: branch misprediction rate", "sim_num_mispred_2level / sim_num_br", NULL);	

  stat_reg_counter(sdb, "sim_num_mispred_openend", "Open-ended preditor: number of mispredicted branches", &sim_num_mispred_openend, sim_num_mispred_openend, NULL);
  stat_reg_formula(sdb, "sim_br_openend_ratio", "Open-ended predictor: branch misprediction rate", "sim_num_mispred_openend / sim_num_br", NULL);	
  /* ECE552 Assignment 2 - STATS COUNTERS/FORMULAS - END */ 

}
示例#12
0
/* register level 1 power analayzer stats */
void
lv1_panalyzer_reg_stats(
    struct stat_sdb_t *sdb /* stats db ptr */)
{
    stat_reg_int(sdb, "alu access", "number of times alu is accessed",
                 &(lv1_alu_panal.alu_access), 0, NULL);
    stat_reg_double(sdb, "alu max power", "Maximum power for alu",
                    &(lv1_alu_panal.max_power), 0, NULL);

    stat_reg_int(sdb, "fpu access", "number of times fpu is accessed",
                 &(lv1_fpu_panal.fpu_access), 0, NULL);
    stat_reg_double(sdb, "fpu max power", "Maximum power for fpu",
                    &(lv1_fpu_panal.max_power), 0, NULL);


    stat_reg_int(sdb, "mult access", "number of times mult is accessed",
                 &(lv1_mult_panal.mult_access), 0, NULL);
    stat_reg_double(sdb, "mult max power", "Maximum power for mult",
                    &(lv1_mult_panal.max_power), 0, NULL);

    stat_reg_int(sdb, "rf access", "number of times rf is accessed",
                 &(lv1_rf_panal.rf_access), 0, NULL);


    stat_reg_double(sdb, "rf max power", "Maximum power for rf",
                    &(lv1_rf_panal.max_power), 0, NULL);

    stat_reg_int(sdb, "bpred access", "number of times bpred is accessed",
                 &(lv1_bpred_panal.bpred_access), 0, NULL);
    stat_reg_double(sdb, "bpred max power", "Maximum power for bpred",
                    &(lv1_bpred_panal.max_power), 0, NULL);

    stat_reg_int(sdb, "il1 access", "number of times il1 access is accessed",
                 &(lv1_il1_panal.cache_access), 0, NULL);
    stat_reg_double(sdb, "il1 max power", "Maximum power for il1",
                    &(lv1_il1_panal.max_power), 0, NULL);

    stat_reg_int(sdb, "il2 access", "number of times il2 access is accessed",
                 &(lv1_il2_panal.cache_access), 0, NULL);
    stat_reg_double(sdb, "il2 max power", "Maximum power for il2",
                    &(lv1_il2_panal.max_power), 0, NULL);

    stat_reg_int(sdb, "dl1 access", "number of times dl1 access is accessed",
                 &(lv1_dl1_panal.cache_access), 0, NULL);
    stat_reg_double(sdb, "dl1 max power", "Maximum power for dl1",
                    &(lv1_dl1_panal.max_power), 0, NULL);

    stat_reg_int(sdb, "dl2 access", "number of times dl2 access is accessed",
                 &(lv1_dl2_panal.cache_access), 0, NULL);
    stat_reg_double(sdb, "dl2 max power", "Maximum power for dl2",
                    &(lv1_dl2_panal.max_power), 0, NULL);

    stat_reg_int(sdb, "itlb access", "number of times itlb access is accessed",
                 &(lv1_itlb_panal.cache_access), 0, NULL);
    stat_reg_double(sdb, "itlb max power", "Maximum power for itlb",
                    &(lv1_itlb_panal.max_power), 0, NULL);

    stat_reg_int(sdb, "dtlb access", "number of times dtlb access is accessed",
                 &(lv1_dtlb_panal.cache_access), 0, NULL);
    stat_reg_double(sdb, "dtlb max power", "Maximum power for dtlb",
                    &(lv1_dtlb_panal.max_power), 0, NULL);

    stat_reg_int(sdb, "io access", "number of times io access is accessed",
                 &(lv1_io_panal->io_access), 0, NULL);
    stat_reg_double(sdb, "aio max power", "Maximum power for aio",
                    &(lv1_io_panal->max_aio_power), 0, NULL);
    stat_reg_double(sdb, "dio max power", "Maximum power for dio",
                    &(lv1_io_panal->max_dio_power), 0, NULL);

    stat_reg_double(sdb, "clock max power", "Maximum power for clock",
                    &(lv1_clock_panal->max_power), 0, NULL);

    stat_reg_double(sdb, "uarch max power", "Maximum power for uarch",
                    &(lv1_uarch_panal->max_power), 0, NULL);


}
示例#13
0
文件: sim-cache.c 项目: mshzhb/ece552
/* register simulator-specific statistics */
void
sim_reg_stats(struct stat_sdb_t *sdb)	/* stats database */
{
  int i;

  /* register baseline stats */
  stat_reg_counter(sdb, "sim_num_insn",
		   "total number of instructions executed",
		   &sim_num_insn, sim_num_insn, NULL);
  stat_reg_counter(sdb, "sim_num_refs",
		   "total number of loads and stores executed",
		   &sim_num_refs, 0, NULL);
  stat_reg_int(sdb, "sim_elapsed_time",
	       "total simulation time in seconds",
	       &sim_elapsed_time, 0, NULL);
  stat_reg_formula(sdb, "sim_inst_rate",
		   "simulation speed (in insts/sec)",
		   "sim_num_insn / sim_elapsed_time", NULL);

  /* register cache stats */
  if (cache_il1
      && (cache_il1 != cache_dl1 && cache_il1 != cache_dl2))
    cache_reg_stats(cache_il1, sdb);
  if (cache_il2
      && (cache_il2 != cache_dl1 && cache_il2 != cache_dl2))
    cache_reg_stats(cache_il2, sdb);
  if (cache_dl1)
    cache_reg_stats(cache_dl1, sdb);
  if (cache_dl2)
    cache_reg_stats(cache_dl2, sdb);
  if (itlb)
    cache_reg_stats(itlb, sdb);
  if (dtlb)
    cache_reg_stats(dtlb, sdb);

  for (i=0; i<pcstat_nelt; i++)
    {
      char buf[512], buf1[512];
      struct stat_stat_t *stat;

      /* track the named statistical variable by text address */

      /* find it... */
      stat = stat_find_stat(sdb, pcstat_vars[i]);
      if (!stat)
	fatal("cannot locate any statistic named `%s'", pcstat_vars[i]);

      /* stat must be an integral type */
      if (stat->sc != sc_int && stat->sc != sc_uint && stat->sc != sc_counter)
	fatal("`-pcstat' statistical variable `%s' is not an integral type",
	      stat->name);

      /* register this stat */
      pcstat_stats[i] = stat;
      pcstat_lastvals[i] = STATVAL(stat);

      /* declare the sparce text distribution */
      sprintf(buf, "%s_by_pc", stat->name);
      sprintf(buf1, "%s (by text address)", stat->desc);
      pcstat_sdists[i] = stat_reg_sdist(sdb, buf, buf1,
					/* initial value */0,
					/* print fmt */(PF_COUNT|PF_PDF),
					/* format */"0x%p %u %.2f",
					/* print fn */NULL);
    }
  ld_reg_stats(sdb);
  mem_reg_stats(mem, sdb);
}
示例#14
0
/* register simulator-specific statistics */
void
sim_reg_stats(struct stat_sdb_t *sdb)
{
  stat_reg_counter(sdb, "sim_num_insn",
		   "total number of instructions executed",
		   &sim_num_insn, sim_num_insn, NULL);
  stat_reg_counter(sdb, "sim_num_refs",
		   "total number of loads and stores executed",
		   &sim_num_refs, 0, NULL);
  stat_reg_int(sdb, "sim_elapsed_time",
	       "total simulation time in seconds",
	       &sim_elapsed_time, 0, NULL);
  stat_reg_formula(sdb, "sim_inst_rate",
		   "simulation speed (in insts/sec)",
		   "sim_num_insn / sim_elapsed_time", NULL);

  /* ECE552 Assignment 1 - BEGIN CODE */

  stat_reg_counter(sdb, "sim_num_RAW_hazard_q1",
		   "total number of RAW hazards (q1)",
		   &sim_num_RAW_hazard_q1, sim_num_RAW_hazard_q1, NULL);

  stat_reg_counter(sdb, "sim_num_one_cycle_hazard_q1",
		   "total one cycle hazard q1",
		   &sim_num_one_cycle_hazard_q1, sim_num_one_cycle_hazard_q1, NULL);

  stat_reg_counter(sdb, "sim_num_two_cycle_hazard_q1",
		   "total two cycle hazard q1",
		   &sim_num_two_cycle_hazard_q1, sim_num_two_cycle_hazard_q1, NULL);

  stat_reg_counter(sdb, "sim_num_one_cycle_hazard_q2",
		   "total one cycle hazard q2",
		   &sim_num_one_cycle_hazard_q2, sim_num_one_cycle_hazard_q2, NULL);

  stat_reg_counter(sdb, "sim_num_two_cycle_hazard_q2",
		   "total two cycle hazard q2",
		   &sim_num_two_cycle_hazard_q2, sim_num_two_cycle_hazard_q2, NULL); 

  stat_reg_counter(sdb, "sim_num_one_cycle_hazard_q3",
		   "total one cycle hazard q3",
		   &sim_num_one_cycle_hazard_q3, sim_num_one_cycle_hazard_q3, NULL);
  
  stat_reg_counter(sdb, "sim_num_two_cycle_hazard_q3",
		   "total two cycle hazard q3",
		   &sim_num_two_cycle_hazard_q3, sim_num_two_cycle_hazard_q3, NULL);

  stat_reg_counter(sdb, "sim_num_RAW_hazard_q2",
		   "total number of RAW hazards (q2)",
		   &sim_num_RAW_hazard_q2, sim_num_RAW_hazard_q2, NULL);

  stat_reg_counter(sdb, "sim_num_WAW_hazard_q3",
		   "total number of WAW hazards (q3)",
		   &sim_num_WAW_hazard_q3, sim_num_WAW_hazard_q3, NULL);

  /* These are structural hazards occuring when two instructions **without** a WAW dependence
     try to do the WriteBack in the same cycle.  The latest instruction should stall.
   */
  stat_reg_counter(sdb, "sim_num_structural_hazard_q3",
		   "total number of structural hazards (q3)",
		   &sim_num_structural_hazard_q3, sim_num_structural_hazard_q3, NULL);

  stat_reg_formula(sdb, "CPI_from_RAW_hazard_q1",
		   "CPI from RAW hazard (q1)",
		   "1 + (sim_num_one_cycle_hazard_q1/sim_num_insn)+ ((sim_num_two_cycle_hazard_q1/sim_num_insn)*2)", NULL);

  stat_reg_formula(sdb, "CPI_from_RAW_hazard_q2",
		   "CPI from RAW hazard (q2)",
		   "1 +  (sim_num_one_cycle_hazard_q2/sim_num_insn) + ((sim_num_two_cycle_hazard_q2/sim_num_insn)*2)", NULL);

  /* Include both WAW and structural hazards in your CPI computation */
  stat_reg_formula(sdb, "CPI_from_WAW_and_Structural_hazard_q3",
		   "CPI from WAW and structural hazards (q3)",
		   "1 + ((sim_num_one_cycle_hazard_q3 + sim_num_structural_hazard_q3)/sim_num_insn) + ((sim_num_two_cycle_hazard_q3/sim_num_insn)*2)",  NULL);

  /* ECE552 Assignment 1 - END CODE */

  ld_reg_stats(sdb);
  mem_reg_stats(mem, sdb);
}
示例#15
0
文件: sim-profile.c 项目: palmerc/lab
/* register simulator-specific statistics */
void
sim_reg_stats(struct stat_sdb_t *sdb)
{
  int i;

  stat_reg_counter(sdb, "sim_num_insn",
		   "total number of instructions executed",
		   &sim_num_insn, sim_num_insn, NULL);
  stat_reg_counter(sdb, "sim_num_refs",
		   "total number of loads and stores executed",
		   &sim_num_refs, 0, NULL);
  stat_reg_int(sdb, "sim_elapsed_time",
	       "total simulation time in seconds",
	       &sim_elapsed_time, 0, NULL);
  stat_reg_formula(sdb, "sim_inst_rate",
		   "simulation speed (in insts/sec)",
		   "sim_num_insn / sim_elapsed_time", NULL);

  if (prof_ic)
    {
      /* instruction class profile */
      ic_prof = stat_reg_dist(sdb, "sim_inst_class_prof",
			      "instruction class profile",
			      /* initial value */0,
			      /* array size */ic_NUM,
			      /* bucket size */1,
			      /* print format */(PF_COUNT|PF_PDF),
			      /* format */NULL,
			      /* index map */inst_class_str,
			      /* print fn */NULL);
    }

  if (prof_inst)
    {
      int i;
      char buf[512];

      /* conjure up appropriate instruction description strings */
      for (i=0; i < /* skip NA */OP_MAX-1; i++)
	{
	  sprintf(buf, "%-8s %-6s", md_op2name[i+1], md_op2format[i+1]);
	  inst_str[i] = mystrdup(buf);
	}
      
      /* instruction profile */
      inst_prof = stat_reg_dist(sdb, "sim_inst_prof",
				"instruction profile",
				/* initial value */0,
				/* array size */ /* skip NA */OP_MAX-1,
				/* bucket size */1,
				/* print format */(PF_COUNT|PF_PDF),
				/* format */NULL,
				/* index map */inst_str,
				/* print fn */NULL);
    }

  if (prof_bc)
    {
      /* instruction branch profile */
      bc_prof = stat_reg_dist(sdb, "sim_branch_prof",
			      "branch instruction profile",
			      /* initial value */0,
			      /* array size */bc_NUM,
			      /* bucket size */1,
			      /* print format */(PF_COUNT|PF_PDF),
			      /* format */NULL,
			      /* index map */branch_class_str,
			      /* print fn */NULL);
    }

  if (prof_am)
    {
      /* instruction branch profile */
      am_prof = stat_reg_dist(sdb, "sim_addr_mode_prof",
			      "addressing mode profile",
			      /* initial value */0,
			      /* array size */md_amode_NUM,
			      /* bucket size */1,
			      /* print format */(PF_COUNT|PF_PDF),
			      /* format */NULL,
			      /* index map */md_amode_str,
			      /* print fn */NULL);
    }

  if (prof_seg)
    {
      /* instruction branch profile */
      seg_prof = stat_reg_dist(sdb, "sim_addr_seg_prof",
			       "load/store address segment profile",
			       /* initial value */0,
			       /* array size */seg_NUM,
			       /* bucket size */1,
			       /* print format */(PF_COUNT|PF_PDF),
			       /* format */NULL,
			       /* index map */addr_seg_str,
			       /* print fn */NULL);
    }

  if (prof_tsyms && sym_ntextsyms != 0)
    {
      int i;

      /* load program symbols */
      sym_loadsyms(ld_prog_fname, load_locals);

      /* conjure up appropriate instruction description strings */
      tsym_names = (char **)calloc(sym_ntextsyms, sizeof(char *));

      for (i=0; i < sym_ntextsyms; i++)
	tsym_names[i] = sym_textsyms[i]->name;
      
      /* text symbol profile */
      tsym_prof = stat_reg_dist(sdb, "sim_text_sym_prof",
				"text symbol profile",
				/* initial value */0,
				/* array size */sym_ntextsyms,
				/* bucket size */1,
				/* print format */(PF_COUNT|PF_PDF),
				/* format */NULL,
				/* index map */tsym_names,
				/* print fn */NULL);
    }

  if (prof_dsyms && sym_ndatasyms != 0)
    {
      int i;

      /* load program symbols */
      sym_loadsyms(ld_prog_fname, load_locals);

      /* conjure up appropriate instruction description strings */
      dsym_names = (char **)calloc(sym_ndatasyms, sizeof(char *));

      for (i=0; i < sym_ndatasyms; i++)
	dsym_names[i] = sym_datasyms[i]->name;
      
      /* data symbol profile */
      dsym_prof = stat_reg_dist(sdb, "sim_data_sym_prof",
				"data symbol profile",
				/* initial value */0,
				/* array size */sym_ndatasyms,
				/* bucket size */1,
				/* print format */(PF_COUNT|PF_PDF),
				/* format */NULL,
				/* index map */dsym_names,
				/* print fn */NULL);
    }

  if (prof_taddr)
    {
      /* text address profile (sparse profile), NOTE: a dense print format
         is used, its more difficult to read, but the profiles are *much*
	 smaller, I've assumed that the profiles are read by programs, at
	 least for your sake I hope this is the case!! */
      taddr_prof = stat_reg_sdist(sdb, "sim_text_addr_prof",
				  "text address profile",
				  /* initial value */0,
				  /* print format */(PF_COUNT|PF_PDF),
				  /* format */"0x%p %u %.2f",
				  /* print fn */NULL);
    }

  for (i=0; i<pcstat_nelt; i++)
    {
      char buf[512], buf1[512];
      struct stat_stat_t *stat;

      /* track the named statistical variable by text address */

      /* find it... */
      stat = stat_find_stat(sdb, pcstat_vars[i]);
      if (!stat)
	fatal("cannot locate any statistic named `%s'", pcstat_vars[i]);

      /* stat must be an integral type */
      if (stat->sc != sc_int && stat->sc != sc_uint && stat->sc != sc_counter)
	fatal("`-pcstat' statistical variable `%s' is not an integral type",
	      stat->name);

      /* register this stat */
      pcstat_stats[i] = stat;
      pcstat_lastvals[i] = STATVAL(stat);

      /* declare the sparce text distribution */
      sprintf(buf, "%s_by_pc", stat->name);
      sprintf(buf1, "%s (by text address)", stat->desc);
      pcstat_sdists[i] = stat_reg_sdist(sdb, buf, buf1,
					/* initial value */0,
					/* print format */(PF_COUNT|PF_PDF),
					/* format */"0x%p %u %.2f",
					/* print fn */NULL);
    }
  ld_reg_stats(sdb);
  mem_reg_stats(mem, sdb);
}
示例#16
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);
}