fix for global stats
This commit is contained in:
parent
f3522adb9b
commit
91902b8b17
3 changed files with 3 additions and 3 deletions
2
cpu.cpp
2
cpu.cpp
|
@ -78,7 +78,7 @@ std::tuple<double, double, uint64_t, uint32_t, double> cpu::get_mips_rel_speed(c
|
|||
|
||||
uint64_t t_diff = t_diff_in.has_value() ? t_diff_in.value() : (get_us() - running_since - wait_time);
|
||||
|
||||
double mips = instr_count / double(t_diff);
|
||||
double mips = t_diff ? instr_count / double(t_diff) : 0;
|
||||
|
||||
// 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
|
||||
|
|
|
@ -211,7 +211,7 @@ void reg_dump(console *const cnsl, cpu *const c)
|
|||
|
||||
void show_run_statistics(console *const cnsl, cpu *const c)
|
||||
{
|
||||
auto stats = c->get_mips_rel_speed({ }, false);
|
||||
auto stats = c->get_mips_rel_speed({ }, { });
|
||||
|
||||
cnsl->put_string_lf(format("Executed %zu instructions in %.2f ms of which %.2f ms idle", size_t(std::get<2>(stats)), std::get<3>(stats) / 1000., std::get<4>(stats) / 1000.));
|
||||
cnsl->put_string_lf(format("MIPS: %.2f, relative speed: %.2f%%", std::get<0>(stats), std::get<1>(stats)));
|
||||
|
|
2
main.cpp
2
main.cpp
|
@ -551,7 +551,7 @@ int main(int argc, char *argv[])
|
|||
break;
|
||||
}
|
||||
|
||||
auto stats = c->get_mips_rel_speed({ }, false);
|
||||
auto stats = c->get_mips_rel_speed({ }, { });
|
||||
cnsl->put_string_lf(format("MIPS: %.2f, relative speed: %.2f%%, instructions executed: %" PRIu64 " in %.2f seconds", std::get<0>(stats), std::get<1>(stats), std::get<2>(stats), std::get<3>(stats) / 1000000.));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue