Merge pull request #8240 from liamwhite/count-cycles

core/arm: re-enable cycle counting
This commit is contained in:
Morph 2022-08-07 20:30:57 -04:00 committed by GitHub
commit 30515b3b27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 8 deletions

View file

@ -125,7 +125,9 @@ public:
} }
void AddTicks(u64 ticks) override { void AddTicks(u64 ticks) override {
ASSERT_MSG(!parent.uses_wall_clock, "This should never happen - dynarmic ticking disabled"); if (parent.uses_wall_clock) {
return;
}
// Divide the number of ticks by the amount of CPU cores. TODO(Subv): This yields only a // Divide the number of ticks by the amount of CPU cores. TODO(Subv): This yields only a
// rough approximation of the amount of executed ticks in the system, it may be thrown off // rough approximation of the amount of executed ticks in the system, it may be thrown off
@ -142,7 +144,12 @@ public:
} }
u64 GetTicksRemaining() override { u64 GetTicksRemaining() override {
ASSERT_MSG(!parent.uses_wall_clock, "This should never happen - dynarmic ticking disabled"); if (parent.uses_wall_clock) {
if (!parent.interrupt_handlers[parent.core_index].IsInterrupted()) {
return minimum_run_cycles;
}
return 0U;
}
return std::max<s64>(parent.system.CoreTiming().GetDowncount(), 0); return std::max<s64>(parent.system.CoreTiming().GetDowncount(), 0);
} }
@ -172,7 +179,7 @@ public:
Core::Memory::Memory& memory; Core::Memory::Memory& memory;
std::size_t num_interpreted_instructions{}; std::size_t num_interpreted_instructions{};
bool debugger_enabled{}; bool debugger_enabled{};
static constexpr u64 minimum_run_cycles = 1000U; static constexpr u64 minimum_run_cycles = 10000U;
}; };
std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable* page_table) const { std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable* page_table) const {
@ -200,7 +207,7 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable*
// Timing // Timing
config.wall_clock_cntpct = uses_wall_clock; config.wall_clock_cntpct = uses_wall_clock;
config.enable_cycle_counting = !uses_wall_clock; config.enable_cycle_counting = true;
// Code cache size // Code cache size
config.code_cache_size = 512_MiB; config.code_cache_size = 512_MiB;

View file

@ -166,7 +166,9 @@ public:
} }
void AddTicks(u64 ticks) override { void AddTicks(u64 ticks) override {
ASSERT_MSG(!parent.uses_wall_clock, "This should never happen - dynarmic ticking disabled"); if (parent.uses_wall_clock) {
return;
}
// Divide the number of ticks by the amount of CPU cores. TODO(Subv): This yields only a // Divide the number of ticks by the amount of CPU cores. TODO(Subv): This yields only a
// rough approximation of the amount of executed ticks in the system, it may be thrown off // rough approximation of the amount of executed ticks in the system, it may be thrown off
@ -181,7 +183,12 @@ public:
} }
u64 GetTicksRemaining() override { u64 GetTicksRemaining() override {
ASSERT_MSG(!parent.uses_wall_clock, "This should never happen - dynarmic ticking disabled"); if (parent.uses_wall_clock) {
if (!parent.interrupt_handlers[parent.core_index].IsInterrupted()) {
return minimum_run_cycles;
}
return 0U;
}
return std::max<s64>(parent.system.CoreTiming().GetDowncount(), 0); return std::max<s64>(parent.system.CoreTiming().GetDowncount(), 0);
} }
@ -216,7 +223,7 @@ public:
u64 tpidrro_el0 = 0; u64 tpidrro_el0 = 0;
u64 tpidr_el0 = 0; u64 tpidr_el0 = 0;
bool debugger_enabled{}; bool debugger_enabled{};
static constexpr u64 minimum_run_cycles = 1000U; static constexpr u64 minimum_run_cycles = 10000U;
}; };
std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable* page_table, std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable* page_table,
@ -260,7 +267,7 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable*
// Timing // Timing
config.wall_clock_cntpct = uses_wall_clock; config.wall_clock_cntpct = uses_wall_clock;
config.enable_cycle_counting = !uses_wall_clock; config.enable_cycle_counting = true;
// Code cache size // Code cache size
config.code_cache_size = 512_MiB; config.code_cache_size = 512_MiB;