llmessage merge and further LLUnit usage.

This commit is contained in:
Shyotl
2016-04-07 20:17:30 -05:00
parent 8c946dc706
commit 691a5395ca
43 changed files with 514 additions and 465 deletions

View File

@@ -44,17 +44,17 @@ LLTextureInfo::LLTextureInfo() :
mTextureDownloadsStarted(0),
mTextureDownloadsCompleted(0),
mTextureDownloadProtocol("NONE"),
mTextureLogThreshold(100 * 1024),
mTextureLogThreshold(LLUnits::Kilobytes::fromValue(100)),
mCurrentStatsBundleStartTime(0)
{
mTextures.clear();
}
void LLTextureInfo::setUpLogging(bool writeToViewerLog, bool sendToSim, U32 textureLogThreshold)
void LLTextureInfo::setUpLogging(bool writeToViewerLog, bool sendToSim, U32Bytes textureLogThreshold)
{
mLogTextureDownloadsToViewerLog = writeToViewerLog;
mLogTextureDownloadsToSimulator = sendToSim;
mTextureLogThreshold = textureLogThreshold;
mTextureLogThreshold = U32Bytes(textureLogThreshold);
}
LLTextureInfo::~LLTextureInfo()
@@ -82,15 +82,7 @@ U32 LLTextureInfo::getTextureInfoMapSize()
bool LLTextureInfo::has(const LLUUID& id)
{
std::map<LLUUID, LLTextureInfoDetails *>::iterator iterator = mTextures.find(id);
if (iterator == mTextures.end())
{
return false;
}
else
{
return true;
}
return mTextures.end() != mTextures.find(id);
}
void LLTextureInfo::setRequestStartTime(const LLUUID& id, U64 startTime)
@@ -99,7 +91,7 @@ void LLTextureInfo::setRequestStartTime(const LLUUID& id, U64 startTime)
{
addRequest(id);
}
mTextures[id]->mStartTime = startTime;
mTextures[id]->mStartTime = (U64Microseconds)startTime;
mTextureDownloadsStarted++;
}
@@ -109,7 +101,7 @@ void LLTextureInfo::setRequestSize(const LLUUID& id, U32 size)
{
addRequest(id);
}
mTextures[id]->mSize = size;
mTextures[id]->mSize = (U32Bytes)size;
}
void LLTextureInfo::setRequestOffset(const LLUUID& id, U32 offset)
@@ -130,16 +122,19 @@ void LLTextureInfo::setRequestType(const LLUUID& id, LLTextureInfoDetails::LLReq
mTextures[id]->mType = type;
}
void LLTextureInfo::setRequestCompleteTimeAndLog(const LLUUID& id, U64 completeTime)
void LLTextureInfo::setRequestCompleteTimeAndLog(const LLUUID& id, U64Microseconds completeTime)
{
if (!has(id))
{
addRequest(id);
}
mTextures[id]->mCompleteTime = completeTime;
LLTextureInfoDetails& details = *mTextures[id];
details.mCompleteTime = completeTime;
std::string protocol = "NONE";
switch(mTextures[id]->mType)
switch(details.mType)
{
case LLTextureInfoDetails::REQUEST_TYPE_HTTP:
protocol = "HTTP";
@@ -156,21 +151,21 @@ void LLTextureInfo::setRequestCompleteTimeAndLog(const LLUUID& id, U64 completeT
if (mLogTextureDownloadsToViewerLog)
{
LL_INFOS() << "texture=" << id
<< " start=" << mTextures[id]->mStartTime
<< " end=" << mTextures[id]->mCompleteTime
<< " size=" << mTextures[id]->mSize
<< " offset=" << mTextures[id]->mOffset
<< " length_in_ms=" << (mTextures[id]->mCompleteTime - mTextures[id]->mStartTime) / 1000
<< " protocol=" << protocol
<< LL_ENDL;
LL_INFOS() << "texture=" << id
<< " start=" << details.mStartTime
<< " end=" << details.mCompleteTime
<< " size=" << details.mSize
<< " offset=" << details.mOffset
<< " length=" << U32Milliseconds(details.mCompleteTime - details.mStartTime)
<< " protocol=" << protocol
<< LL_ENDL;
}
if(mLogTextureDownloadsToSimulator)
{
S32 texture_stats_upload_threshold = mTextureLogThreshold;
mTotalBytes += mTextures[id]->mSize;
mTotalMilliseconds += mTextures[id]->mCompleteTime - mTextures[id]->mStartTime;
U32Bytes texture_stats_upload_threshold = mTextureLogThreshold;
mTotalBytes += details.mSize;
mTotalMilliseconds += details.mCompleteTime - details.mStartTime;
mTextureDownloadsCompleted++;
mTextureDownloadProtocol = protocol;
if (mTotalBytes >= texture_stats_upload_threshold)
@@ -194,18 +189,15 @@ void LLTextureInfo::setRequestCompleteTimeAndLog(const LLUUID& id, U64 completeT
LLSD LLTextureInfo::getAverages()
{
LLSD averagedTextureData;
S32 averageDownloadRate;
if(mTotalMilliseconds == 0)
S32 averageDownloadRate = 0;
unsigned int download_time = mTotalMilliseconds.valueInUnits<LLUnits::Seconds>();
if (0 != download_time)
{
averageDownloadRate = 0;
}
else
{
averageDownloadRate = (mTotalBytes * 8) / mTotalMilliseconds;
averageDownloadRate = mTotalBytes.valueInUnits<LLUnits::Bits>() / download_time;
}
averagedTextureData["bits_per_second"] = averageDownloadRate;
averagedTextureData["bytes_downloaded"] = mTotalBytes;
averagedTextureData["bytes_downloaded"] = (LLSD::Integer)mTotalBytes.valueInUnits<LLUnits::Bits>();
averagedTextureData["texture_downloads_started"] = mTextureDownloadsStarted;
averagedTextureData["texture_downloads_completed"] = mTextureDownloadsCompleted;
averagedTextureData["transport"] = mTextureDownloadProtocol;
@@ -215,19 +207,19 @@ LLSD LLTextureInfo::getAverages()
void LLTextureInfo::resetTextureStatistics()
{
mTotalMilliseconds = 0;
mTotalBytes = 0;
mTotalMilliseconds = U32Milliseconds(0);
mTotalBytes = U32Bytes(0);
mTextureDownloadsStarted = 0;
mTextureDownloadsCompleted = 0;
mTextureDownloadProtocol = "NONE";
mCurrentStatsBundleStartTime = LLTimer::getTotalTime();
}
U32 LLTextureInfo::getRequestStartTime(const LLUUID& id)
U32Microseconds LLTextureInfo::getRequestStartTime(const LLUUID& id)
{
if (!has(id))
{
return 0;
return U32Microseconds(0);
}
else
{
@@ -236,11 +228,11 @@ U32 LLTextureInfo::getRequestStartTime(const LLUUID& id)
}
}
U32 LLTextureInfo::getRequestSize(const LLUUID& id)
U32Bytes LLTextureInfo::getRequestSize(const LLUUID& id)
{
if (!has(id))
{
return 0;
return U32Bytes(0);
}
else
{
@@ -275,11 +267,11 @@ LLTextureInfoDetails::LLRequestType LLTextureInfo::getRequestType(const LLUUID&
}
}
U32 LLTextureInfo::getRequestCompleteTime(const LLUUID& id)
U32Microseconds LLTextureInfo::getRequestCompleteTime(const LLUUID& id)
{
if (!has(id))
{
return 0;
return U32Microseconds(0);
}
else
{