From 46a23d417168dcd11be75825ace7ff4ff3110c03 Mon Sep 17 00:00:00 2001
From: thickbrick
Date: Sat, 13 Nov 2010 00:21:19 +0200
Subject: Partial fix #614: wrong calculation of thread run time

Use gFrameIntervalSeconds instead of gFrameTimeSeconds - which is what
the original author tried to do. Also, clean up some dead code.

*However*, there is still the issue of texture fetch workers staying
alive after finishing partial fetches, which falsly manifests here as
pending work.
---
 linden/indra/newview/llappviewer.cpp | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp
index 38985d3..8aea221 100644
--- a/linden/indra/newview/llappviewer.cpp
+++ b/linden/indra/newview/llappviewer.cpp
@@ -1085,9 +1085,7 @@ bool LLAppViewer::mainLoop()
 				}
 
 
-				const F64 min_frame_time = 0.0; //(.0333 - .0010); // max video frame rate = 30 fps
-				const F64 min_idle_time = 0.0; //(.0010); // min idle time = 1 ms
-				const F64 max_idle_time = run_multiple_threads ? min_idle_time : llmin(.005*10.0*gFrameTimeSeconds, 0.005); // 5 ms a second
+				const F64 max_idle_time = run_multiple_threads ? 0.0 : llmin(.005*10.0*gFrameIntervalSeconds, 0.005); // 50ms/second, no more than 5ms/frame
 				idleTimer.reset();
 				while(1)
 				{
@@ -1103,11 +1101,8 @@ bool LLAppViewer::mainLoop()
 						ms_sleep(llmin(io_pending/100,100)); // give the vfs some time to catch up
 					}
 
-					F64 frame_time = frameTimer.getElapsedTimeF64();
 					F64 idle_time = idleTimer.getElapsedTimeF64();
-					if (frame_time >= min_frame_time &&
-						idle_time >= min_idle_time &&
-						(!work_pending || idle_time >= max_idle_time))
+					if (!work_pending || idle_time >= max_idle_time)
 					{
 						break;
 					}
-- 
cgit v1.1