#pragma once #include "stdafx.h" #include #include class Debugger; enum class ProfilerDataType { FunctionExclusive = 0, FunctionInclusive = 1, Instructions = 2, FunctionCallCount = 3, }; class Profiler { private: Debugger* _debugger; vector _cyclesByInstruction; vector _cyclesByFunction; vector _cyclesByFunctionInclusive; vector _functionCallCount; std::stack _functionStack; std::stack _jsrStack; std::stack _cycleCountStack; uint64_t _currentCycleCount; int32_t _currentFunction; int32_t _currentInstruction; int32_t _nextFunctionAddr; uint32_t _resetFunctionIndex; uint32_t _inMemoryFunctionIndex; public: Profiler(Debugger* debugger); void ProcessInstructionStart(int32_t absoluteAddr); void ProcessCycle(); void StackFunction(int32_t instructionAddr, int32_t functionAddr); void UnstackFunction(); void Reset(); void GetProfilerData(int64_t* profilerData, ProfilerDataType type); };