Skip to content

Commit

Permalink
Improve accuracy of block timing
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Jun 7, 2024
1 parent 901295b commit 5922453
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Core/MIPS/IR/IRJit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,12 @@ void IRJit::RunLoopUntil(u64 globalticks) {
if (opcode == MIPS_EMUHACK_OPCODE) {
u32 offset = inst & 0x00FFFFFF; // Alternatively, inst - opcode
#ifdef IR_PROFILING
{
TimeSpan span;
IRBlock *block = blocks_.GetBlock(blocks_.GetBlockNumFromOffset(inst & 0xFFFFFF));
mips->pc = IRInterpret(mips, blocks_.GetArenaPtr() + offset);
block->profileStats_.executions += 1;
block->profileStats_.totalNanos += span.ElapsedNanos();
}
IRBlock *block = blocks_.GetBlock(blocks_.GetBlockNumFromOffset(offset));
TimeSpan span;
mips->pc = IRInterpret(mips, blocks_.GetArenaPtr() + offset);
int64_t elapsedNanos = span.ElapsedNanos();
block->profileStats_.executions += 1;
block->profileStats_.totalNanos += elapsedNanos;
#else
mips->pc = IRInterpret(mips, blocks_.GetArenaPtr() + offset);
#endif
Expand Down
1 change: 1 addition & 0 deletions Core/MIPS/IR/IRJit.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class IRBlock {
u64 CalculateHash() const;

// Offset into the block cache's Arena
// TODO: These should maybe be stored in a separate array.
u32 instOffset_ = 0;
u64 hash_ = 0;
u32 origAddr_ = 0;
Expand Down

0 comments on commit 5922453

Please sign in to comment.