Mesen-SX/Core/Profiler.h
NovaSquirrel c0e249e993 Revert "Merge branch 'reformat_code'"
This reverts commit daf3b57e89, reversing
changes made to 7a6e0b7d77.
2021-03-10 11:13:28 -05:00

46 lines
No EOL
894 B
C++

#pragma once
#include "stdafx.h"
#include "DebugTypes.h"
class Debugger;
class Console;
struct ProfiledFunction
{
uint64_t ExclusiveCycles = 0;
uint64_t InclusiveCycles = 0;
uint64_t CallCount = 0;
uint64_t MinCycles = UINT64_MAX;
uint64_t MaxCycles = 0;
AddressInfo Address;
};
class Profiler
{
private:
Debugger* _debugger;
Console* _console;
unordered_map<int32_t, ProfiledFunction> _functions;
deque<int32_t> _functionStack;
deque<StackFrameFlags> _stackFlags;
deque<uint64_t> _cycleCountStack;
uint64_t _currentCycleCount;
uint64_t _prevMasterClock;
int32_t _currentFunction;
void InternalReset();
void UpdateCycles();
public:
Profiler(Debugger* debugger);
~Profiler();
void StackFunction(AddressInfo& addr, StackFrameFlags stackFlag);
void UnstackFunction();
void Reset();
void GetProfilerData(ProfiledFunction* profilerData, uint32_t& functionCount);
};