diff --git a/IDE/include/BeefDbg.h b/IDE/include/BeefDbg.h new file mode 100644 index 00000000..a2bd82d2 --- /dev/null +++ b/IDE/include/BeefDbg.h @@ -0,0 +1,42 @@ +#pragma once + +#ifdef BEEFDBG_IMPLEMENTATION + +struct BfDebugMessageData +{ + int mMessageType; // 0 = none, 1 = error + int mStackWindbackCount; + int mBufParamLen; + const char* mBufParam; + void* mPCOverride; +}; + +extern "C" +{ + BfDebugMessageData gBfDebugMessageData; +} + +extern "C" __declspec(dllimport) void DebugBreak(); + +void BfProfileStart(int sampleRatea = 1000) +{ + char str[128]; + sprintf(str, "StartSampling\t0\t%d\t0"); + gBfDebugMessageData.mBufParam = str; + gBfDebugMessageData.mBufParamLen = strlen(gBfDebugMessageData.mBufParam); + DebugBreak(); +} + +void BfProfileEnd() +{ + gBfDebugMessageData.mBufParam = "StopSampling\t0"; + gBfDebugMessageData.mBufParamLen = strlen(gBfDebugMessageData.mBufParam); + DebugBreak(); +} + +#else + +void BfProfileStart(int sampleRatea = 1000); +void BfProfileEnd(); + +#endif \ No newline at end of file diff --git a/IDEHelper/Profiler.cpp b/IDEHelper/Profiler.cpp index fc37608a..85d43a3a 100644 --- a/IDEHelper/Profiler.cpp +++ b/IDEHelper/Profiler.cpp @@ -103,11 +103,15 @@ DbgProfiler::DbgProfiler(WinDebugger* debugger) : mShutdownEvent(true) mDebugger->AddProfiler(this); mIdleSymbolNames.Add("NtUserGetMessage"); + mIdleSymbolNames.Add("NtUserMsgWaitForMultipleObjectsEx"); mIdleSymbolNames.Add("NtWaitForAlertByThreadId"); mIdleSymbolNames.Add("NtWaitForMultipleObjects"); mIdleSymbolNames.Add("NtWaitForSingleObject"); mIdleSymbolNames.Add("ZwDelayExecution"); mIdleSymbolNames.Add("ZwRemoveIoCompletion"); + mIdleSymbolNames.Add("ZwWaitForAlertByThreadId"); + mIdleSymbolNames.Add("ZwWaitForMultipleObjects"); + mIdleSymbolNames.Add("ZwWaitForSingleObject"); mIdleSymbolNames.Add("ZwWaitForWorkViaWorkerFactory"); } @@ -271,8 +275,8 @@ void DbgProfiler::ThreadProc() int wantVirtualSamples = (int)((int64)accumMS * mSamplesPerSecond / 1000); int curSampleCount = wantVirtualSamples - mTotalVirtualSamples; - BF_ASSERT(curSampleCount >= 0); - if (curSampleCount == 0) + //BF_ASSERT(curSampleCount >= 0); + if (curSampleCount <= 0) continue; {