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> <key>Type</key>
<string>U32</string> <string>U32</string>
<key>Value</key> <key>Value</key>
<integer>32</integer> <integer>12</integer>
</map> </map>
<key>HTTPMinRequests</key> <key>HTTPMinRequests</key>
<map> <map>
@@ -205,6 +205,17 @@
<key>Value</key> <key>Value</key>
<integer>2</integer> <integer>2</integer>
</map> </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> <key>TeleportHistoryMaxEntries</key>
<map> <map>

View File

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

View File

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

View File

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