Added stats.

9.8% of the instructions in 3dscraft.
This commit is contained in:
Dani Messerman 2015-05-01 00:12:24 +03:00
parent 8331f6b3cc
commit 7b8fd8daad

View File

@ -197,14 +197,20 @@ void ModuleGen::GenerateRunFunction()
void ModuleGen::DecodeInstructions() void ModuleGen::DecodeInstructions()
{ {
size_t generated = 0;
size_t total = 0;
for (auto i = Loader::ROMCodeStart; i <= Loader::ROMCodeStart + Loader::ROMCodeSize - 4; i += 4) for (auto i = Loader::ROMCodeStart; i <= Loader::ROMCodeStart + Loader::ROMCodeSize - 4; i += 4)
{ {
++total;
auto instruction = Disassembler::Disassemble(Memory::Read32(i), i); auto instruction = Disassembler::Disassemble(Memory::Read32(i), i);
if (instruction == nullptr) continue; if (instruction == nullptr) continue;
++generated;
auto instruction_block = std::make_unique<InstructionBlock>(this, instruction.release()); auto instruction_block = std::make_unique<InstructionBlock>(this, instruction.release());
instruction_blocks_by_pc[i] = instruction_block.get(); instruction_blocks_by_pc[i] = instruction_block.get();
instruction_blocks.push_back(std::move(instruction_block)); instruction_blocks.push_back(std::move(instruction_block));
} }
LOG_INFO(BinaryTranslator, "Generated % 8d blocks of % 8d = % 3.1f%%", generated, total, 100.0 * generated / total);
} }
void ModuleGen::GenerateInstructionsEntry() void ModuleGen::GenerateInstructionsEntry()