mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-19 11:43:56 +00:00
Print instruction summary
This commit is contained in:
@@ -221,8 +221,33 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
void print_instruction_summary(const analysis_context& c)
|
||||
{
|
||||
std::map<uint64_t, std::vector<std::string>> instruction_counts{};
|
||||
|
||||
for (const auto& [mnemonic, count] : c.instructions)
|
||||
{
|
||||
instruction_counts[count].push_back(mnemonic);
|
||||
}
|
||||
|
||||
c.win_emu->log.print(color::white, "Instruction summary:\n");
|
||||
|
||||
for (const auto& [count, mnemonics] : instruction_counts)
|
||||
{
|
||||
for (const auto& mnemonic : mnemonics)
|
||||
{
|
||||
c.win_emu->log.print(color::white, "%s: %" PRIx64 "\n", mnemonic.c_str(), count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void do_post_emulation_work(const analysis_context& c)
|
||||
{
|
||||
if (c.settings->instruction_summary)
|
||||
{
|
||||
print_instruction_summary(c);
|
||||
}
|
||||
|
||||
if (c.settings->buffer_stdout)
|
||||
{
|
||||
c.win_emu->log.info("%.*s%s", static_cast<int>(c.output.size()), c.output.data(), c.output.ends_with("\n") ? "" : "\n");
|
||||
@@ -647,6 +672,10 @@ namespace
|
||||
{
|
||||
options.tenet_trace = true;
|
||||
}
|
||||
else if (arg == "-is" || arg == "--instruction-summary")
|
||||
{
|
||||
options.instruction_summary = true;
|
||||
}
|
||||
else if (arg == "-m" || arg == "--module")
|
||||
{
|
||||
if (args.size() < 2)
|
||||
|
||||
Reference in New Issue
Block a user