From 430829c57a99638814d99c4d8c6684d406062286 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Fri, 31 Jan 2020 17:16:44 -0800 Subject: [PATCH] Removing some AutoPerfs --- BeefySysLib/gfx/DrawLayer.cpp | 7 ++++--- BeefySysLib/util/BumpAllocator.h | 3 +-- IDEHelper/DbgExprEvaluator.cpp | 33 +++++++++----------------------- 3 files changed, 14 insertions(+), 29 deletions(-) diff --git a/BeefySysLib/gfx/DrawLayer.cpp b/BeefySysLib/gfx/DrawLayer.cpp index fdcc584b..24cefac8 100644 --- a/BeefySysLib/gfx/DrawLayer.cpp +++ b/BeefySysLib/gfx/DrawLayer.cpp @@ -4,6 +4,7 @@ #include "gfx/RenderDevice.h" #include "gfx/Shader.h" #include "util/PerfTimer.h" +#include "util/BeefPerf.h" USING_NS_BF; @@ -185,7 +186,7 @@ void DrawLayer::QueueRenderCmd(RenderCmd* renderCmd) DrawBatch* DrawLayer::AllocateBatch(int minVtxCount, int minIdxCount) { - AutoPerf autoPerf("DrawLayer::AllocateBatch"); + BP_ZONE("DrawLayer::AllocateBatch"); BF_ASSERT(mRenderDevice->mCurRenderState->mShader != NULL); int vtxSize = mRenderDevice->mCurRenderState->mShader->mVertexSize; @@ -258,7 +259,7 @@ DrawBatch* DrawLayer::AllocateBatch(int minVtxCount, int minIdxCount) void DrawLayer::Draw() { - AutoPerf autoPerf("DrawLayer::Draw"); + BP_ZONE("DrawLayer::Draw"); RenderCmd* curRenderCmd = mRenderCmdList.mHead; while (curRenderCmd != NULL) @@ -384,7 +385,7 @@ BF_EXPORT void BF_CALLTYPE DrawLayer_DrawToRenderTarget(DrawLayer* drawLayer, Te { RenderDevice* renderDevice = gBFApp->mRenderDevice; - AutoPerf autoPerf("DrawLayer_DrawToRenderTarget DrawPart"); + BP_ZONE("DrawLayer_DrawToRenderTarget DrawPart"); RenderTarget* prevTarget = renderDevice->mCurRenderTarget; renderDevice->PhysSetRenderState(renderDevice->mDefaultRenderState); renderDevice->PhysSetRenderTarget(textureSegment->mTexture); diff --git a/BeefySysLib/util/BumpAllocator.h b/BeefySysLib/util/BumpAllocator.h index 54c20f61..5af6a684 100644 --- a/BeefySysLib/util/BumpAllocator.h +++ b/BeefySysLib/util/BumpAllocator.h @@ -210,8 +210,7 @@ public: mPools.push_back(bigData); return bigData; } - - //AutoPerf perf("Alloc"); + if (mCurPtr + wantSize >= mCurAlloc + ALLOC_SIZE) GrowPool(); diff --git a/IDEHelper/DbgExprEvaluator.cpp b/IDEHelper/DbgExprEvaluator.cpp index 857b6c0f..0bdfaf57 100644 --- a/IDEHelper/DbgExprEvaluator.cpp +++ b/IDEHelper/DbgExprEvaluator.cpp @@ -2385,9 +2385,7 @@ bool DbgExprEvaluator::HasField(DbgType* curCheckType, const StringImpl& fieldNa } DbgTypedValue DbgExprEvaluator::DoLookupField(BfAstNode* targetSrc, DbgTypedValue target, DbgType* curCheckType, const StringImpl& fieldName, CPUStackFrame* stackFrame, bool allowImplicitThis) -{ - AutoPerf perf("DbgExprEvaluator::DoLookupField"); - +{ bool wantsStatic = (!target) || (target.mHasNoValue); auto flavor = GetFlavor(); auto language = GetLanguage(); @@ -2795,9 +2793,7 @@ DbgTypedValue DbgExprEvaluator::DoLookupField(BfAstNode* targetSrc, DbgTypedValu } DbgTypedValue DbgExprEvaluator::LookupField(BfAstNode* targetSrc, DbgTypedValue target, const StringImpl& fieldName) -{ - AutoPerf perf("DbgExprEvaluator::LookupField"); - +{ CPUStackFrame* stackFrame = GetStackFrame(); DbgType* curCheckType = NULL; @@ -3411,9 +3407,7 @@ void DbgExprEvaluator::AutocompleteAddTopLevelTypes(const StringImpl& filter) } DbgTypedValue DbgExprEvaluator::LookupIdentifier(BfAstNode* identifierNode, bool ignoreInitialError, bool* hadError) -{ - AutoPerf perf("DbgExprEvaluator::LookupIdentifier"); - +{ if (!mDebugger->mIsRunning) return DbgTypedValue(); @@ -3540,16 +3534,14 @@ DbgTypedValue DbgExprEvaluator::LookupIdentifier(BfAstNode* identifierNode, bool Array capturedTypes; mDebugTarget->mCapturedNamesPtr = &capturedNames; mDebugTarget->mCapturedTypesPtr = &capturedTypes; - { - AutoPerf perf("mDebugTarget->GetValueByName"); + { mDebugTarget->GetValueByName(GetCurrentMethod(), "*", stackFrame, &valAddr, &valType, &addrType); } mDebugTarget->mCapturedNamesPtr = NULL; mDebugTarget->mCapturedTypesPtr = NULL; auto language = GetLanguage(); BF_ASSERT(capturedTypes.size() == capturedNames.size()); - { - AutoPerf perf("capturedNames Add"); + { //for (auto capturedName : capturedNames) for (int i = 0; i < (int)capturedNames.size(); i++) { @@ -3636,8 +3628,7 @@ DbgTypedValue DbgExprEvaluator::LookupIdentifier(BfAstNode* identifierNode, bool if (language == DbgLanguage_C) { - // For C++ lambdas, captured a "this" is named "__this", so allow lookups into that - AutoPerf perf("GetValueByName __lambda"); + // For C++ lambdas, captured a "this" is named "__this", so allow lookups into that auto currentMethod = GetCurrentMethod(); if (currentMethod != NULL) { @@ -3693,8 +3684,7 @@ DbgTypedValue DbgExprEvaluator::LookupIdentifier(BfAstNode* identifierNode, bool } if (stackFrame != NULL) - { - AutoPerf perf("GetValueByName findName"); + { if (mDebugTarget->GetValueByName(GetCurrentMethod(), findName, stackFrame, &valAddr, &valType, &addrType)) { //BF_ASSERT(valType != NULL); @@ -3723,8 +3713,7 @@ DbgTypedValue DbgExprEvaluator::LookupIdentifier(BfAstNode* identifierNode, bool bool isClosure = false; if (language == DbgLanguage_Beef) - { - AutoPerf perf("GetValueByName __closure"); + { intptr valAddr; DbgType* valType; //bool valIsAddr = false; @@ -4166,8 +4155,6 @@ void DbgExprEvaluator::AutocompleteAddMembers(DbgType* dbgType, bool wantsStatic if ((mDbgCompileUnit != NULL) && (dbgType->mLanguage != DbgLanguage_Unknown) && (dbgType->mLanguage != language)) return; - AutoPerf perf("DbgExprEvaluator::AutocompleteAddMembers"); - dbgType->PopulateType(); if (dbgType->mNeedsGlobalsPopulated) mDbgModule->PopulateTypeGlobals(dbgType); @@ -7943,9 +7930,7 @@ void DbgExprEvaluator::Visit(BfTupleExpression* tupleExpr) } DbgTypedValue DbgExprEvaluator::Resolve(BfExpression* expr, DbgType* wantType) -{ - AutoPerf perf3("DbgExprEvaluator::Resolve"); - +{ BF_ASSERT(!HasPropResult()); SetAndRestoreValue prevType(mExpectingType, wantType);