From 70a872c4a2d27c8f3e85f30c3741db8d36061b9b Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Tue, 9 Aug 2011 16:00:56 -0700
Subject: [PATCH] EXP-700 WIP SLPlugin(s) takes high CPU% clamp maximum
 framerate of slplugin to 100Hz also added assert to catch cases where we're
 requesting infinite framerate

---
 indra/llplugin/llpluginprocesschild.cpp  | 2 +-
 indra/llplugin/llpluginprocessparent.cpp | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/indra/llplugin/llpluginprocesschild.cpp b/indra/llplugin/llpluginprocesschild.cpp
index 0beb46d0e55..f8a282184ed 100644
--- a/indra/llplugin/llpluginprocesschild.cpp
+++ b/indra/llplugin/llpluginprocesschild.cpp
@@ -410,7 +410,7 @@ void LLPluginProcessChild::receiveMessageRaw(const std::string &message)
 			}
 			else if(message_name == "sleep_time")
 			{
-				mSleepTime = parsed.getValueReal("time");
+				mSleepTime = llmax(parsed.getValueReal("time"), 1.0 / 100.0); // clamp to maximum of 100Hz
 			}
 			else if(message_name == "crash")
 			{
diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp
index 315096d4fd7..110fac0f238 100644
--- a/indra/llplugin/llpluginprocessparent.cpp
+++ b/indra/llplugin/llpluginprocessparent.cpp
@@ -927,6 +927,7 @@ void LLPluginProcessParent::receiveMessage(const LLPluginMessage &message)
 				}
 				
 				// Send initial sleep time
+				llassert_always(mSleepTime != 0.f);
 				setSleepTime(mSleepTime, true);			
 
 				setState(STATE_RUNNING);
-- 
GitLab