Split out HTTP texture bandwidth

This commit is contained in:
Siana Gearz
2013-02-03 22:18:34 +01:00
parent 6a774e4685
commit 2b036c7334
4 changed files with 22 additions and 13 deletions

View File

@@ -192,7 +192,7 @@
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>32</integer>
<integer>12</integer>
</map>
<key>HTTPMinRequests</key>
<map>
@@ -205,6 +205,17 @@
<key>Value</key>
<integer>2</integer>
</map>
<key>HTTPThrottleBandwidth</key>
<map>
<key>Comment</key>
<string>The bandwidth (in kbit/s) to strive for</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>3000</real>
</map>
<key>TeleportHistoryMaxEntries</key>
<map>

View File

@@ -490,6 +490,7 @@ public:
SGHostBlackList::blacklist_t SGHostBlackList::blacklist;
#if 0
//call every time a connection is opened
//return true if connecting allowed
static bool sgConnectionThrottle() {
@@ -511,6 +512,7 @@ static bool sgConnectionThrottle() {
return false;
}
}
#endif
#if HTTP_METRICS
// Cross-thread messaging for asset metrics.
@@ -1286,12 +1288,12 @@ bool LLTextureFetchWorker::doWork(S32 param)
//1, not opening too many file descriptors at the same time;
//2, control the traffic of http so udp gets bandwidth.
//
static const LLCachedControl<U32> max_http_requests("HTTPMaxRequests", 32);
static const LLCachedControl<U32> max_http_requests("HTTPMaxRequests", 8);
static const LLCachedControl<U32> min_http_requests("HTTPMinRequests", 2);
if(((U32)mFetcher->getNumHTTPRequests() > max_http_requests) ||
((mFetcher->getTextureBandwidth() > mFetcher->mMaxBandwidth) &&
((U32)mFetcher->getNumHTTPRequests() > min_http_requests)) ||
!sgConnectionThrottle())
static const LLCachedControl<F32> throttle_bandwidth("HTTPThrottleBandwidth", 2000);
if(((U32)mFetcher->getNumHTTPRequests() >= max_http_requests) ||
((mFetcher->getTextureBandwidth() > throttle_bandwidth) &&
((U32)mFetcher->getNumHTTPRequests() > min_http_requests)))
{
return false ; //wait.
}
@@ -1329,9 +1331,10 @@ bool LLTextureFetchWorker::doWork(S32 param)
mLoaded = FALSE;
mGetStatus = 0;
mGetReason.clear();
static const LLCachedControl<F32> throttle_bandwidth("HTTPThrottleBandwidth", 2000);
LL_DEBUGS("Texture") << "HTTP GET: " << mID << " Offset: " << mRequestedOffset
<< " Bytes: " << mRequestedSize
<< " Bandwidth(kbps): " << mFetcher->getTextureBandwidth() << "/" << mFetcher->mMaxBandwidth
<< " Bandwidth(kbps): " << mFetcher->getTextureBandwidth() << "/" << throttle_bandwidth
<< LL_ENDL;
setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority);
mState = WAIT_HTTP_REQ;
@@ -2062,7 +2065,6 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image
#if HTTP_METRICS
mCurlPOSTRequestCount = 0;
#endif
mMaxBandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS");
mTextureInfo.setUpLogging(gSavedSettings.getBOOL("LogTextureDownloadsToViewerLog"), gSavedSettings.getBOOL("LogTextureDownloadsToSimulator"), gSavedSettings.getU32("TextureLoggingThreshold"));
}
@@ -2446,11 +2448,8 @@ void LLTextureFetch::commonUpdate()
//virtual
S32 LLTextureFetch::update(F32 max_time_ms)
{
static LLCachedControl<F32> band_width(gSavedSettings,"ThrottleBandwidthKBPS");
{
mNetworkQueueMutex.lock() ;
mMaxBandwidth = band_width ;
gTextureList.sTextureBits += mHTTPTextureBits ;
mHTTPTextureBits = 0 ;

View File

@@ -186,7 +186,6 @@ private:
typedef std::map<LLHost,std::set<LLUUID> > cancel_queue_t;
cancel_queue_t mCancelQueue;
F32 mTextureBandwidth;
F32 mMaxBandwidth;
LLTextureInfo mTextureInfo;
U32 mHTTPTextureBits;

View File

@@ -610,7 +610,7 @@ void LLGLTexMemBar::draw()
left += LLFontGL::getFontMonospace()->getWidth(text);
F32 bandwidth = LLAppViewer::getTextureFetch()->getTextureBandwidth();
F32 max_bandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS");
F32 max_bandwidth = gSavedSettings.getF32("HTTPThrottleBandwidth");
color = bandwidth > max_bandwidth ? LLColor4::red : bandwidth > max_bandwidth*.75f ? LLColor4::yellow : text_color;
color[VALPHA] = text_color[VALPHA];
text = llformat("BW:%.0f/%.0f",bandwidth, max_bandwidth);