Index: ps/trunk/source/ps/Profile.h =================================================================== --- ps/trunk/source/ps/Profile.h +++ ps/trunk/source/ps/Profile.h @@ -179,15 +179,16 @@ if (CProfileManager::IsInitialised()) { // The profiler is only safe to use on the main thread - ENSURE(ThreadUtil::IsMainThread()); - g_Profiler.Start(name); + if(ThreadUtil::IsMainThread()) + g_Profiler.Start(name); } } ~CProfileSample() { if (CProfileManager::IsInitialised()) - g_Profiler.Stop(); + if(ThreadUtil::IsMainThread()) + g_Profiler.Stop(); } }; Index: ps/trunk/source/simulation2/helpers/HierarchicalPathfinder.cpp =================================================================== --- ps/trunk/source/simulation2/helpers/HierarchicalPathfinder.cpp +++ ps/trunk/source/simulation2/helpers/HierarchicalPathfinder.cpp @@ -351,7 +351,7 @@ const std::map& nonPathfindingPassClassMasks, const std::map& pathfindingPassClassMasks) { - PROFILE3("Hierarchical Recompute"); + PROFILE2("Hierarchical Recompute"); m_PassClassMasks = pathfindingPassClassMasks; @@ -399,7 +399,6 @@ if (m_DebugOverlay) { - PROFILE("debug overlay"); m_DebugOverlayLines.clear(); AddDebugEdges(GetPassabilityClass("default")); } @@ -448,7 +447,6 @@ if (m_DebugOverlay) { - PROFILE("debug overlay"); m_DebugOverlayLines.clear(); AddDebugEdges(GetPassabilityClass("default")); } Index: ps/trunk/source/simulation2/helpers/LongPathfinder.cpp =================================================================== --- ps/trunk/source/simulation2/helpers/LongPathfinder.cpp +++ ps/trunk/source/simulation2/helpers/LongPathfinder.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -289,7 +289,7 @@ void reset(const Grid* terrain, pass_class_t passClass) { - PROFILE3("JumpPointCache reset"); + PROFILE2("JumpPointCache reset"); TIMER(L"JumpPointCache reset"); m_Width = terrain->m_W; Index: ps/trunk/source/simulation2/helpers/Render.cpp =================================================================== --- ps/trunk/source/simulation2/helpers/Render.cpp +++ ps/trunk/source/simulation2/helpers/Render.cpp @@ -35,8 +35,6 @@ void SimRender::ConstructLineOnGround(const CSimContext& context, const std::vector& xz, SOverlayLine& overlay, bool floating, float heightOffset) { - PROFILE("ConstructLineOnGround"); - overlay.m_Coords.clear(); CmpPtr cmpTerrain(context, SYSTEM_ENTITY);