show instruction count together with the mips-count
This commit is contained in:
parent
c033268ee6
commit
a9090e0acd
4 changed files with 8 additions and 6 deletions
8
cpu.cpp
8
cpu.cpp
|
@ -66,11 +66,13 @@ uint64_t cpu::get_instructions_executed_count()
|
||||||
return instruction_count;
|
return instruction_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<double, double> cpu::get_mips_rel_speed()
|
std::tuple<double, double, uint64_t> cpu::get_mips_rel_speed()
|
||||||
{
|
{
|
||||||
|
uint64_t instr_count = get_instructions_executed_count();
|
||||||
|
|
||||||
uint32_t t_diff = get_ms() - running_since;
|
uint32_t t_diff = get_ms() - running_since;
|
||||||
|
|
||||||
double mips = get_instructions_executed_count() / (1000.0 * t_diff);
|
double mips = instr_count / (1000.0 * t_diff);
|
||||||
|
|
||||||
// see https://retrocomputing.stackexchange.com/questions/6960/what-was-the-clock-speed-and-ips-for-the-original-pdp-11
|
// see https://retrocomputing.stackexchange.com/questions/6960/what-was-the-clock-speed-and-ips-for-the-original-pdp-11
|
||||||
constexpr double pdp11_clock_cycle = 150; // ns, for the 11/70
|
constexpr double pdp11_clock_cycle = 150; // ns, for the 11/70
|
||||||
|
@ -78,7 +80,7 @@ std::pair<double, double> cpu::get_mips_rel_speed()
|
||||||
constexpr double pdp11_avg_cycles_per_instruction = (1 + 5) / 2.0;
|
constexpr double pdp11_avg_cycles_per_instruction = (1 + 5) / 2.0;
|
||||||
constexpr double pdp11_estimated_mips = pdp11_mhz / pdp11_avg_cycles_per_instruction;
|
constexpr double pdp11_estimated_mips = pdp11_mhz / pdp11_avg_cycles_per_instruction;
|
||||||
|
|
||||||
return { mips, mips * 100 / pdp11_estimated_mips };
|
return { mips, mips * 100 / pdp11_estimated_mips, instr_count };
|
||||||
}
|
}
|
||||||
|
|
||||||
void cpu::reset()
|
void cpu::reset()
|
||||||
|
|
2
cpu.h
2
cpu.h
|
@ -82,7 +82,7 @@ public:
|
||||||
|
|
||||||
void emulation_start();
|
void emulation_start();
|
||||||
uint64_t get_instructions_executed_count();
|
uint64_t get_instructions_executed_count();
|
||||||
std::pair<double, double> get_mips_rel_speed();
|
std::tuple<double, double, uint64_t> get_mips_rel_speed();
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
|
||||||
|
|
||||||
if (!single_step) {
|
if (!single_step) {
|
||||||
auto speed = c->get_mips_rel_speed();
|
auto speed = c->get_mips_rel_speed();
|
||||||
cnsl->debug("MIPS: %.2f, relative speed: %.2f%%", speed.first, speed.second);
|
cnsl->debug("MIPS: %.2f, relative speed: %.2f%%, instructions executed: %lu", std::get<0>(speed), std::get<1>(speed), std::get<2>(speed));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*stop_event == EVENT_INTERRUPT) {
|
if (*stop_event == EVENT_INTERRUPT) {
|
||||||
|
|
2
main.cpp
2
main.cpp
|
@ -252,7 +252,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
auto stats = c->get_mips_rel_speed();
|
auto stats = c->get_mips_rel_speed();
|
||||||
|
|
||||||
printf("MIPS: %.2f, running speed: %.2f%%\n", stats.first, stats.second);
|
printf("MIPS: %.2f, relative speed: %.2f%%, instructions executed: %lu", std::get<0>(stats), std::get<1>(stats), std::get<2>(stats));
|
||||||
}
|
}
|
||||||
|
|
||||||
event = EVENT_TERMINATE;
|
event = EVENT_TERMINATE;
|
||||||
|
|
Loading…
Add table
Reference in a new issue