From 42e3d55fb2d0579b968ff8df20e9a814229b3e72 Mon Sep 17 00:00:00 2001
From: Monty Brandenberg <monty@lindenlab.com>
Date: Wed, 28 Aug 2013 18:55:29 -0400
Subject: Add conditional LLFastTimer blocks to stallable main thread methods

---
 indra/newview/llmeshrepository.cpp | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 6dc834e852..0599fcfd2d 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -67,6 +67,7 @@
 #include "llfoldertype.h"
 #include "llviewerparcelmgr.h"
 #include "lluploadfloaterobservers.h"
+#include "llfasttimer.h"
 
 #include "boost/lexical_cast.hpp"
 
@@ -125,6 +126,16 @@ static bool metrics_inited(false);
 static boost::signals2::connection metrics_teleport_connection;
 static unsigned int metrics_teleport_start_count(0);
 static void metrics_teleport_started();
+static LLFastTimer::DeclareTimer FTM_MESH_FETCH("Mesh Fetch");
+
+// Enable here or in build environment to get fasttimer data on mesh fetches.
+#define LL_FASTTIMER_MESH_ENABLE		1
+#if LL_FASTTIMER_MESH_ENABLE
+#define	MESH_FASTTIMER_DEFBLOCK			LLFastTimer meshtimer(FTM_MESH_FETCH)
+#else
+#define	MESH_FASTTIMER_DEFBLOCK
+#endif // LL_FASTTIMER_MESH_ENABLE
+ 
 
 //get the number of bytes resident in memory for given volume
 U32 get_volume_memory_size(const LLVolume* volume)
@@ -2403,6 +2414,8 @@ S32 LLMeshRepository::update()
 
 S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_params, S32 detail, S32 last_lod)
 {
+	MESH_FASTTIMER_DEFBLOCK;
+	
 	// Manage time-to-load metrics for mesh download operations.
 	metricsProgress(1);
 
@@ -2484,6 +2497,7 @@ S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_para
 
 void LLMeshRepository::notifyLoadedMeshes()
 { //called from main thread
+	MESH_FASTTIMER_DEFBLOCK;
 
 	LLMeshRepoThread::sMaxConcurrentRequests = gSavedSettings.getU32("MeshMaxConcurrentRequests");
 
@@ -2791,6 +2805,8 @@ S32 LLMeshRepository::getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lo
 
 const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, const LLVOVolume* requesting_obj)
 {
+	MESH_FASTTIMER_DEFBLOCK;
+
 	if (mesh_id.notNull())
 	{
 		skin_map::iterator iter = mSkinMap.find(mesh_id);
@@ -2817,6 +2833,8 @@ const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, const
 
 void LLMeshRepository::fetchPhysicsShape(const LLUUID& mesh_id)
 {
+	MESH_FASTTIMER_DEFBLOCK;
+
 	if (mesh_id.notNull())
 	{
 		LLModel::Decomposition* decomp = NULL;
@@ -2844,6 +2862,8 @@ void LLMeshRepository::fetchPhysicsShape(const LLUUID& mesh_id)
 
 LLModel::Decomposition* LLMeshRepository::getDecomposition(const LLUUID& mesh_id)
 {
+	MESH_FASTTIMER_DEFBLOCK;
+
 	LLModel::Decomposition* ret = NULL;
 
 	if (mesh_id.notNull())
@@ -2906,6 +2926,8 @@ bool LLMeshRepository::hasPhysicsShape(const LLUUID& mesh_id)
 
 LLSD& LLMeshRepository::getMeshHeader(const LLUUID& mesh_id)
 {
+	MESH_FASTTIMER_DEFBLOCK;
+
 	return mThread->getMeshHeader(mesh_id);
 }
 
-- 
cgit v1.2.3