Line 135... |
Line 135... |
|
|
void printotherstats(int which)
|
void printotherstats(int which)
|
{
|
{
|
int i, all = 0, dependall = 0;
|
int i, all = 0, dependall = 0;
|
|
|
printf ("\n");
|
PRINTF ("\n");
|
if (config.bpb.enabled) {
|
if (config.bpb.enabled) {
|
struct branchstat bf;
|
struct branchstat bf;
|
struct branchstat bnf;
|
struct branchstat bnf;
|
long bf_all, bnf_all;
|
long bf_all, bnf_all;
|
bf.taken = mstats.bf[1][0] + mstats.bf[1][1];
|
bf.taken = mstats.bf[1][0] + mstats.bf[1][1];
|
Line 152... |
Line 152... |
bnf.nottaken = mstats.bnf[0][0] + mstats.bf[0][1];
|
bnf.nottaken = mstats.bnf[0][0] + mstats.bf[0][1];
|
bnf.forward = mstats.bnf[0][1] + mstats.bf[1][1];
|
bnf.forward = mstats.bnf[0][1] + mstats.bf[1][1];
|
bnf.backward = mstats.bnf[0][0] + mstats.bf[1][0];
|
bnf.backward = mstats.bnf[0][0] + mstats.bf[1][0];
|
bnf_all = bnf.forward + bnf.backward;
|
bnf_all = bnf.forward + bnf.backward;
|
|
|
printf("bnf: %d (%d%%) taken,", bf.taken, (bf.taken * 100) / SD(bf_all));
|
PRINTF("bnf: %d (%d%%) taken,", bf.taken, (bf.taken * 100) / SD(bf_all));
|
printf(" %d (%d%%) not taken,", bf.nottaken, (bf.nottaken * 100) / SD(bf_all));
|
PRINTF(" %d (%d%%) not taken,", bf.nottaken, (bf.nottaken * 100) / SD(bf_all));
|
printf(" %d (%d%%) forward,", bf.forward, (bf.forward * 100) / SD(bf_all));
|
PRINTF(" %d (%d%%) forward,", bf.forward, (bf.forward * 100) / SD(bf_all));
|
printf(" %d (%d%%) backward\n", bf.backward, (bf.backward * 100) / SD(bf_all));
|
PRINTF(" %d (%d%%) backward\n", bf.backward, (bf.backward * 100) / SD(bf_all));
|
printf("bf: %d (%d%%) taken,", bnf.taken, (bnf.taken * 100) / SD(bnf_all));
|
PRINTF("bf: %d (%d%%) taken,", bnf.taken, (bnf.taken * 100) / SD(bnf_all));
|
printf(" %d (%d%%) not taken,", bnf.nottaken, (bnf.nottaken * 100) / SD(bnf_all));
|
PRINTF(" %d (%d%%) not taken,", bnf.nottaken, (bnf.nottaken * 100) / SD(bnf_all));
|
printf(" %d (%d%%) forward,", bnf.forward, (bnf.forward * 100) / SD(bnf_all));
|
PRINTF(" %d (%d%%) forward,", bnf.forward, (bnf.forward * 100) / SD(bnf_all));
|
printf(" %d (%d%%) backward\n", bnf.backward, (bnf.backward * 100) / SD(bnf_all));
|
PRINTF(" %d (%d%%) backward\n", bnf.backward, (bnf.backward * 100) / SD(bnf_all));
|
|
|
printf("StaticBP bnf(%s): correct %d%%\n", config.bpb.sbp_bnf_fwd ? "forward" : "backward",
|
PRINTF("StaticBP bnf(%s): correct %d%%\n", config.bpb.sbp_bnf_fwd ? "forward" : "backward",
|
(mstats.bnf[0][config.bpb.sbp_bnf_fwd] * 100) / SD(bnf_all));
|
(mstats.bnf[0][config.bpb.sbp_bnf_fwd] * 100) / SD(bnf_all));
|
printf("StaticBP bf(%s): correct %d%%\n", config.bpb.sbp_bf_fwd ? "forward" : "backward",
|
PRINTF("StaticBP bf(%s): correct %d%%\n", config.bpb.sbp_bf_fwd ? "forward" : "backward",
|
(mstats.bnf[1][config.bpb.sbp_bf_fwd] * 100) / SD(bf_all));
|
(mstats.bnf[1][config.bpb.sbp_bf_fwd] * 100) / SD(bf_all));
|
printf("BPB: hit %d (correct %d%%), miss %d\n", mstats.bpb.hit, (mstats.bpb.correct * 100) / SD(mstats.bpb.hit), mstats.bpb.miss);
|
PRINTF("BPB: hit %d (correct %d%%), miss %d\n", mstats.bpb.hit, (mstats.bpb.correct * 100) / SD(mstats.bpb.hit), mstats.bpb.miss);
|
} else
|
} else
|
printf("BPB simulation disabled. Enable it to see BPB analysis\n");
|
PRINTF("BPB simulation disabled. Enable it to see BPB analysis\n");
|
|
|
if (config.bpb.btic) {
|
if (config.bpb.btic) {
|
printf("BTIC: hit %d(%d%%), miss %d\n", mstats.btic.hit, (mstats.btic.hit * 100) / SD(mstats.btic.hit + mstats.btic.miss), mstats.btic.miss);
|
PRINTF("BTIC: hit %d(%d%%), miss %d\n", mstats.btic.hit, (mstats.btic.hit * 100) / SD(mstats.btic.hit + mstats.btic.miss), mstats.btic.miss);
|
} else
|
} else
|
printf("BTIC simulation disabled. Enabled it to see BTIC analysis\n");
|
PRINTF("BTIC simulation disabled. Enabled it to see BTIC analysis\n");
|
|
|
if (config.ic.enabled) {
|
if (config.ic.enabled) {
|
printf("IC read: hit %d(%d%%), miss %d\n", ic_stats.readhit, (ic_stats.readhit * 100) / SD(ic_stats.readhit + ic_stats.readmiss), ic_stats.readmiss);
|
PRINTF("IC read: hit %d(%d%%), miss %d\n", ic_stats.readhit, (ic_stats.readhit * 100) / SD(ic_stats.readhit + ic_stats.readmiss), ic_stats.readmiss);
|
} else
|
} else
|
printf("No ICache. Enable it to see IC results.\n");
|
PRINTF("No ICache. Enable it to see IC results.\n");
|
|
|
if (config.dc.enabled) {
|
if (config.dc.enabled) {
|
printf("DC read: hit %d(%d%%), miss %d\n", dc_stats.readhit, (dc_stats.readhit * 100) / SD(dc_stats.readhit + dc_stats.readmiss), dc_stats.readmiss);
|
PRINTF("DC read: hit %d(%d%%), miss %d\n", dc_stats.readhit, (dc_stats.readhit * 100) / SD(dc_stats.readhit + dc_stats.readmiss), dc_stats.readmiss);
|
printf("DC write: hit %d(%d%%), miss %d\n", dc_stats.writehit, (dc_stats.writehit * 100) / SD(dc_stats.writehit + dc_stats.writemiss), dc_stats.writemiss);
|
PRINTF("DC write: hit %d(%d%%), miss %d\n", dc_stats.writehit, (dc_stats.writehit * 100) / SD(dc_stats.writehit + dc_stats.writemiss), dc_stats.writemiss);
|
} else
|
} else
|
printf("No DCache. Enable it to see DC results.\n");
|
PRINTF("No DCache. Enable it to see DC results.\n");
|
|
|
if (testsprbits(SPR_UPR, SPR_UPR_IMP)) {
|
if (testsprbits(SPR_UPR, SPR_UPR_IMP)) {
|
printf("IMMU read: hit %d(%d%%), miss %d\n", immu_stats.fetch_tlbhit, (immu_stats.fetch_tlbhit * 100) / SD(immu_stats.fetch_tlbhit + immu_stats.fetch_tlbmiss), immu_stats.fetch_tlbmiss);
|
PRINTF("IMMU read: hit %d(%d%%), miss %d\n", immu_stats.fetch_tlbhit, (immu_stats.fetch_tlbhit * 100) / SD(immu_stats.fetch_tlbhit + immu_stats.fetch_tlbmiss), immu_stats.fetch_tlbmiss);
|
} else
|
} else
|
printf("No IMMU. Set UPR[IMP]\n");
|
PRINTF("No IMMU. Set UPR[IMP]\n");
|
|
|
if (testsprbits(SPR_UPR, SPR_UPR_DMP)) {
|
if (testsprbits(SPR_UPR, SPR_UPR_DMP)) {
|
printf("DMMU read: hit %d(%d%%), miss %d\n", dmmu_stats.loads_tlbhit, (dmmu_stats.loads_tlbhit * 100) / SD(dmmu_stats.loads_tlbhit + dmmu_stats.loads_tlbmiss), dmmu_stats.loads_tlbmiss);
|
PRINTF("DMMU read: hit %d(%d%%), miss %d\n", dmmu_stats.loads_tlbhit, (dmmu_stats.loads_tlbhit * 100) / SD(dmmu_stats.loads_tlbhit + dmmu_stats.loads_tlbmiss), dmmu_stats.loads_tlbmiss);
|
} else
|
} else
|
printf("No DMMU. Set UPR[DMP]\n");
|
PRINTF("No DMMU. Set UPR[DMP]\n");
|
|
|
printf("Additional LOAD CYCLES: %u STORE CYCLES: %u\n", runtime.sim.loadcycles, runtime.sim.storecycles);
|
PRINTF("Additional LOAD CYCLES: %u STORE CYCLES: %u\n", runtime.sim.loadcycles, runtime.sim.storecycles);
|
}
|
}
|
|
|
void printstats(int which)
|
void printstats(int which)
|
{
|
{
|
int i, all = 0, dependall = 0;
|
int i, all = 0, dependall = 0;
|
|
|
if (which > 1 && which <= 5 && !config.cpu.dependstats) {
|
if (which > 1 && which <= 5 && !config.cpu.dependstats) {
|
printf("Hazard analysis disabled. Enable it to see analysis results.\n");
|
PRINTF("Hazard analysis disabled. Enable it to see analysis results.\n");
|
return;
|
return;
|
}
|
}
|
|
|
switch (which) {
|
switch (which) {
|
case 1:
|
case 1:
|
printf("stats 1: Misc stats\n");
|
PRINTF("stats 1: Misc stats\n");
|
printotherstats(which);
|
printotherstats(which);
|
break;
|
break;
|
case 2:
|
case 2:
|
printf ("stats 2: Instruction usage\n");
|
PRINTF ("stats 2: Instruction usage\n");
|
for(i = 0; i < SSTATS_LEN; i++)
|
for(i = 0; i < SSTATS_LEN; i++)
|
all += sstats[i].cnt_dynamic;
|
all += sstats[i].cnt_dynamic;
|
|
|
for(i = 0; i < SSTATS_LEN; i++)
|
for(i = 0; i < SSTATS_LEN; i++)
|
if (sstats[i].cnt_dynamic)
|
if (sstats[i].cnt_dynamic)
|
printf(" %-15s used %6dx (%5.1f%%)\n", insn_name(sstats[i].insn), sstats[i].cnt_dynamic, (sstats[i].cnt_dynamic * 100.)/SD(all));
|
PRINTF(" %-15s used %6dx (%5.1f%%)\n", insn_name(sstats[i].insn), sstats[i].cnt_dynamic, (sstats[i].cnt_dynamic * 100.)/SD(all));
|
|
|
printf("%d instructions (dynamic, single stats)\n", all);
|
PRINTF("%d instructions (dynamic, single stats)\n", all);
|
break;
|
break;
|
|
|
case 3:
|
case 3:
|
printf ("stats 3: Instruction dependencies\n");
|
PRINTF ("stats 3: Instruction dependencies\n");
|
for(i = 0; i < DSTATS_LEN; i++) {
|
for(i = 0; i < DSTATS_LEN; i++) {
|
all += dstats[i].cnt_dynamic;
|
all += dstats[i].cnt_dynamic;
|
dependall += dstats[i].depend;
|
dependall += dstats[i].depend;
|
}
|
}
|
|
|
for(i = 0; i < DSTATS_LEN; i++)
|
for(i = 0; i < DSTATS_LEN; i++)
|
if (dstats[i].cnt_dynamic) {
|
if (dstats[i].cnt_dynamic) {
|
char temp[100];
|
char temp[100];
|
sprintf(temp, "%s, %s ", insn_name(dstats[i].insn1), insn_name(dstats[i].insn2));
|
sprintf(temp, "%s, %s ", insn_name(dstats[i].insn1), insn_name(dstats[i].insn2));
|
printf(" %-30s %6dx (%5.1f%%)", temp, dstats[i].cnt_dynamic, (dstats[i].cnt_dynamic * 100.)/SD(all));
|
PRINTF(" %-30s %6dx (%5.1f%%)", temp, dstats[i].cnt_dynamic, (dstats[i].cnt_dynamic * 100.)/SD(all));
|
printf(" depend: %5.1f%%\n", (dstats[i].depend * 100.) / dstats[i].cnt_dynamic);
|
PRINTF(" depend: %5.1f%%\n", (dstats[i].depend * 100.) / dstats[i].cnt_dynamic);
|
}
|
}
|
|
|
printf("%d instructions (dynamic, dependency stats) depend: %d%%\n", all, (dependall * 100) / SD(all));
|
PRINTF("%d instructions (dynamic, dependency stats) depend: %d%%\n", all, (dependall * 100) / SD(all));
|
break;
|
break;
|
|
|
case 4:
|
case 4:
|
printf("stats 4: Functional units dependencies\n");
|
PRINTF("stats 4: Functional units dependencies\n");
|
for(i = 0; i < FSTATS_LEN; i++) {
|
for(i = 0; i < FSTATS_LEN; i++) {
|
all += fstats[i].cnt_dynamic;
|
all += fstats[i].cnt_dynamic;
|
dependall += fstats[i].depend;
|
dependall += fstats[i].depend;
|
}
|
}
|
|
|
for(i = 0; i < FSTATS_LEN; i++)
|
for(i = 0; i < FSTATS_LEN; i++)
|
if (fstats[i].cnt_dynamic) {
|
if (fstats[i].cnt_dynamic) {
|
char temp[100];
|
char temp[100];
|
sprintf(temp, "%s, %s", func_unit_str[fstats[i].insn1], func_unit_str[fstats[i].insn2]);
|
sprintf(temp, "%s, %s", func_unit_str[fstats[i].insn1], func_unit_str[fstats[i].insn2]);
|
printf(" %-30s %6dx (%5.1f%%)", temp, fstats[i].cnt_dynamic, (fstats[i].cnt_dynamic * 100.)/SD(all));
|
PRINTF(" %-30s %6dx (%5.1f%%)", temp, fstats[i].cnt_dynamic, (fstats[i].cnt_dynamic * 100.)/SD(all));
|
printf(" depend: %5.1f%%\n", (fstats[i].depend * 100.) / fstats[i].cnt_dynamic);
|
PRINTF(" depend: %5.1f%%\n", (fstats[i].depend * 100.) / fstats[i].cnt_dynamic);
|
}
|
}
|
printf ("%d instructions (dynamic, functional units stats) depend: %d%%\n\n", all, (dependall * 100) / SD(all));
|
PRINTF ("%d instructions (dynamic, functional units stats) depend: %d%%\n\n", all, (dependall * 100) / SD(all));
|
break;
|
break;
|
|
|
case 5:
|
case 5:
|
printf("stats 5: Raw register usage over time\n");
|
PRINTF("stats 5: Raw register usage over time\n");
|
#if RAW_RANGE_STATS
|
#if RAW_RANGE_STATS
|
for(i = 0; (i < MAX_RANGE); i++)
|
for(i = 0; (i < MAX_RANGE); i++)
|
printf(" Register set and reused in %d. cycle: %d cases\n", i, raw_stats.range[i]);
|
PRINTF(" Register set and reused in %d. cycle: %d cases\n", i, raw_stats.range[i]);
|
#endif
|
#endif
|
break;
|
break;
|
case 6:
|
case 6:
|
if (config.cpu.sbuf_len) {
|
if (config.cpu.sbuf_len) {
|
extern int sbuf_total_cyc, sbuf_wait_cyc;
|
extern int sbuf_total_cyc, sbuf_wait_cyc;
|
printf ("stats 6: Store buffer analysis\n");
|
PRINTF ("stats 6: Store buffer analysis\n");
|
printf ("Using store buffer of length %i.\n", config.cpu.sbuf_len);
|
PRINTF ("Using store buffer of length %i.\n", config.cpu.sbuf_len);
|
printf ("Number of total memory store cycles: %i/%i\n", sbuf_total_cyc, runtime.sim.cycles + sbuf_total_cyc - sbuf_wait_cyc);
|
PRINTF ("Number of total memory store cycles: %i/%i\n", sbuf_total_cyc, runtime.sim.cycles + sbuf_total_cyc - sbuf_wait_cyc);
|
printf ("Number of cycles waiting for memory stores: %i\n", sbuf_wait_cyc);
|
PRINTF ("Number of cycles waiting for memory stores: %i\n", sbuf_wait_cyc);
|
printf ("Number of memory cycles spared: %i\n", sbuf_total_cyc - sbuf_wait_cyc);
|
PRINTF ("Number of memory cycles spared: %i\n", sbuf_total_cyc - sbuf_wait_cyc);
|
printf ("Store speedup %3.2f%%, total speedup %3.2f%%\n", 100.*(sbuf_total_cyc - sbuf_wait_cyc)/sbuf_total_cyc,
|
PRINTF ("Store speedup %3.2f%%, total speedup %3.2f%%\n", 100.*(sbuf_total_cyc - sbuf_wait_cyc)/sbuf_total_cyc,
|
100.*(sbuf_total_cyc - sbuf_wait_cyc) / (runtime.sim.cycles + sbuf_total_cyc - sbuf_wait_cyc));
|
100.*(sbuf_total_cyc - sbuf_wait_cyc) / (runtime.sim.cycles + sbuf_total_cyc - sbuf_wait_cyc));
|
} else
|
} else
|
printf ("Store buffer analysis disabled. Enable it to see analysis results.\n");
|
PRINTF ("Store buffer analysis disabled. Enable it to see analysis results.\n");
|
break;
|
break;
|
default:
|
default:
|
printf ("Please specify a stats group (1-6).\n");
|
PRINTF ("Please specify a stats group (1-6).\n");
|
break;
|
break;
|
}
|
}
|
#if 0
|
#if 0
|
printf("Byte ADD: %d instructions\n", mstats.byteadd);
|
PRINTF("Byte ADD: %d instructions\n", mstats.byteadd);
|
#endif
|
#endif
|
}
|
}
|
|
|
No newline at end of file
|
No newline at end of file
|