mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Profiler changes
This commit is contained in:
parent
3122839ea8
commit
bb73aced22
2 changed files with 48 additions and 2 deletions
42
IDE/include/BeefDbg.h
Normal file
42
IDE/include/BeefDbg.h
Normal file
|
@ -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
|
|
@ -103,11 +103,15 @@ DbgProfiler::DbgProfiler(WinDebugger* debugger) : mShutdownEvent(true)
|
||||||
mDebugger->AddProfiler(this);
|
mDebugger->AddProfiler(this);
|
||||||
|
|
||||||
mIdleSymbolNames.Add("NtUserGetMessage");
|
mIdleSymbolNames.Add("NtUserGetMessage");
|
||||||
|
mIdleSymbolNames.Add("NtUserMsgWaitForMultipleObjectsEx");
|
||||||
mIdleSymbolNames.Add("NtWaitForAlertByThreadId");
|
mIdleSymbolNames.Add("NtWaitForAlertByThreadId");
|
||||||
mIdleSymbolNames.Add("NtWaitForMultipleObjects");
|
mIdleSymbolNames.Add("NtWaitForMultipleObjects");
|
||||||
mIdleSymbolNames.Add("NtWaitForSingleObject");
|
mIdleSymbolNames.Add("NtWaitForSingleObject");
|
||||||
mIdleSymbolNames.Add("ZwDelayExecution");
|
mIdleSymbolNames.Add("ZwDelayExecution");
|
||||||
mIdleSymbolNames.Add("ZwRemoveIoCompletion");
|
mIdleSymbolNames.Add("ZwRemoveIoCompletion");
|
||||||
|
mIdleSymbolNames.Add("ZwWaitForAlertByThreadId");
|
||||||
|
mIdleSymbolNames.Add("ZwWaitForMultipleObjects");
|
||||||
|
mIdleSymbolNames.Add("ZwWaitForSingleObject");
|
||||||
mIdleSymbolNames.Add("ZwWaitForWorkViaWorkerFactory");
|
mIdleSymbolNames.Add("ZwWaitForWorkViaWorkerFactory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,8 +275,8 @@ void DbgProfiler::ThreadProc()
|
||||||
int wantVirtualSamples = (int)((int64)accumMS * mSamplesPerSecond / 1000);
|
int wantVirtualSamples = (int)((int64)accumMS * mSamplesPerSecond / 1000);
|
||||||
|
|
||||||
int curSampleCount = wantVirtualSamples - mTotalVirtualSamples;
|
int curSampleCount = wantVirtualSamples - mTotalVirtualSamples;
|
||||||
BF_ASSERT(curSampleCount >= 0);
|
//BF_ASSERT(curSampleCount >= 0);
|
||||||
if (curSampleCount == 0)
|
if (curSampleCount <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue