- if (sh2->test_irq)
- {
- if (sh2->pending_irl > sh2->pending_int_irq)
- sh2_irl_irq(sh2, sh2->pending_irl);
- else
- sh2_internal_irq(sh2, sh2->pending_int_irq, sh2->pending_int_vector);
- sh2->test_irq = 0;
+#endif
+
+#ifdef SH2_STATS
+#include <stdio.h>
+#include <string.h>
+#include "sh2dasm.h"
+
+void sh2_dump_stats(void)
+{
+ static const char *rnames[] = {
+ "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7",
+ "R8", "R9", "R10", "R11", "R12", "R13", "R14", "SP",
+ "PC", "", "PR", "SR", "GBR", "VBR", "MACH", "MACL"
+ };
+ long long total;
+ char buff[64];
+ int u, i;
+
+ // dump reg usage
+ total = 0;
+ for (i = 0; i < 24; i++)
+ total += sh2_stats.r[i];
+
+ for (i = 0; i < 24; i++) {
+ if (i == 16 || i == 17 || i == 19)
+ continue;
+ printf("r %6.3f%% %-4s %9d\n", (double)sh2_stats.r[i] * 100.0 / total,
+ rnames[i], sh2_stats.r[i]);