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

@@ -85,7 +85,7 @@ extern AIHTTPTimeoutPolicy fnPtrResponder_timeout;
// Constants
//const char* MESSAGE_LOG_FILENAME = "message.log";
static const F32 CIRCUIT_DUMP_TIMEOUT = 30.f;
static const F32Seconds CIRCUIT_DUMP_TIMEOUT(30.f);
static const S32 TRUST_TIME_WINDOW = 3;
// *NOTE: This needs to be moved into a seperate file so that it never gets
@@ -246,7 +246,7 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port,
S32 version_patch,
bool failure_is_fatal,
const F32 circuit_heartbeat_interval, const F32 circuit_timeout) :
mCircuitInfo(circuit_heartbeat_interval, circuit_timeout),
mCircuitInfo(F32Seconds(circuit_heartbeat_interval), F32Seconds(circuit_timeout)),
mLastMessageFromTrustedMessageService(false),
mPacketRing(new LLPacketRing)
{
@@ -268,7 +268,7 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port,
mSendPacketFailureCount = 0;
mCircuitPrintFreq = 60.f; // seconds
mCircuitPrintFreq = F32Seconds(60.f);
loadTemplateFile(filename, failure_is_fatal);
@@ -307,20 +307,20 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port,
mPollInfop->mPollFD.desc.s = aprSocketp;
mPollInfop->mPollFD.client_data = NULL;
F64 mt_sec = getMessageTimeSeconds();
F64Seconds mt_sec = getMessageTimeSeconds();
mResendDumpTime = mt_sec;
mMessageCountTime = mt_sec;
mCircuitPrintTime = mt_sec;
mCurrentMessageTimeSeconds = mt_sec;
mCurrentMessageTime = F64Seconds(mt_sec);
// Constants for dumping output based on message processing time/count
mNumMessageCounts = 0;
mMaxMessageCounts = 200; // >= 0 means dump warnings
mMaxMessageTime = 1.f;
mMaxMessageTime = F32Seconds(1.f);
mTrueReceiveSize = 0;
mReceiveTime = 0.f;
mReceiveTime = F32Seconds(0.f);
}
@@ -538,7 +538,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
{
// This is the first message being handled after a resetReceiveCounts,
// we must be starting the message processing loop. Reset the timers.
mCurrentMessageTimeSeconds = totalTime() * SEC_PER_USEC;
mCurrentMessageTime = totalTime();
mMessageCountTime = getMessageTimeSeconds();
}
@@ -765,7 +765,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
}
} while (!valid_packet && receive_size > 0);
F64 mt_sec = getMessageTimeSeconds();
F64Seconds mt_sec = getMessageTimeSeconds();
// Check to see if we need to print debug info
if ((mt_sec - mCircuitPrintTime) > mCircuitPrintFreq)
{
@@ -794,9 +794,9 @@ S32 LLMessageSystem::getReceiveBytes() const
}
void LLMessageSystem::processAcks()
void LLMessageSystem::processAcks(F32 collect_time)
{
F64 mt_sec = getMessageTimeSeconds();
F64Seconds mt_sec = getMessageTimeSeconds();
{
gTransferManager.updateTransfers();
@@ -820,7 +820,7 @@ void LLMessageSystem::processAcks()
mCircuitInfo.resendUnackedPackets(mUnackedListDepth, mUnackedListSize);
//cycle through ack list for each host we need to send acks to
mCircuitInfo.sendAcks();
mCircuitInfo.sendAcks(collect_time);
if (!mDenyTrustedCircuitSet.empty())
{
@@ -840,10 +840,10 @@ void LLMessageSystem::processAcks()
}
}
if (mMaxMessageTime >= 0.f)
if (mMaxMessageTime >= F32Seconds(0.f))
{
// This is one of the only places where we're required to get REAL message system time.
mReceiveTime = (F32)(getMessageTimeSeconds(TRUE) - mMessageCountTime);
mReceiveTime = getMessageTimeSeconds(TRUE) - mMessageCountTime;
if (mReceiveTime > mMaxMessageTime)
{
dump = TRUE;
@@ -1017,13 +1017,13 @@ S32 LLMessageSystem::sendReliable(const LLHost &host)
S32 LLMessageSystem::sendSemiReliable(const LLHost &host, void (*callback)(void **,S32), void ** callback_data)
{
F32 timeout;
F32Seconds timeout;
LLCircuitData *cdp = mCircuitInfo.findCircuit(host);
if (cdp)
{
timeout = llmax(LL_MINIMUM_SEMIRELIABLE_TIMEOUT_SECONDS,
LL_SEMIRELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged());
F32Seconds(LL_SEMIRELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged()));
}
else
{
@@ -1039,7 +1039,7 @@ S32 LLMessageSystem::sendSemiReliable(const LLHost &host, void (*callback)(void
S32 LLMessageSystem::sendReliable( const LLHost &host,
S32 retries,
BOOL ping_based_timeout,
F32 timeout,
F32Seconds timeout,
void (*callback)(void **,S32),
void ** callback_data)
{
@@ -1048,11 +1048,11 @@ S32 LLMessageSystem::sendReliable( const LLHost &host,
LLCircuitData *cdp = mCircuitInfo.findCircuit(host);
if (cdp)
{
timeout = llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, LL_RELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged());
timeout = llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, F32Seconds(LL_RELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged()));
}
else
{
timeout = llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, LL_RELIABLE_TIMEOUT_FACTOR * LL_AVERAGED_PING_MAX);
timeout = llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, F32Seconds(LL_RELIABLE_TIMEOUT_FACTOR * LL_AVERAGED_PING_MAX));
}
}
@@ -1084,7 +1084,7 @@ void LLMessageSystem::forwardReliable(const U32 circuit_code)
S32 LLMessageSystem::forwardReliable( const LLHost &host,
S32 retries,
BOOL ping_based_timeout,
F32 timeout,
F32Seconds timeout,
void (*callback)(void **,S32),
void ** callback_data)
{
@@ -1094,13 +1094,13 @@ S32 LLMessageSystem::forwardReliable( const LLHost &host,
S32 LLMessageSystem::flushSemiReliable(const LLHost &host, void (*callback)(void **,S32), void ** callback_data)
{
F32 timeout;
F32Seconds timeout;
LLCircuitData *cdp = mCircuitInfo.findCircuit(host);
if (cdp)
{
timeout = llmax(LL_MINIMUM_SEMIRELIABLE_TIMEOUT_SECONDS,
LL_SEMIRELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged());
F32Seconds(LL_SEMIRELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged()));
}
else
{
@@ -1344,7 +1344,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
else
{
// mCircuitInfo already points to the correct circuit data
cdp->addBytesOut( buffer_length );
cdp->addBytesOut( (S32Bytes)buffer_length );
}
if(mVerboseLog)
@@ -1471,7 +1471,7 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r
{
// update circuit packet ID tracking (missing/out of order packets)
cdp->checkPacketInID( mCurrentRecvPacketID, recv_resent );
cdp->addBytesIn( mTrueReceiveSize );
cdp->addBytesIn( (S32Bytes)mTrueReceiveSize );
}
if(mVerboseLog)
@@ -1738,7 +1738,7 @@ LLHost LLMessageSystem::findHost(const U32 circuit_code)
void LLMessageSystem::setMaxMessageTime(const F32 seconds)
{
mMaxMessageTime = seconds;
mMaxMessageTime = F32Seconds(seconds);
}
void LLMessageSystem::setMaxMessageCounts(const S32 num)
@@ -2755,7 +2755,7 @@ void LLMessageSystem::dumpReceiveCounts()
if(mNumMessageCounts > 0)
{
LL_DEBUGS("Messaging") << "Dump: " << mNumMessageCounts << " m essages processed in " << mReceiveTime << " seconds" << LL_ENDL;
LL_DEBUGS("Messaging") << "Dump: " << mNumMessageCounts << " messages processed in " << mReceiveTime << " seconds" << LL_ENDL;
for (message_template_name_map_t::const_iterator iter = mMessageTemplates.begin(),
end = mMessageTemplates.end();
iter != end; iter++)
@@ -2764,7 +2764,7 @@ void LLMessageSystem::dumpReceiveCounts()
if (mt->mReceiveCount > 0)
{
LL_INFOS("Messaging") << "Num: " << std::setw(3) << mt->mReceiveCount << " Bytes: " << std::setw(6) << mt->mReceiveBytes
<< " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << ll_round(100 * mt->mDecodeTimeThisFrame / mReceiveTime) << "%" << LL_ENDL;
<< " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << ll_round(100 * mt->mDecodeTimeThisFrame / mReceiveTime.value()) << "%" << LL_ENDL;
}
}
}
@@ -3412,15 +3412,15 @@ void LLMessageSystem::dumpPacketToLog()
//static
U64 LLMessageSystem::getMessageTimeUsecs(const BOOL update)
U64Microseconds LLMessageSystem::getMessageTimeUsecs(const BOOL update)
{
if (gMessageSystem)
{
if (update)
{
gMessageSystem->mCurrentMessageTimeSeconds = totalTime()*SEC_PER_USEC;
gMessageSystem->mCurrentMessageTime = totalTime();
}
return (U64)(gMessageSystem->mCurrentMessageTimeSeconds * USEC_PER_SEC);
return gMessageSystem->mCurrentMessageTime;
}
else
{
@@ -3429,19 +3429,19 @@ U64 LLMessageSystem::getMessageTimeUsecs(const BOOL update)
}
//static
F64 LLMessageSystem::getMessageTimeSeconds(const BOOL update)
F64Seconds LLMessageSystem::getMessageTimeSeconds(const BOOL update)
{
if (gMessageSystem)
{
if (update)
{
gMessageSystem->mCurrentMessageTimeSeconds = totalTime()*SEC_PER_USEC;
gMessageSystem->mCurrentMessageTime = totalTime();
}
return gMessageSystem->mCurrentMessageTimeSeconds;
return gMessageSystem->mCurrentMessageTime;
}
else
{
return totalTime()*SEC_PER_USEC;
return F64Seconds(totalTime());
}
}