2017-06-04 20:38:34 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
#include "Disassembler.h"
|
|
|
|
|
2017-06-09 10:42:32 +00:00
|
|
|
namespace EightBit {
|
2017-09-07 00:15:28 +00:00
|
|
|
namespace GameBoy {
|
2017-06-04 20:38:34 +00:00
|
|
|
|
2017-09-07 00:15:28 +00:00
|
|
|
class LR35902;
|
2017-06-04 20:38:34 +00:00
|
|
|
|
2017-09-07 00:15:28 +00:00
|
|
|
class Profiler {
|
|
|
|
public:
|
|
|
|
Profiler(LR35902& cpu);
|
2017-06-04 20:38:34 +00:00
|
|
|
|
2017-09-07 00:15:28 +00:00
|
|
|
void add(uint16_t address, uint8_t instruction);
|
2017-06-04 20:38:34 +00:00
|
|
|
|
2017-09-07 00:15:28 +00:00
|
|
|
void dump() const;
|
2017-06-04 20:38:34 +00:00
|
|
|
|
2017-09-07 00:15:28 +00:00
|
|
|
private:
|
|
|
|
std::array<uint64_t, 0x100> m_instructions;
|
|
|
|
std::array<uint64_t, 0x10000> m_addresses;
|
|
|
|
LR35902& m_cpu;
|
2017-06-04 20:38:34 +00:00
|
|
|
|
2017-09-07 00:15:28 +00:00
|
|
|
Disassembler m_disassembler;
|
2017-06-04 20:38:34 +00:00
|
|
|
|
2017-09-07 00:15:28 +00:00
|
|
|
void dumpInstructionProfiles() const;
|
|
|
|
void dumpAddressProfiles() const;
|
|
|
|
};
|
|
|
|
}
|
2017-06-09 10:42:32 +00:00
|
|
|
}
|