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

@@ -51,7 +51,7 @@ public:
// Atomic reads of static variables.
// Return the number of seconds since the start of the application.
static F64 getElapsedSeconds(void)
static F64SecondsImplicit getElapsedSeconds(void)
{
// Loses msec precision after ~4.5 hours...
sGlobalMutex.lock();

View File

@@ -1083,7 +1083,7 @@ void LLParcel::startSale(const LLUUID& buyer_id, BOOL is_buyer_group)
mGroupID.setNull();
}
mSaleTimerExpires.start();
mSaleTimerExpires.setTimerExpirySec(DEFAULT_USEC_SALE_TIMEOUT / SEC_TO_MICROSEC);
mSaleTimerExpires.setTimerExpirySec(U64Microseconds(DEFAULT_USEC_SALE_TIMEOUT));
mStatus = OS_LEASE_PENDING;
mClaimDate = time(NULL);
setAuctionID(0);

View File

@@ -162,12 +162,26 @@ void LLAres::getSrvRecords(const std::string &name, SrvResponder *resp)
}
void LLAres::rewriteURI(const std::string &uri, UriRewriteResponder *resp)
{
LL_INFOS() << "Rewriting " << uri << LL_ENDL;
{
if (resp && uri.size())
{
LLURI* pURI = new LLURI(uri);
resp->mUri = LLURI(uri);
search("_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName(),
RES_SRV, resp);
resp->mUri = *pURI;
delete pURI;
if (!resp->mUri.scheme().size() || !resp->mUri.hostName().size())
{
return;
}
//LL_INFOS() << "LLAres::rewriteURI (" << uri << ") search: '" << "_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName() << "'" << LL_ENDL;
search("_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName(), RES_SRV, resp);
}
}
LLQueryResponder::LLQueryResponder()

View File

@@ -93,5 +93,12 @@ private:
void LLAresListener::rewriteURI(const LLSD& data)
{
mAres->rewriteURI(data["uri"], new UriRewriteResponder(data));
if (mAres)
{
mAres->rewriteURI(data["uri"], new UriRewriteResponder(data));
}
else
{
LL_INFOS() << "LLAresListener::rewriteURI requested without Ares present. Ignoring: " << data << LL_ENDL;
}
}

View File

@@ -190,8 +190,8 @@ LLSD LLAssetRequest::getTerseDetails() const
sd["asset_id"] = getUUID();
sd["type_long"] = LLAssetType::lookupHumanReadable(getType());
sd["type"] = LLAssetType::lookup(getType());
sd["time"] = mTime;
time_t timestamp = (time_t) mTime;
sd["time"] = mTime.value();
time_t timestamp = (time_t) mTime.value();
std::ostringstream time_string;
time_string << ctime(&timestamp);
sd["time_string"] = time_string.str();
@@ -337,7 +337,7 @@ void LLAssetStorage::checkForTimeouts()
void LLAssetStorage::_cleanupRequests(BOOL all, S32 error)
{
F64 mt_secs = LLMessageSystem::getMessageTimeSeconds();
F64Seconds mt_secs = LLMessageSystem::getMessageTimeSeconds();
request_list_t timed_out;
S32 rt;
@@ -638,6 +638,10 @@ void LLAssetStorage::downloadCompleteCallback(
vfile.remove();
}
}
// we will be deleting elements of mPendingDownloads which req might be part of, save id and type for reference
LLUUID callback_id = req->getUUID();
LLAssetType::EType callback_type = req->getType();
// find and callback ALL pending requests for this UUID
// SJB: We process the callbacks in reverse order, I do not know if this is important,
@@ -661,7 +665,7 @@ void LLAssetStorage::downloadCompleteCallback(
LLAssetRequest* tmp = *curiter;
if (tmp->mDownCallback)
{
tmp->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getType(), tmp->mUserData, result, ext_status);
tmp->mDownCallback(gAssetStorage->mVFS, callback_id, callback_type, tmp->mUserData, result, ext_status);
}
delete tmp;
}
@@ -1390,7 +1394,7 @@ void LLAssetStorage::storeAssetData(
bool is_priority,
bool store_local,
bool user_waiting,
F64 timeout)
F64Seconds timeout)
{
LL_WARNS() << "storeAssetData: wrong version called" << LL_ENDL;
// LLAssetStorage metric: Virtual base call
@@ -1409,7 +1413,7 @@ void LLAssetStorage::storeAssetData(
bool store_local,
const LLUUID& requesting_agent_id,
bool user_waiting,
F64 timeout)
F64Seconds timeout)
{
LL_WARNS() << "storeAssetData: wrong version called" << LL_ENDL;
// LLAssetStorage metric: Virtual base call
@@ -1427,7 +1431,7 @@ void LLAssetStorage::storeAssetData(
bool temp_file,
bool is_priority,
bool user_waiting,
F64 timeout)
F64Seconds timeout)
{
LL_WARNS() << "storeAssetData: wrong version called" << LL_ENDL;
// LLAssetStorage metric: Virtual base call
@@ -1445,7 +1449,7 @@ void LLAssetStorage::storeAssetData(
bool temp_file,
bool is_priority,
bool user_waiting,
F64 timeout)
F64Seconds timeout)
{
LL_WARNS() << "storeAssetData: wrong version called" << LL_ENDL;
// LLAssetStorage metric: Virtual base call

View File

@@ -49,7 +49,8 @@ class LLSD;
// anything that takes longer than this to download will abort.
// HTTP Uploads also timeout if they take longer than this.
const F32 LL_ASSET_STORAGE_TIMEOUT = 5 * 60.0f;
const F32Minutes LL_ASSET_STORAGE_TIMEOUT(5);
// Specific error codes
const int LL_ERR_ASSET_REQUEST_FAILED = -1;
@@ -102,7 +103,7 @@ public:
void setUUID(const LLUUID& id) { mUUID = id; }
void setType(LLAssetType::EType type) { mType = type; }
void setTimeout (F64 timeout) { mTimeout = timeout; }
void setTimeout (F64Seconds timeout) { mTimeout = timeout; }
protected:
LLUUID mUUID;
@@ -118,8 +119,8 @@ public:
BOOL mIsTemp;
BOOL mIsLocal;
BOOL mIsUserWaiting; // We don't want to try forever if a user is waiting for a result.
F64 mTime; // Message system time
F64 mTimeout; // Amount of time before timing out.
F64Seconds mTime; // Message system time
F64Seconds mTimeout; // Amount of time before timing out.
BOOL mIsPriority;
BOOL mDataSentInFirstPacket;
BOOL mDataIsInVFS;
@@ -162,7 +163,7 @@ public:
void *mUserData;
LLHost mHost;
BOOL mIsTemp;
F64 mTime; // Message system time
F64Seconds mTime; // Message system time
BOOL mIsPriority;
BOOL mDataSentInFirstPacket;
BOOL mDataIsInVFS;
@@ -192,7 +193,7 @@ public:
void *mUserData;
LLHost mHost;
BOOL mIsTemp;
F64 mTime; // Message system time
F64Seconds mTime; // Message system time
BOOL mIsPriority;
BOOL mDataSentInFirstPacket;
BOOL mDataIsInVFS;
@@ -284,7 +285,7 @@ public:
bool is_priority = false,
bool store_local = false,
bool user_waiting= false,
F64 timeout=LL_ASSET_STORAGE_TIMEOUT);
F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT);
/*
* AssetID version
@@ -300,7 +301,7 @@ public:
bool store_local = false,
const LLUUID& requesting_agent_id = LLUUID::null,
bool user_waiting= false,
F64 timeout=LL_ASSET_STORAGE_TIMEOUT);
F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT);
virtual void checkForTimeouts();
@@ -408,7 +409,7 @@ public:
bool temp_file = false,
bool is_priority = false,
bool user_waiting = false,
F64 timeout = LL_ASSET_STORAGE_TIMEOUT);
F64Seconds timeout = LL_ASSET_STORAGE_TIMEOUT);
/*
* TransactionID version
@@ -422,7 +423,7 @@ public:
bool temp_file = false,
bool is_priority = false,
bool user_waiting = false,
F64 timeout = LL_ASSET_STORAGE_TIMEOUT);
F64Seconds timeout = LL_ASSET_STORAGE_TIMEOUT);
static void legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType, void *user_data, S32 status, LLExtStat ext_status);
static void legacyStoreDataCallback(const LLUUID &uuid, void *user_data, S32 status, LLExtStat ext_status);

View File

@@ -365,9 +365,7 @@ void LLAvatarNameCache::requestNamesViaCapability()
if (!url.empty())
{
LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::requestNamesViaCapability requested "
<< ids << " ids"
<< LL_ENDL;
LL_INFOS("AvNameCache") << "LLAvatarNameCache::requestNamesViaCapability getting " << ids << " ids" << LL_ENDL;
LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids));
}
}
@@ -391,8 +389,7 @@ void LLAvatarNameCache::legacyNameFetch(const LLUUID& agent_id,
const std::string& full_name,
bool is_group)
{
LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::legacyNameFetch "
<< "agent " << agent_id << " "
LL_DEBUGS("AvNameCache") << "LLAvatarNameCache agent " << agent_id << " "
<< "full name '" << full_name << "'"
<< ( is_group ? " [group]" : "" )
<< LL_ENDL;
@@ -439,12 +436,13 @@ void LLAvatarNameCache::cleanupClass()
sCache.clear();
}
void LLAvatarNameCache::importFile(std::istream& istr)
bool LLAvatarNameCache::importFile(std::istream& istr)
{
LLSD data;
if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(data, istr))
{
return;
LL_WARNS("AvNameCache") << "avatar name cache data xml parse failed" << LL_ENDL;
return false;
}
// by convention LLSD storage is a map
@@ -460,17 +458,19 @@ void LLAvatarNameCache::importFile(std::istream& istr)
av_name.fromLLSD( it->second );
sCache[agent_id] = av_name;
}
LL_INFOS("AvNameCache") << "loaded " << sCache.size() << LL_ENDL;
LL_INFOS("AvNameCache") << "LLAvatarNameCache loaded " << sCache.size() << LL_ENDL;
// Some entries may have expired since the cache was stored,
// but they will be flushed in the first call to eraseUnrefreshed
// from LLAvatarNameResponder::idle
return true;
}
void LLAvatarNameCache::exportFile(std::ostream& ostr)
{
LLSD agents;
F64 max_unrefreshed = LLFrameTimer::getTotalSeconds() - MAX_UNREFRESHED_TIME;
LL_INFOS("AvNameCache") << "LLAvatarNameCache at exit cache has " << sCache.size() << LL_ENDL;
cache_t::const_iterator it = sCache.begin();
for ( ; it != sCache.end(); ++it)
{
@@ -483,6 +483,7 @@ void LLAvatarNameCache::exportFile(std::ostream& ostr)
agents[agent_id.asString()] = av_name.asLLSD();
}
}
LL_INFOS("AvNameCache") << "LLAvatarNameCache returning " << agents.size() << LL_ENDL;
LLSD data;
data["agents"] = agents;
LLSDSerialize::toPrettyXML(data, ostr);
@@ -525,6 +526,7 @@ void LLAvatarNameCache::idle()
}
else
{
LL_WARNS_ONCE("AvNameCache") << "LLAvatarNameCache still using legacy api" << LL_ENDL;
requestNamesViaLegacy();
}
}
@@ -562,24 +564,26 @@ void LLAvatarNameCache::eraseUnrefreshed()
if (!sLastExpireCheck || sLastExpireCheck < max_unrefreshed)
{
sLastExpireCheck = now;
S32 expired = 0;
for (cache_t::iterator it = sCache.begin(); it != sCache.end();)
{
const LLAvatarName& av_name = it->second;
if (av_name.mExpires < max_unrefreshed)
{
LL_DEBUGS("AvNameCache") << it->first
LL_DEBUGS("AvNameCacheExpired") << "LLAvatarNameCache " << it->first
<< " user '" << av_name.getAccountName() << "' "
<< "expired " << now - av_name.mExpires << " secs ago"
<< LL_ENDL;
sCache.erase(it++);
expired++;
}
else
{
++it;
}
}
LL_INFOS("AvNameCache") << sCache.size() << " cached avatar names" << LL_ENDL;
LL_INFOS("AvNameCache") << "LLAvatarNameCache expired " << expired << " cached avatar names, "
<< sCache.size() << " remaining" << LL_ENDL;
}
}
@@ -600,8 +604,7 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name)
{
if (!isRequestPending(agent_id))
{
LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::get "
<< "refresh agent " << agent_id
LL_DEBUGS("AvNameCache") << "LLAvatarNameCache refresh agent " << agent_id
<< LL_ENDL;
sAskQueue.insert(agent_id);
}
@@ -623,9 +626,7 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name)
if (!isRequestPending(agent_id))
{
LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::get "
<< "queue request for agent " << agent_id
<< LL_ENDL;
LL_DEBUGS("AvNameCache") << "LLAvatarNameCache queue request for agent " << agent_id << LL_ENDL;
sAskQueue.insert(agent_id);
}
@@ -784,7 +785,7 @@ bool LLAvatarNameCache::expirationFromCacheControl(AIHTTPReceivedHeaders const&
fromCacheControl = true;
}
}
LL_DEBUGS("AvNameCache")
LL_DEBUGS("AvNameCache") << "LLAvatarNameCache "
<< ( fromCacheControl ? "expires based on cache control " : "default expiration " )
<< "in " << *expires - now << " seconds"
<< LL_ENDL;

View File

@@ -46,7 +46,7 @@ namespace LLAvatarNameCache
void cleanupClass();
// Import/export the name cache to file.
void importFile(std::istream& istr);
bool importFile(std::istream& istr);
void exportFile(std::ostream& ostr);
// On the viewer, usually a simulator capabilitity.

View File

@@ -306,7 +306,7 @@ public:
typedef std::list<LLSegment> segment_list_t;
typedef segment_list_t::const_iterator const_segment_iterator_t;
typedef segment_list_t::iterator segment_iterator_t;
static size_t const npos = (size_t)-1; // (U8*)npos is used as a magic address.
enum { npos = 0xffffffff };
LLBufferArray();
~LLBufferArray();

View File

@@ -61,12 +61,12 @@
const S32 PING_START_BLOCK = 3; // How many pings behind we have to be to consider ourself blocked.
const S32 PING_RELEASE_BLOCK = 2; // How many pings behind we have to be to consider ourself unblocked.
const F32 TARGET_PERIOD_LENGTH = 5.f; // seconds
const F32 LL_DUPLICATE_SUPPRESSION_TIMEOUT = 60.f; //seconds - this can be long, as time-based cleanup is
const F32Seconds TARGET_PERIOD_LENGTH(5.f);
const F32Seconds LL_DUPLICATE_SUPPRESSION_TIMEOUT(60.f); //this can be long, as time-based cleanup is
// only done when wrapping packetids, now...
LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id,
const F32 circuit_heartbeat_interval, const F32 circuit_timeout)
const F32Seconds circuit_heartbeat_interval, const F32Seconds circuit_timeout)
: mHost (host),
mWrapID(0),
mPacketsOutID(0),
@@ -85,7 +85,7 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id,
mPingsInTransit(0),
mLastPingID(0),
mPingDelay(INITIAL_PING_VALUE_MSEC),
mPingDelayAveraged((F32)INITIAL_PING_VALUE_MSEC),
mPingDelayAveraged(INITIAL_PING_VALUE_MSEC),
mUnackedPacketCount(0),
mUnackedPacketBytes(0),
mLastPacketInTime(0.0),
@@ -104,6 +104,7 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id,
mPeakBPSOut(0.f),
mPeriodTime(0.0),
mExistenceTimer(),
mAckCreationTime(0.f),
mCurrentResendCount(0),
mLastPacketGap(0),
mHeartbeatInterval(circuit_heartbeat_interval),
@@ -111,13 +112,13 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id,
{
// Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been
// running a message system loop.
F64 mt_sec = LLMessageSystem::getMessageTimeSeconds(TRUE);
F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds(TRUE);
F32 distribution_offset = ll_frand();
mPingTime = mt_sec;
mLastPingSendTime = mt_sec + mHeartbeatInterval * distribution_offset;
mLastPingReceivedTime = mt_sec;
mNextPingSendTime = mLastPingSendTime + 0.95*mHeartbeatInterval + ll_frand(0.1f*mHeartbeatInterval);
mNextPingSendTime = mLastPingSendTime + 0.95*mHeartbeatInterval + F32Seconds(ll_frand(0.1f*mHeartbeatInterval.value()));
mPeriodTime = mt_sec;
mLocalEndPointID.generate();
@@ -208,7 +209,7 @@ void LLCircuitData::ackReliablePacket(TPACKETID packet_num)
}
if (packetp->mCallback)
{
if (packetp->mTimeout < 0.f) // negative timeout will always return timeout even for successful ack, for debugging
if (packetp->mTimeout < F32Seconds(0.f)) // negative timeout will always return timeout even for successful ack, for debugging
{
packetp->mCallback(packetp->mCallbackData,LL_ERR_TCP_TIMEOUT);
}
@@ -242,7 +243,7 @@ void LLCircuitData::ackReliablePacket(TPACKETID packet_num)
}
if (packetp->mCallback)
{
if (packetp->mTimeout < 0.f) // negative timeout will always return timeout even for successful ack, for debugging
if (packetp->mTimeout < F32Seconds(0.f)) // negative timeout will always return timeout even for successful ack, for debugging
{
packetp->mCallback(packetp->mCallbackData,LL_ERR_TCP_TIMEOUT);
}
@@ -269,7 +270,7 @@ void LLCircuitData::ackReliablePacket(TPACKETID packet_num)
S32 LLCircuitData::resendUnackedPackets(const F64 now)
S32 LLCircuitData::resendUnackedPackets(const F64Seconds now)
{
S32 resent_packets = 0;
LLReliablePacket *packetp;
@@ -356,7 +357,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now)
// The new method, retry time based on ping
if (packetp->mPingBasedRetry)
{
packetp->mExpirationTime = now + llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, (LL_RELIABLE_TIMEOUT_FACTOR * getPingDelayAveraged()));
packetp->mExpirationTime = now + llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, F32Seconds(LL_RELIABLE_TIMEOUT_FACTOR * getPingDelayAveraged()));
}
else
{
@@ -428,10 +429,11 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now)
}
LLCircuit::LLCircuit(const F32 circuit_heartbeat_interval, const F32 circuit_timeout) : mLastCircuit(NULL),
mHeartbeatInterval(circuit_heartbeat_interval), mHeartbeatTimeout(circuit_timeout)
{
}
LLCircuit::LLCircuit(const F32Seconds circuit_heartbeat_interval, const F32Seconds circuit_timeout)
: mLastCircuit(NULL),
mHeartbeatInterval(circuit_heartbeat_interval),
mHeartbeatTimeout(circuit_timeout)
{}
LLCircuit::~LLCircuit()
{
@@ -522,17 +524,17 @@ void LLCircuitData::setAllowTimeout(BOOL allow)
// Reset per-period counters if necessary.
void LLCircuitData::checkPeriodTime()
{
F64 mt_sec = LLMessageSystem::getMessageTimeSeconds();
F64 period_length = mt_sec - mPeriodTime;
F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds();
F64Seconds period_length = mt_sec - mPeriodTime;
if ( period_length > TARGET_PERIOD_LENGTH)
{
F32 bps_in = (F32)(mBytesInThisPeriod * 8.f / period_length);
F32 bps_in = F32Bits(mBytesInThisPeriod).value() / period_length.value();
if (bps_in > mPeakBPSIn)
{
mPeakBPSIn = bps_in;
}
F32 bps_out = (F32)(mBytesOutThisPeriod * 8.f / period_length);
F32 bps_out = F32Bits(mBytesOutThisPeriod).value() / period_length.value();
if (bps_out > mPeakBPSOut)
{
mPeakBPSOut = bps_out;
@@ -540,23 +542,23 @@ void LLCircuitData::checkPeriodTime()
mBytesInLastPeriod = mBytesInThisPeriod;
mBytesOutLastPeriod = mBytesOutThisPeriod;
mBytesInThisPeriod = 0;
mBytesOutThisPeriod = 0;
mLastPeriodLength = (F32)period_length;
mBytesInThisPeriod = S32Bytes(0);
mBytesOutThisPeriod = S32Bytes(0);
mLastPeriodLength = period_length;
mPeriodTime = mt_sec;
}
}
void LLCircuitData::addBytesIn(S32 bytes)
void LLCircuitData::addBytesIn(S32Bytes bytes)
{
mBytesIn += bytes;
mBytesInThisPeriod += bytes;
}
void LLCircuitData::addBytesOut(S32 bytes)
void LLCircuitData::addBytesOut(S32Bytes bytes)
{
mBytesOut += bytes;
mBytesOutThisPeriod += bytes;
@@ -585,7 +587,7 @@ void LLCircuitData::addReliablePacket(S32 mSocket, U8 *buf_ptr, S32 buf_len, LLR
void LLCircuit::resendUnackedPackets(S32& unacked_list_length, S32& unacked_list_size)
{
F64 now = LLMessageSystem::getMessageTimeSeconds();
F64Seconds now = LLMessageSystem::getMessageTimeSeconds();
unacked_list_length = 0;
unacked_list_size = 0;
@@ -727,7 +729,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
}
else if (!receive_resent) // don't freak out over out-of-order reliable resends
{
U64 time = LLMessageSystem::getMessageTimeUsecs();
U64Microseconds time = LLMessageSystem::getMessageTimeUsecs();
TPACKETID index = mPacketsInID;
S32 gap_count = 0;
if ((index < id) && ((id - index) < 16))
@@ -781,7 +783,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys)
{
F64 cur_time = LLMessageSystem::getMessageTimeSeconds();
F64Seconds cur_time = LLMessageSystem::getMessageTimeSeconds();
S32 count = mPingSet.size();
S32 cur = 0;
@@ -819,7 +821,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys)
if (cdp->updateWatchDogTimers(msgsys))
{
// Randomize our pings a bit by doing some up to 5% early or late
F64 dt = 0.95f*mHeartbeatInterval + ll_frand(0.1f*mHeartbeatInterval);
F64Seconds dt = 0.95f*mHeartbeatInterval + F32Seconds(ll_frand(0.1f*mHeartbeatInterval.value()));
// Remove it, and reinsert it with the new next ping time.
// Always remove before changing the sorting key.
@@ -847,7 +849,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys)
BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys)
{
F64 cur_time = LLMessageSystem::getMessageTimeSeconds();
F64Seconds cur_time = LLMessageSystem::getMessageTimeSeconds();
mLastPingSendTime = cur_time;
if (!checkCircuitTimeout())
@@ -964,12 +966,12 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys)
// be considered lost
LLCircuitData::packet_time_map::iterator it;
U64 timeout = (U64)(1000000.0*llmin(LL_MAX_LOST_TIMEOUT, getPingDelayAveraged() * LL_LOST_TIMEOUT_FACTOR));
U64Microseconds timeout = llmin(LL_MAX_LOST_TIMEOUT, F32Seconds(getPingDelayAveraged()) * LL_LOST_TIMEOUT_FACTOR);
U64 mt_usec = LLMessageSystem::getMessageTimeUsecs();
U64Microseconds mt_usec = LLMessageSystem::getMessageTimeUsecs();
for (it = mPotentialLostPackets.begin(); it != mPotentialLostPackets.end(); )
{
U64 delta_t_usec = mt_usec - (*it).second;
U64Microseconds delta_t_usec = mt_usec - (*it).second;
if (delta_t_usec > timeout)
{
// let's call this one a loss!
@@ -1015,7 +1017,7 @@ void LLCircuitData::clearDuplicateList(TPACKETID oldest_id)
// Do timeout checks on everything with an ID > mHighestPacketID.
// This should be empty except for wrapping IDs. Thus, this should be
// highly rare.
U64 mt_usec = LLMessageSystem::getMessageTimeUsecs();
U64Microseconds mt_usec = LLMessageSystem::getMessageTimeUsecs();
packet_time_map::iterator pit;
for(pit = mRecentlyReceivedReliablePackets.upper_bound(mHighestPacketID);
@@ -1026,8 +1028,8 @@ void LLCircuitData::clearDuplicateList(TPACKETID oldest_id)
{
LL_WARNS() << "Probably incorrectly timing out non-wrapped packets!" << LL_ENDL;
}
U64 delta_t_usec = mt_usec - (*pit).second;
F64 delta_t_sec = delta_t_usec * SEC_PER_USEC;
U64Microseconds delta_t_usec = mt_usec - (*pit).second;
F64Seconds delta_t_sec = delta_t_usec;
if (delta_t_sec > LL_DUPLICATE_SUPPRESSION_TIMEOUT)
{
// enough time has elapsed we're not likely to get a duplicate on this one
@@ -1044,7 +1046,7 @@ void LLCircuitData::clearDuplicateList(TPACKETID oldest_id)
BOOL LLCircuitData::checkCircuitTimeout()
{
F64 time_since_last_ping = LLMessageSystem::getMessageTimeSeconds() - mLastPingReceivedTime;
F64Seconds time_since_last_ping = LLMessageSystem::getMessageTimeSeconds() - mLastPingReceivedTime;
// Nota Bene: This needs to be turned off if you are debugging multiple simulators
if (time_since_last_ping > mHeartbeatTimeout)
@@ -1078,22 +1080,30 @@ BOOL LLCircuitData::collectRAck(TPACKETID packet_num)
}
mAcks.push_back(packet_num);
if (mAckCreationTime == 0)
{
mAckCreationTime = getAgeInSeconds();
}
return TRUE;
}
// this method is called during the message system processAcks() to
// send out any acks that did not get sent already.
void LLCircuit::sendAcks()
void LLCircuit::sendAcks(F32 collect_time)
{
collect_time = llclamp(collect_time, 0.f, LL_COLLECT_ACK_TIME_MAX);
LLCircuitData* cd;
circuit_data_map::iterator end = mSendAckMap.end();
for(circuit_data_map::iterator it = mSendAckMap.begin(); it != end; ++it)
circuit_data_map::iterator it = mSendAckMap.begin();
while (it != mSendAckMap.end())
{
cd = (*it).second;
circuit_data_map::iterator cur_it = it++;
cd = (*cur_it).second;
S32 count = (S32)cd->mAcks.size();
if(count > 0)
F32 age = cd->getAgeInSeconds() - cd->mAckCreationTime;
if (age > collect_time || count == 0)
{
if (count>0)
{
// send the packet acks
S32 acks_this_packet = 0;
for(S32 i = 0; i < count; ++i)
@@ -1125,13 +1135,14 @@ void LLCircuit::sendAcks()
LL_INFOS() << str.str() << LL_ENDL;
}
// empty out the acks list
cd->mAcks.clear();
// empty out the acks list
cd->mAcks.clear();
cd->mAckCreationTime = 0.f;
}
// remove data map
mSendAckMap.erase(cur_it);
}
}
// All acks have been sent, clear the map
mSendAckMap.clear();
}
@@ -1140,40 +1151,40 @@ std::ostream& operator<<(std::ostream& s, LLCircuitData& circuit)
F32 age = circuit.mExistenceTimer.getElapsedTimeF32();
using namespace std;
s << "Circuit " << circuit.mHost << " ";
s << circuit.mRemoteID << " ";
s << (circuit.mbAlive ? "Alive" : "Not Alive") << " ";
s << (circuit.mbAllowTimeout ? "Timeout Allowed" : "Timeout Not Allowed");
s << endl;
s << "Circuit " << circuit.mHost << " "
<< circuit.mRemoteID << " "
<< (circuit.mbAlive ? "Alive" : "Not Alive") << " "
<< (circuit.mbAllowTimeout ? "Timeout Allowed" : "Timeout Not Allowed")
<< endl;
s << " Packets Lost: " << circuit.mPacketsLost;
s << " Measured Ping: " << circuit.mPingDelay;
s << " Averaged Ping: " << circuit.mPingDelayAveraged;
s << endl;
s << " Packets Lost: " << circuit.mPacketsLost
<< " Measured Ping: " << circuit.mPingDelay
<< " Averaged Ping: " << circuit.mPingDelayAveraged
<< endl;
s << "Global In/Out " << S32(age) << " sec";
s << " KBytes: " << circuit.mBytesIn / 1024 << "/" << circuit.mBytesOut / 1024;
s << " Kbps: ";
s << S32(circuit.mBytesIn * 8.f / circuit.mExistenceTimer.getElapsedTimeF32() / 1024.f);
s << "/";
s << S32(circuit.mBytesOut * 8.f / circuit.mExistenceTimer.getElapsedTimeF32() / 1024.f);
s << " Packets: " << circuit.mPacketsIn << "/" << circuit.mPacketsOut;
s << endl;
s << "Global In/Out " << S32(age) << " sec"
<< " KBytes: " << circuit.mBytesIn.valueInUnits<LLUnits::Kilobytes>() << "/" << circuit.mBytesOut.valueInUnits<LLUnits::Kilobytes>()
<< " Kbps: "
<< S32(circuit.mBytesIn.valueInUnits<LLUnits::Kilobits>() / circuit.mExistenceTimer.getElapsedTimeF32().value())
<< "/"
<< S32(circuit.mBytesOut.valueInUnits<LLUnits::Kilobits>() / circuit.mExistenceTimer.getElapsedTimeF32().value())
<< " Packets: " << circuit.mPacketsIn << "/" << circuit.mPacketsOut
<< endl;
s << "Recent In/Out " << S32(circuit.mLastPeriodLength) << " sec";
s << " KBytes: ";
s << circuit.mBytesInLastPeriod / 1024;
s << "/";
s << circuit.mBytesOutLastPeriod / 1024;
s << " Kbps: ";
s << S32(circuit.mBytesInLastPeriod * 8.f / circuit.mLastPeriodLength / 1024.f);
s << "/";
s << S32(circuit.mBytesOutLastPeriod * 8.f / circuit.mLastPeriodLength / 1024.f);
s << " Peak kbps: ";
s << S32(circuit.mPeakBPSIn / 1024.f);
s << "/";
s << S32(circuit.mPeakBPSOut / 1024.f);
s << endl;
s << "Recent In/Out " << circuit.mLastPeriodLength
<< " KBytes: "
<< circuit.mBytesInLastPeriod.valueInUnits<LLUnits::Kilobytes>()
<< "/"
<< circuit.mBytesOutLastPeriod.valueInUnits<LLUnits::Kilobytes>()
<< " Kbps: "
<< (S32)(circuit.mBytesInLastPeriod.valueInUnits<LLUnits::Kilobits>() / circuit.mLastPeriodLength.value())
<< "/"
<< (S32)(circuit.mBytesOutLastPeriod.valueInUnits<LLUnits::Kilobits>() / circuit.mLastPeriodLength.value())
<< " Peak kbps: "
<< S32(circuit.mPeakBPSIn / 1024.f)
<< "/"
<< S32(circuit.mPeakBPSOut / 1024.f)
<< endl;
return s;
}
@@ -1268,11 +1279,11 @@ void LLCircuitData::setPacketInID(TPACKETID id)
void LLCircuitData::pingTimerStop(const U8 ping_id)
{
F64 mt_secs = LLMessageSystem::getMessageTimeSeconds();
F64Seconds mt_secs = LLMessageSystem::getMessageTimeSeconds();
// Nota Bene: no averaging of ping times until we get a feel for how this works
F64 time = mt_secs - mPingTime;
if (time == 0.0)
F64Seconds time = mt_secs - mPingTime;
if (time == F32Seconds(0.0))
{
// Ack, we got our ping response on the same frame! Sigh, let's get a real time otherwise
// all of our ping calculations will be skewed.
@@ -1288,7 +1299,7 @@ void LLCircuitData::pingTimerStop(const U8 ping_id)
delta_ping += 256;
}
U32 msec = (U32) ((delta_ping*mHeartbeatInterval + time) * 1000.f);
U32Milliseconds msec = delta_ping*mHeartbeatInterval + time;
setPingDelay(msec);
mPingsInTransit = delta_ping;
@@ -1317,13 +1328,13 @@ U32 LLCircuitData::getPacketsIn() const
}
S32 LLCircuitData::getBytesIn() const
S32Bytes LLCircuitData::getBytesIn() const
{
return mBytesIn;
}
S32 LLCircuitData::getBytesOut() const
S32Bytes LLCircuitData::getBytesOut() const
{
return mBytesOut;
}
@@ -1365,41 +1376,41 @@ BOOL LLCircuitData::getAllowTimeout() const
}
U32 LLCircuitData::getPingDelay() const
U32Milliseconds LLCircuitData::getPingDelay() const
{
return mPingDelay;
}
F32 LLCircuitData::getPingInTransitTime()
F32Milliseconds LLCircuitData::getPingInTransitTime()
{
// This may be inaccurate in the case of a circuit that was "dead" and then revived,
// but only until the first round trip ping is sent - djs
F32 time_since_ping_was_sent = 0;
F32Milliseconds time_since_ping_was_sent(0);
if (mPingsInTransit)
{
time_since_ping_was_sent = (F32)((mPingsInTransit*mHeartbeatInterval - 1)
+ (LLMessageSystem::getMessageTimeSeconds() - mPingTime))*1000.f;
time_since_ping_was_sent = ((mPingsInTransit*mHeartbeatInterval - F32Seconds(1))
+ (LLMessageSystem::getMessageTimeSeconds() - mPingTime));
}
return time_since_ping_was_sent;
}
void LLCircuitData::setPingDelay(U32 ping)
void LLCircuitData::setPingDelay(U32Milliseconds ping)
{
mPingDelay = ping;
mPingDelayAveraged = llmax((F32)ping, getPingDelayAveraged());
mPingDelayAveraged = llmax((F32Milliseconds)ping, getPingDelayAveraged());
mPingDelayAveraged = ((1.f - LL_AVERAGED_PING_ALPHA) * mPingDelayAveraged)
+ (LL_AVERAGED_PING_ALPHA * (F32) ping);
+ (LL_AVERAGED_PING_ALPHA * (F32Milliseconds) ping);
mPingDelayAveraged = llclamp(mPingDelayAveraged,
LL_AVERAGED_PING_MIN,
LL_AVERAGED_PING_MAX);
}
F32 LLCircuitData::getPingDelayAveraged()
F32Milliseconds LLCircuitData::getPingDelayAveraged()
{
return llmin(llmax(getPingInTransitTime(), mPingDelayAveraged), LL_AVERAGED_PING_MAX);
}

View File

@@ -34,7 +34,6 @@
#include "llerror.h"
#include "lltimer.h"
#include "timing.h"
#include "net.h"
#include "llhost.h"
#include "llpacketack.h"
@@ -45,10 +44,10 @@
// Constants
//
const F32 LL_AVERAGED_PING_ALPHA = 0.2f; // relaxation constant on ping running average
const F32 LL_AVERAGED_PING_MAX = 2000; // msec
const F32 LL_AVERAGED_PING_MIN = 100; // msec // IW: increased to avoid retransmits when a process is slow
const F32Milliseconds LL_AVERAGED_PING_MAX(2000);
const F32Milliseconds LL_AVERAGED_PING_MIN(100); // increased to avoid retransmits when a process is slow
const U32 INITIAL_PING_VALUE_MSEC = 1000; // initial value for the ping delay, or for ping delay for an unknown circuit
const U32Milliseconds INITIAL_PING_VALUE_MSEC(1000); // initial value for the ping delay, or for ping delay for an unknown circuit
const TPACKETID LL_MAX_OUT_PACKET_ID = 0x01000000;
const int LL_ERR_CIRCUIT_GONE = -23017;
@@ -61,6 +60,7 @@ const U8 LL_PACKET_ID_SIZE = 6;
const S32 LL_MAX_RESENT_PACKETS_PER_FRAME = 100;
const S32 LL_MAX_ACKED_PACKETS_PER_FRAME = 200;
const F32 LL_COLLECT_ACK_TIME_MAX = 2.f;
//
// Prototypes and Predefines
@@ -78,10 +78,10 @@ class LLCircuitData
{
public:
LLCircuitData(const LLHost &host, TPACKETID in_id,
const F32 circuit_heartbeat_interval, const F32 circuit_timeout);
const F32Seconds circuit_heartbeat_interval, const F32Seconds circuit_timeout);
~LLCircuitData();
S32 resendUnackedPackets(const F64 now);
S32 resendUnackedPackets(const F64Seconds now);
void clearDuplicateList(TPACKETID oldest_id);
@@ -107,18 +107,18 @@ public:
// mLocalEndPointID should only ever be setup in the LLCircuitData constructor
const LLUUID& getLocalEndPointID() const { return mLocalEndPointID; }
U32 getPingDelay() const;
U32Milliseconds getPingDelay() const;
S32 getPingsInTransit() const { return mPingsInTransit; }
// ACCESSORS
BOOL isAlive() const;
BOOL isBlocked() const;
BOOL getAllowTimeout() const;
F32 getPingDelayAveraged();
F32 getPingInTransitTime();
F32Milliseconds getPingDelayAveraged();
F32Milliseconds getPingInTransitTime();
U32 getPacketsIn() const;
S32 getBytesIn() const;
S32 getBytesOut() const;
S32Bytes getBytesIn() const;
S32Bytes getBytesOut() const;
U32 getPacketsOut() const;
U32 getPacketsLost() const;
TPACKETID getPacketOutID() const;
@@ -126,10 +126,10 @@ public:
F32 getAgeInSeconds() const;
S32 getUnackedPacketCount() const { return mUnackedPacketCount; }
S32 getUnackedPacketBytes() const { return mUnackedPacketBytes; }
F64 getNextPingSendTime() const { return mNextPingSendTime; }
F64Seconds getNextPingSendTime() const { return mNextPingSendTime; }
U32 getLastPacketGap() const { return mLastPacketGap; }
LLHost getHost() const { return mHost; }
F64 getLastPacketInTime() const { return mLastPacketInTime; }
F64Seconds getLastPacketInTime() const { return mLastPacketInTime; }
LLThrottleGroup &getThrottleGroup() { return mThrottles; }
@@ -165,11 +165,11 @@ protected:
TPACKETID nextPacketOutID();
void setPacketInID(TPACKETID id);
void checkPacketInID(TPACKETID id, BOOL receive_resent);
void setPingDelay(U32 ping);
void setPingDelay(U32Milliseconds ping);
BOOL checkCircuitTimeout(); // Return FALSE if the circuit is dead and should be cleaned up
void addBytesIn(S32 bytes);
void addBytesOut(S32 bytes);
void addBytesIn(S32Bytes bytes);
void addBytesOut(S32Bytes bytes);
U8 nextPingID() { mLastPingID++; return mLastPingID; }
@@ -220,24 +220,25 @@ protected:
BOOL mBlocked; // Blocked is true if the circuit is hosed, i.e. far behind on pings
// Not sure what the difference between this and mLastPingSendTime is
F64 mPingTime; // Time at which a ping was sent.
F64Seconds mPingTime; // Time at which a ping was sent.
F64 mLastPingSendTime; // Time we last sent a ping
F64 mLastPingReceivedTime; // Time we last received a ping
F64 mNextPingSendTime; // Time to try and send the next ping
S32 mPingsInTransit; // Number of pings in transit
U8 mLastPingID; // ID of the last ping that we sent out
F64Seconds mLastPingSendTime; // Time we last sent a ping
F64Seconds mLastPingReceivedTime; // Time we last received a ping
F64Seconds mNextPingSendTime; // Time to try and send the next ping
S32 mPingsInTransit; // Number of pings in transit
U8 mLastPingID; // ID of the last ping that we sent out
// Used for determining the resend time for reliable resends.
U32 mPingDelay; // raw ping delay
F32 mPingDelayAveraged; // averaged ping delay (fast attack/slow decay)
U32Milliseconds mPingDelay; // raw ping delay
F32Milliseconds mPingDelayAveraged; // averaged ping delay (fast attack/slow decay)
typedef std::map<TPACKETID, U64> packet_time_map;
typedef std::map<TPACKETID, U64Microseconds> packet_time_map;
packet_time_map mPotentialLostPackets;
packet_time_map mRecentlyReceivedReliablePackets;
std::vector<TPACKETID> mAcks;
F32 mAckCreationTime; // first ack creation time
typedef std::map<TPACKETID, LLReliablePacket *> reliable_map;
typedef reliable_map::iterator reliable_iter;
@@ -248,7 +249,7 @@ protected:
S32 mUnackedPacketCount;
S32 mUnackedPacketBytes;
F64 mLastPacketInTime; // Time of last packet arrival
F64Seconds mLastPacketInTime; // Time of last packet arrival
LLUUID mLocalEndPointID;
@@ -260,24 +261,24 @@ protected:
U32 mPacketsOut;
U32 mPacketsIn;
S32 mPacketsLost;
S32 mBytesIn;
S32 mBytesOut;
S32Bytes mBytesIn,
mBytesOut;
F32 mLastPeriodLength; // seconds
S32 mBytesInLastPeriod;
S32 mBytesOutLastPeriod;
S32 mBytesInThisPeriod;
S32 mBytesOutThisPeriod;
F32Seconds mLastPeriodLength;
S32Bytes mBytesInLastPeriod;
S32Bytes mBytesOutLastPeriod;
S32Bytes mBytesInThisPeriod;
S32Bytes mBytesOutThisPeriod;
F32 mPeakBPSIn; // bits per second, max of all period bps
F32 mPeakBPSOut; // bits per second, max of all period bps
F64 mPeriodTime;
F64Seconds mPeriodTime;
LLTimer mExistenceTimer; // initialized when circuit created, used to track bandwidth numbers
S32 mCurrentResendCount; // Number of resent packets since last spam
U32 mLastPacketGap; // Gap in sequence number of last packet.
const F32 mHeartbeatInterval;
const F32 mHeartbeatTimeout;
const F32Seconds mHeartbeatInterval;
const F32Seconds mHeartbeatTimeout;
};
@@ -287,7 +288,7 @@ class LLCircuit
{
public:
// CREATORS
LLCircuit(const F32 circuit_heartbeat_interval, const F32 circuit_timeout);
LLCircuit(const F32Seconds circuit_heartbeat_interval, const F32Seconds circuit_timeout);
~LLCircuit();
// ACCESSORS
@@ -303,7 +304,7 @@ public:
// this method is called during the message system processAcks()
// to send out any acks that did not get sent already.
void sendAcks();
void sendAcks(F32 collect_time);
friend std::ostream& operator<<(std::ostream& s, LLCircuit &circuit);
void getInfo(LLSD& info) const;
@@ -346,7 +347,7 @@ protected:
mutable LLCircuitData* mLastCircuit;
private:
const F32 mHeartbeatInterval;
const F32 mHeartbeatTimeout;
const F32Seconds mHeartbeatInterval;
const F32Seconds mHeartbeatTimeout;
};
#endif

View File

@@ -38,7 +38,7 @@ namespace
{
typedef std::map<LLHost, LLHTTPSender*> SenderMap;
static SenderMap senderMap;
static LLHTTPSender* defaultSender = new LLHTTPSender();
static LLPointer<LLHTTPSender> defaultSender(new LLHTTPSender());
}
//virtual
@@ -90,6 +90,5 @@ void LLHTTPSender::clearSender(const LLHost& host)
//static
void LLHTTPSender::setDefaultSender(LLHTTPSender* sender)
{
delete defaultSender;
defaultSender = sender;
}

View File

@@ -32,7 +32,7 @@
class LLHost;
class LLSD;
class LLHTTPSender
class LLHTTPSender : public LLThreadSafeRefCount
{
public:

View File

@@ -50,7 +50,7 @@ LLReliablePacket::LLReliablePacket(
mHost = params->mHost;
mRetries = params->mRetries;
mPingBasedRetry = params->mPingBasedRetry;
mTimeout = params->mTimeout;
mTimeout = F32Seconds(params->mTimeout);
mCallback = params->mCallback;
mCallbackData = params->mCallbackData;
mMessageName = params->mMessageName;
@@ -59,13 +59,13 @@ LLReliablePacket::LLReliablePacket(
{
mRetries = 0;
mPingBasedRetry = TRUE;
mTimeout = 0.f;
mTimeout = F32Seconds(0.f);
mCallback = NULL;
mCallbackData = NULL;
mMessageName = NULL;
}
mExpirationTime = (F64)((S64)totalTime())/1000000.0 + mTimeout;
mExpirationTime = (F64Seconds)totalTime() + mTimeout;
mPacketID = ntohl(*((U32*)(&buf_ptr[PHL_PACKET_ID])));
mSocket = socket;

View File

@@ -28,6 +28,7 @@
#define LL_LLPACKETACK_H
#include "llhost.h"
#include "llunits.h"
class LLReliablePacketParams
{
@@ -35,7 +36,7 @@ public:
LLHost mHost;
S32 mRetries;
BOOL mPingBasedRetry;
F32 mTimeout;
F32Seconds mTimeout;
void (*mCallback)(void **,S32);
void** mCallbackData;
char* mMessageName;
@@ -53,7 +54,7 @@ public:
mHost.invalidate();
mRetries = 0;
mPingBasedRetry = TRUE;
mTimeout = 0.f;
mTimeout = F32Seconds(0.f);
mCallback = NULL;
mCallbackData = NULL;
mMessageName = NULL;
@@ -63,7 +64,7 @@ public:
const LLHost& host,
S32 retries,
BOOL ping_based_retry,
F32 timeout,
F32Seconds timeout,
void (*callback)(void**,S32),
void** callback_data, char* name)
{
@@ -98,7 +99,7 @@ protected:
LLHost mHost;
S32 mRetries;
BOOL mPingBasedRetry;
F32 mTimeout;
F32Seconds mTimeout;
void (*mCallback)(void**,S32);
void** mCallbackData;
char* mMessageName;
@@ -108,7 +109,7 @@ protected:
TPACKETID mPacketID;
F64 mExpirationTime;
F64Seconds mExpirationTime;
};
#endif

View File

@@ -29,7 +29,7 @@
#include "llpacketbuffer.h"
#include "net.h"
#include "timing.h"
#include "lltimer.h"
#include "llhost.h"
///////////////////////////////////////////////////////////

View File

@@ -41,7 +41,6 @@
#include "llproxy.h"
#include "llrand.h"
#include "message.h"
#include "timing.h"
#include "u64.h"
//<edit>

View File

@@ -115,9 +115,9 @@ S32 LLProxy::proxyHandshake(LLHost proxy)
U32 request_size = socks_username.size() + socks_password.size() + 3;
char * password_auth = new char[request_size];
password_auth[0] = 0x01;
password_auth[1] = (char)socks_username.size();
password_auth[1] = static_cast<char>(socks_username.size());
memcpy(&password_auth[2], socks_username.c_str(), socks_username.size());
password_auth[socks_username.size() + 2] = (char)socks_password.size();
password_auth[socks_username.size() + 2] = static_cast<char>(socks_password.size());
memcpy(&password_auth[socks_username.size() + 3], socks_password.c_str(), socks_password.size());
authmethod_password_reply_t password_reply;

View File

@@ -53,8 +53,8 @@ F32 LLThrottle::getAvailable()
{
// use a temporary bits_available
// since we don't want to change mBitsAvailable every time
F32 elapsed_time = (F32)(LLMessageSystem::getMessageTimeSeconds() - mLastSendTime);
return mAvailable + (mRate * elapsed_time);
F32Seconds elapsed_time = LLMessageSystem::getMessageTimeSeconds() - mLastSendTime;
return mAvailable + (mRate * elapsed_time.value());
}
BOOL LLThrottle::checkOverflow(const F32 amount)
@@ -65,8 +65,8 @@ BOOL LLThrottle::checkOverflow(const F32 amount)
// use a temporary bits_available
// since we don't want to change mBitsAvailable every time
F32 elapsed_time = (F32)(LLMessageSystem::getMessageTimeSeconds() - mLastSendTime);
F32 amount_available = mAvailable + (mRate * elapsed_time);
F32Seconds elapsed_time = LLMessageSystem::getMessageTimeSeconds() - mLastSendTime;
F32 amount_available = mAvailable + (mRate * elapsed_time.value());
if ((amount_available >= lookahead_amount) || (amount_available > amount))
{
@@ -80,17 +80,17 @@ BOOL LLThrottle::checkOverflow(const F32 amount)
BOOL LLThrottle::throttleOverflow(const F32 amount)
{
F32 elapsed_time;
F32Seconds elapsed_time;
F32 lookahead_amount;
BOOL retval = TRUE;
lookahead_amount = mRate * mLookaheadSecs;
F64 mt_sec = LLMessageSystem::getMessageTimeSeconds();
elapsed_time = (F32)(mt_sec - mLastSendTime);
F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds();
elapsed_time = mt_sec - mLastSendTime;
mLastSendTime = mt_sec;
mAvailable += mRate * elapsed_time;
mAvailable += mRate * elapsed_time.value();
if (mAvailable >= lookahead_amount)
{
@@ -222,7 +222,7 @@ void LLThrottleGroup::unpackThrottle(LLDataPacker &dp)
// into NOT resetting the system.
void LLThrottleGroup::resetDynamicAdjust()
{
F64 mt_sec = LLMessageSystem::getMessageTimeSeconds();
F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds();
S32 i;
for (i = 0; i < TC_EOF; i++)
{
@@ -269,8 +269,8 @@ S32 LLThrottleGroup::getAvailable(S32 throttle_cat)
// use a temporary bits_available
// since we don't want to change mBitsAvailable every time
F32 elapsed_time = (F32)(LLMessageSystem::getMessageTimeSeconds() - mLastSendTime[throttle_cat]);
F32 bits_available = mBitsAvailable[throttle_cat] + (category_bps * elapsed_time);
F32Seconds elapsed_time = LLMessageSystem::getMessageTimeSeconds() - mLastSendTime[throttle_cat];
F32 bits_available = mBitsAvailable[throttle_cat] + (category_bps * elapsed_time.value());
if (bits_available >= lookahead_bits)
{
@@ -294,8 +294,8 @@ BOOL LLThrottleGroup::checkOverflow(S32 throttle_cat, F32 bits)
// use a temporary bits_available
// since we don't want to change mBitsAvailable every time
F32 elapsed_time = (F32)(LLMessageSystem::getMessageTimeSeconds() - mLastSendTime[throttle_cat]);
F32 bits_available = mBitsAvailable[throttle_cat] + (category_bps * elapsed_time);
F32Seconds elapsed_time = LLMessageSystem::getMessageTimeSeconds() - mLastSendTime[throttle_cat];
F32 bits_available = mBitsAvailable[throttle_cat] + (category_bps * elapsed_time.value());
if (bits_available >= lookahead_bits)
{
@@ -315,7 +315,7 @@ BOOL LLThrottleGroup::checkOverflow(S32 throttle_cat, F32 bits)
BOOL LLThrottleGroup::throttleOverflow(S32 throttle_cat, F32 bits)
{
F32 elapsed_time;
F32Seconds elapsed_time;
F32 category_bps;
F32 lookahead_bits;
BOOL retval = TRUE;
@@ -323,10 +323,10 @@ BOOL LLThrottleGroup::throttleOverflow(S32 throttle_cat, F32 bits)
category_bps = mCurrentBPS[throttle_cat];
lookahead_bits = category_bps * THROTTLE_LOOKAHEAD_TIME;
F64 mt_sec = LLMessageSystem::getMessageTimeSeconds();
elapsed_time = (F32)(mt_sec - mLastSendTime[throttle_cat]);
F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds();
elapsed_time = mt_sec - mLastSendTime[throttle_cat];
mLastSendTime[throttle_cat] = mt_sec;
mBitsAvailable[throttle_cat] += category_bps * elapsed_time;
mBitsAvailable[throttle_cat] += category_bps * elapsed_time.value();
if (mBitsAvailable[throttle_cat] >= lookahead_bits)
{
@@ -356,7 +356,7 @@ BOOL LLThrottleGroup::throttleOverflow(S32 throttle_cat, F32 bits)
BOOL LLThrottleGroup::dynamicAdjust()
{
const F32 DYNAMIC_ADJUST_TIME = 1.0f; // seconds
const F32Seconds DYNAMIC_ADJUST_TIME(1.0f);
const F32 CURRENT_PERIOD_WEIGHT = .25f; // how much weight to give to last period while determining BPS utilization
const F32 BUSY_PERCENT = 0.75f; // if use more than this fraction of BPS, you are busy
const F32 IDLE_PERCENT = 0.70f; // if use less than this fraction, you are "idle"
@@ -365,7 +365,7 @@ BOOL LLThrottleGroup::dynamicAdjust()
S32 i;
F64 mt_sec = LLMessageSystem::getMessageTimeSeconds();
F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds();
// Only dynamically adjust every few seconds
if ((mt_sec - mDynamicAdjustTime) < DYNAMIC_ADJUST_TIME)
@@ -405,7 +405,7 @@ BOOL LLThrottleGroup::dynamicAdjust()
for (i = 0; i < TC_EOF; i++)
{
// Is this a busy channel?
if (mBitsSentHistory[i] >= BUSY_PERCENT * DYNAMIC_ADJUST_TIME * mCurrentBPS[i])
if (mBitsSentHistory[i] >= BUSY_PERCENT * DYNAMIC_ADJUST_TIME.value() * mCurrentBPS[i])
{
// this channel is busy
channels_busy = TRUE;
@@ -418,7 +418,7 @@ BOOL LLThrottleGroup::dynamicAdjust()
}
// Is this an idle channel?
if ((mBitsSentHistory[i] < IDLE_PERCENT * DYNAMIC_ADJUST_TIME * mCurrentBPS[i]) &&
if ((mBitsSentHistory[i] < IDLE_PERCENT * DYNAMIC_ADJUST_TIME.value() * mCurrentBPS[i]) &&
(mBitsAvailable[i] > 0))
{
channel_idle[i] = TRUE;
@@ -462,7 +462,7 @@ BOOL LLThrottleGroup::dynamicAdjust()
// Therefore it's a candidate to give up some bandwidth.
// Figure out how much bandwidth it has been using, and how
// much is available to steal.
used_bps = mBitsSentHistory[i] / DYNAMIC_ADJUST_TIME;
used_bps = mBitsSentHistory[i] / DYNAMIC_ADJUST_TIME.value();
// CRO make sure to keep a minimum amount of throttle available
// CRO NB: channels set to < MINIMUM_BPS will never give up bps,

View File

@@ -50,7 +50,7 @@ private:
F32 mLookaheadSecs; // Seconds to look ahead, maximum
F32 mRate; // BPS available, dynamically adjusted
F32 mAvailable; // Bits available to send right now on each channel
F64 mLastSendTime; // Time since last send on this channel
F64Seconds mLastSendTime; // Time since last send on this channel
};
typedef enum e_throttle_categories
@@ -93,8 +93,8 @@ protected:
F32 mBitsSentThisPeriod[TC_EOF]; // Sent in this dynamic allocation period
F32 mBitsSentHistory[TC_EOF]; // Sent before this dynamic allocation period, adjusted to one period length
F64 mLastSendTime[TC_EOF]; // Time since last send on this channel
F64 mDynamicAdjustTime; // Only dynamic adjust every 2 seconds or so.
F64Seconds mLastSendTime[TC_EOF]; // Time since last send on this channel
F64Seconds mDynamicAdjustTime; // Only dynamic adjust every 2 seconds or so.
};

View File

@@ -606,16 +606,21 @@ void LLTransferManager::processTransferAbort(LLMessageSystem *msgp, void **)
void LLTransferManager::reliablePacketCallback(void **user_data, S32 result)
{
LLUUID *transfer_idp = (LLUUID *)user_data;
if (result)
if (result &&
transfer_idp != NULL)
{
LL_WARNS() << "Aborting reliable transfer " << *transfer_idp << " due to failed reliable resends!" << LL_ENDL;
LLTransferSource *tsp = gTransferManager.findTransferSource(*transfer_idp);
if (tsp)
{
LL_WARNS() << "Aborting reliable transfer " << *transfer_idp << " due to failed reliable resends!" << LL_ENDL;
LLTransferSourceChannel *tscp = tsp->mChannelp;
tsp->abortTransfer();
tscp->deleteTransfer(tsp);
}
else
{
LL_WARNS() << "Aborting reliable transfer " << *transfer_idp << " but can't find the LLTransferSource object" << LL_ENDL;
}
}
delete transfer_idp;
}
@@ -815,7 +820,7 @@ void LLTransferSourceChannel::updateTransfers()
gMessageSystem->addS32("Status", status);
gMessageSystem->addBinaryData("Data", datap, data_size);
sent_bytes = gMessageSystem->getCurrentSendTotal();
gMessageSystem->sendReliable(getHost(), LL_DEFAULT_RELIABLE_RETRIES, TRUE, 0.f,
gMessageSystem->sendReliable(getHost(), LL_DEFAULT_RELIABLE_RETRIES, TRUE, F32Seconds(0.f),
LLTransferManager::reliablePacketCallback, (void**)cb_uuid);
// Do bookkeeping for the throttle
@@ -892,22 +897,26 @@ LLTransferSource *LLTransferSourceChannel::findTransferSource(const LLUUID &tran
}
BOOL LLTransferSourceChannel::deleteTransfer(LLTransferSource *tsp)
void LLTransferSourceChannel::deleteTransfer(LLTransferSource *tsp)
{
LLPriQueueMap<LLTransferSource *>::pqm_iter iter;
for (iter = mTransferSources.mMap.begin(); iter != mTransferSources.mMap.end(); iter++)
if (tsp)
{
if (iter->second == tsp)
LLPriQueueMap<LLTransferSource *>::pqm_iter iter;
for (iter = mTransferSources.mMap.begin(); iter != mTransferSources.mMap.end(); iter++)
{
delete tsp;
mTransferSources.mMap.erase(iter);
return TRUE;
if (iter->second == tsp)
{
delete tsp;
mTransferSources.mMap.erase(iter);
return;
}
}
}
LL_ERRS() << "Unable to find transfer source to delete!" << LL_ENDL;
return FALSE;
LL_WARNS() << "Unable to find transfer source id "
<< tsp->getID()
<< " to delete!"
<< LL_ENDL;
}
}
@@ -1008,21 +1017,26 @@ LLTransferTarget *LLTransferTargetChannel::findTransferTarget(const LLUUID &tran
}
BOOL LLTransferTargetChannel::deleteTransfer(LLTransferTarget *ttp)
void LLTransferTargetChannel::deleteTransfer(LLTransferTarget *ttp)
{
tt_iter iter;
for (iter = mTransferTargets.begin(); iter != mTransferTargets.end(); iter++)
if (ttp)
{
if (*iter == ttp)
tt_iter iter;
for (iter = mTransferTargets.begin(); iter != mTransferTargets.end(); iter++)
{
delete ttp;
mTransferTargets.erase(iter);
return TRUE;
if (*iter == ttp)
{
delete ttp;
mTransferTargets.erase(iter);
return;
}
}
}
LL_ERRS() << "Unable to find transfer target to delete!" << LL_ENDL;
return FALSE;
LL_WARNS() << "Unable to find transfer target id "
<< ttp->getID()
<< " to delete!"
<< LL_ENDL;
}
}
@@ -1246,9 +1260,13 @@ bool LLTransferTarget::addDelayedPacket(
size);
#ifdef _DEBUG
if (mDelayedPacketMap.find(packet_id) != mDelayedPacketMap.end())
transfer_packet_map::iterator iter = mDelayedPacketMap.find(packet_id);
if (iter != mDelayedPacketMap.end())
{
LL_ERRS() << "Packet ALREADY in delayed packet map!" << LL_ENDL;
if (!(iter->second->mSize == size) && !(iter->second->mDatap == datap))
{
LL_ERRS() << "Packet ALREADY in delayed packet map!" << LL_ENDL;
}
}
#endif

View File

@@ -199,7 +199,7 @@ public:
void addTransferSource(LLTransferSource *sourcep);
LLTransferSource *findTransferSource(const LLUUID &transfer_id);
BOOL deleteTransfer(LLTransferSource *tsp);
void deleteTransfer(LLTransferSource *tsp);
void setThrottleID(const S32 throttle_id) { mThrottleID = throttle_id; }
@@ -232,7 +232,7 @@ public:
const F32 priority);
LLTransferTarget *findTransferTarget(const LLUUID &transfer_id);
BOOL deleteTransfer(LLTransferTarget *ttp);
void deleteTransfer(LLTransferTarget *ttp);
LLTransferChannelType getChannelType() const { return mChannelType; }

View File

@@ -261,7 +261,7 @@ U32 LLXferManager::numActiveListEntries(LLXfer *list_head)
while (list_head)
{
if (list_head->mStatus == e_LL_XFER_IN_PROGRESS)
if (list_head->mStatus == e_LL_XFER_IN_PROGRESS)
{
num_entries++;
}
@@ -677,7 +677,7 @@ void LLXferManager::processReceiveData (LLMessageSystem *mesgsys, void ** /*user
ack_info.mID = id;
ack_info.mPacketNum = decodePacketNum(packetnum);
ack_info.mRemoteHost = mesgsys->getSender();
mXferAckQueue.push(ack_info);
mXferAckQueue.push_back(ack_info);
}
if (isLastPacket(packetnum))
@@ -1088,15 +1088,15 @@ void LLXferManager::retransmitUnackedPackets ()
// so we don't blow through bandwidth.
//
while (mXferAckQueue.getLength())
while (mXferAckQueue.size())
{
if (mAckThrottle.checkOverflow(1000.0f*8.0f))
{
break;
}
//LL_INFOS() << "Confirm packet queue length:" << mXferAckQueue.getLength() << LL_ENDL;
LLXferAckInfo ack_info;
mXferAckQueue.pop(ack_info);
//LL_INFOS() << "Confirm packet queue length:" << mXferAckQueue.size() << LL_ENDL;
LLXferAckInfo ack_info = mXferAckQueue.front();
mXferAckQueue.pop_front();
//LL_INFOS() << "Sending confirm packet" << LL_ENDL;
sendConfirmPacket(gMessageSystem, ack_info.mID, ack_info.mPacketNum, ack_info.mRemoteHost);
mAckThrottle.throttleOverflow(1000.f*8.f); // Assume 1000 bytes/packet

View File

@@ -41,7 +41,7 @@ class LLVFS;
#include "message.h"
#include "llassetstorage.h"
#include "lldir.h"
#include "lllinkedqueue.h"
#include <deque>
#include "llthrottle.h"
class LLHostStatus
@@ -80,7 +80,7 @@ class LLXferManager
S32 mMaxIncomingXfers;
BOOL mUseAckThrottling; // Use ack throttling to cap file xfer bandwidth
LLLinkedQueue<LLXferAckInfo> mXferAckQueue;
std::deque<LLXferAckInfo> mXferAckQueue;
LLThrottle mAckThrottle;
public:

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());
}
}

View File

@@ -148,18 +148,15 @@ enum EPacketHeaderLayout
const S32 LL_DEFAULT_RELIABLE_RETRIES = 3;
const F32 LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS = 1.f;
const F32 LL_MINIMUM_SEMIRELIABLE_TIMEOUT_SECONDS = 1.f;
const F32 LL_PING_BASED_TIMEOUT_DUMMY = 0.0f;
const F32Seconds LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS(1.f);
const F32Seconds LL_MINIMUM_SEMIRELIABLE_TIMEOUT_SECONDS(1.f);
const F32Seconds LL_PING_BASED_TIMEOUT_DUMMY(0.0f);
// *NOTE: Maybe these factors shouldn't include the msec to sec conversion
// implicitly.
// However, all units should be MKS.
const F32 LL_SEMIRELIABLE_TIMEOUT_FACTOR = 5.f / 1000.f; // factor * averaged ping
const F32 LL_RELIABLE_TIMEOUT_FACTOR = 5.f / 1000.f; // factor * averaged ping
const F32 LL_FILE_XFER_TIMEOUT_FACTOR = 5.f / 1000.f; // factor * averaged ping
const F32 LL_LOST_TIMEOUT_FACTOR = 16.f / 1000.f; // factor * averaged ping for marking packets "Lost"
const F32 LL_MAX_LOST_TIMEOUT = 5.f; // Maximum amount of time before considering something "lost"
const F32 LL_SEMIRELIABLE_TIMEOUT_FACTOR = 5.f; // averaged ping
const F32 LL_RELIABLE_TIMEOUT_FACTOR = 5.f; // averaged ping
const F32 LL_FILE_XFER_TIMEOUT_FACTOR = 5.f; //averaged ping
const F32 LL_LOST_TIMEOUT_FACTOR = 16.f; // averaged ping for marking packets "Lost"
const F32Seconds LL_MAX_LOST_TIMEOUT(5.f); // Maximum amount of time before considering something "lost"
const S32 MAX_MESSAGE_COUNT_NUM = 1024;
@@ -279,8 +276,8 @@ public:
BOOL mSendReliable; // does the outgoing message require a pos ack?
LLCircuit mCircuitInfo;
F64 mCircuitPrintTime; // used to print circuit debug info every couple minutes
F32 mCircuitPrintFreq; // seconds
F64Seconds mCircuitPrintTime; // used to print circuit debug info every couple minutes
F32Seconds mCircuitPrintFreq;
std::map<U64, U32> mIPPortToCircuitCode;
std::map<U32, U64> mCircuitCodeToIPPort;
@@ -344,7 +341,7 @@ public:
BOOL poll(F32 seconds); // Number of seconds that we want to block waiting for data, returns if data was received
BOOL checkMessages(S64 frame_count = 0);
void processAcks();
void processAcks(F32 collect_time = 0.f);
BOOL isMessageFast(const char *msg);
BOOL isMessage(const char *msg)
@@ -478,7 +475,7 @@ public:
S32 sendReliable( const LLHost &host,
S32 retries,
BOOL ping_based_retries,
F32 timeout,
F32Seconds timeout,
void (*callback)(void **,S32),
void ** callback_data);
@@ -498,7 +495,7 @@ public:
const LLHost &host,
S32 retries,
BOOL ping_based_timeout,
F32 timeout,
F32Seconds timeout,
void (*callback)(void **,S32),
void ** callback_data);
@@ -692,8 +689,8 @@ public:
void setMaxMessageTime(const F32 seconds); // Max time to process messages before warning and dumping (neg to disable)
void setMaxMessageCounts(const S32 num); // Max number of messages before dumping (neg to disable)
static U64 getMessageTimeUsecs(const BOOL update = FALSE); // Get the current message system time in microseconds
static F64 getMessageTimeSeconds(const BOOL update = FALSE); // Get the current message system time in seconds
static U64Microseconds getMessageTimeUsecs(const BOOL update = FALSE); // Get the current message system time in microseconds
static F64Seconds getMessageTimeSeconds(const BOOL update = FALSE); // Get the current message system time in seconds
static void setTimeDecodes(BOOL b);
static void setTimeDecodesSpamThreshold(F32 seconds);
@@ -792,16 +789,16 @@ private:
BOOL mbError;
S32 mErrorCode;
F64 mResendDumpTime; // The last time we dumped resends
F64Seconds mResendDumpTime; // The last time we dumped resends
LLMessageCountInfo mMessageCountList[MAX_MESSAGE_COUNT_NUM];
S32 mNumMessageCounts;
F32 mReceiveTime;
F32 mMaxMessageTime; // Max number of seconds for processing messages
F32Seconds mReceiveTime;
F32Seconds mMaxMessageTime; // Max number of seconds for processing messages
S32 mMaxMessageCounts; // Max number of messages to process before dumping.
F64 mMessageCountTime;
F64Seconds mMessageCountTime;
F64 mCurrentMessageTimeSeconds; // The current "message system time" (updated the first call to checkMessages after a resetReceiveCount
F64Seconds mCurrentMessageTime; // The current "message system time" (updated the first call to checkMessages after a resetReceiveCount
// message system exceptions
typedef std::pair<msg_exception_callback, void*> exception_t;

View File

@@ -32,9 +32,7 @@
#include <stdexcept>
#if LL_WINDOWS
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
#include "llwin32headerslean.h"
#else
#include <sys/types.h>
#include <sys/socket.h>

View File

@@ -1968,7 +1968,7 @@ bool idle_startup()
gFirstSim,
MAX_TIMEOUT_COUNT,
FALSE,
TIMEOUT_SECONDS,
F32Seconds(TIMEOUT_SECONDS),
use_circuit_callback,
NULL);

View File

@@ -266,23 +266,23 @@ private:
F32 mImagePriority;
U32 mWorkPriority;
F32 mRequestedPriority;
S32 mDesiredDiscard;
S32 mSimRequestedDiscard;
S32 mRequestedDiscard;
S32 mLoadedDiscard;
S32 mDecodedDiscard;
LLFrameTimer mRequestedTimer;
LLFrameTimer mFetchTimer;
S32 mDesiredDiscard,
mSimRequestedDiscard,
mRequestedDiscard,
mLoadedDiscard,
mDecodedDiscard;
LLFrameTimer mRequestedTimer,
mFetchTimer;
LLTimer mCacheReadTimer;
F32 mCacheReadTime;
LLTextureCache::handle_t mCacheReadHandle;
LLTextureCache::handle_t mCacheWriteHandle;
LLTextureCache::handle_t mCacheReadHandle,
mCacheWriteHandle;
std::vector<U8> mHttpBuffer;
S32 mRequestedSize;
S32 mRequestedOffset;
S32 mDesiredSize;
S32 mFileSize;
S32 mCachedSize;
S32 mRequestedSize,
mRequestedOffset,
mDesiredSize,
mFileSize,
mCachedSize;
e_request_state mSentRequest;
handle_t mDecodeHandle;
BOOL mLoaded;
@@ -303,9 +303,12 @@ private:
LLMutex mWorkMutex;
struct PacketData
{
PacketData(U8* data, S32 size) { mData = data; mSize = size; }
PacketData(U8* data, S32 size)
: mData(data), mSize(size)
{}
~PacketData() { clearData(); }
void clearData() { delete[] mData; mData = NULL; }
U8* mData;
U32 mSize;
};
@@ -397,7 +400,7 @@ public:
if (log_to_viewer_log || log_to_sim)
{
U64 timeNow = LLTimer::getTotalTime();
U64Microseconds timeNow = LLTimer::getTotalTime();
mFetcher->mTextureInfo.setRequestStartTime(mID, mMetricsStartTime);
mFetcher->mTextureInfo.setRequestType(mID, LLTextureInfoDetails::REQUEST_TYPE_HTTP);
mFetcher->mTextureInfo.setRequestSize(mID, mRequestedSize);
@@ -2234,7 +2237,7 @@ bool LLTextureFetchWorker::writeToCacheComplete()
// Threads: Ttf
void LLTextureFetchWorker::recordTextureStart(bool is_http)
{
if (! mMetricsStartTime)
if (! mMetricsStartTime.value())
{
mMetricsStartTime = LLViewerAssetStatsFF::get_timestamp();
}
@@ -2247,13 +2250,13 @@ void LLTextureFetchWorker::recordTextureStart(bool is_http)
// Threads: Ttf
void LLTextureFetchWorker::recordTextureDone(bool is_http)
{
if (mMetricsStartTime)
if (mMetricsStartTime.value())
{
LLViewerAssetStatsFF::record_response_thread1(LLViewerAssetType::AT_TEXTURE,
is_http,
LLImageBase::TYPE_AVATAR_BAKE == mType,
LLViewerAssetStatsFF::get_timestamp() - mMetricsStartTime);
mMetricsStartTime = 0;
mMetricsStartTime = (U32Seconds)0;
}
LLViewerAssetStatsFF::record_dequeue_thread1(LLViewerAssetType::AT_TEXTURE,
is_http,
@@ -2277,7 +2280,7 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image
mTotalCacheReadCount(0U),
mTotalCacheWriteCount(0U)
{
mTextureInfo.setUpLogging(gSavedSettings.getBOOL("LogTextureDownloadsToViewerLog"), gSavedSettings.getBOOL("LogTextureDownloadsToSimulator"), gSavedSettings.getU32("TextureLoggingThreshold"));
mTextureInfo.setUpLogging(gSavedSettings.getBOOL("LogTextureDownloadsToViewerLog"), gSavedSettings.getBOOL("LogTextureDownloadsToSimulator"), (U32Bytes)gSavedSettings.getU32("TextureLoggingThreshold"));
}
LLTextureFetch::~LLTextureFetch()
@@ -3118,7 +3121,7 @@ bool LLTextureFetch::receiveImagePacket(const LLHost& host, const LLUUID& id, U1
if (log_to_viewer_log || log_to_sim)
{
U64 timeNow = LLTimer::getTotalTime();
U64Microseconds timeNow = LLTimer::getTotalTime();
mTextureInfo.setRequestSize(id, worker->mFileSize);
mTextureInfo.setRequestCompleteTimeAndLog(id, timeNow);
}

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
{

View File

@@ -43,18 +43,18 @@ public:
LLTextureInfo();
~LLTextureInfo();
void setUpLogging(bool writeToViewerLog, bool sendToSim, U32 textureLogThreshold);
void setUpLogging(bool writeToViewerLog, bool sendToSim, U32Bytes textureLogThreshold);
bool has(const LLUUID& id);
void setRequestStartTime(const LLUUID& id, U64 startTime);
void setRequestSize(const LLUUID& id, U32 size);
void setRequestOffset(const LLUUID& id, U32 offset);
void setRequestType(const LLUUID& id, LLTextureInfoDetails::LLRequestType type);
void setRequestCompleteTimeAndLog(const LLUUID& id, U64 completeTime);
U32 getRequestStartTime(const LLUUID& id);
U32 getRequestSize(const LLUUID& id);
void setRequestCompleteTimeAndLog(const LLUUID& id, U64Microseconds completeTime);
U32Microseconds getRequestStartTime(const LLUUID& id);
U32Bytes getRequestSize(const LLUUID& id);
U32 getRequestOffset(const LLUUID& id);
LLTextureInfoDetails::LLRequestType getRequestType(const LLUUID& id);
U32 getRequestCompleteTime(const LLUUID& id);
U32Microseconds getRequestCompleteTime(const LLUUID& id);
void resetTextureStatistics();
U32 getTextureInfoMapSize();
LLSD getAverages();
@@ -66,15 +66,15 @@ private:
LLSD mAverages;
bool mLogTextureDownloadsToViewerLog;
bool mLogTextureDownloadsToSimulator;
S32 mTotalBytes;
S32 mTotalMilliseconds;
bool mLogTextureDownloadsToViewerLog,
mLogTextureDownloadsToSimulator;
U32Bytes mTotalBytes;
U32Milliseconds mTotalMilliseconds;
S32 mTextureDownloadsStarted;
S32 mTextureDownloadsCompleted;
std::string mTextureDownloadProtocol;
U32 mTextureLogThreshold; // in bytes
U64 mCurrentStatsBundleStartTime;
U32Bytes mTextureLogThreshold; // in bytes
U64Microseconds mCurrentStatsBundleStartTime;
};
#endif // LL_LLTEXTUREINFO_H

View File

@@ -34,7 +34,9 @@
#include "lltextureinfodetails.h"
LLTextureInfoDetails::LLTextureInfoDetails() : mStartTime(0), mCompleteTime(0), mSize(0), mType(REQUEST_TYPE_NONE), mOffset(0)
LLTextureInfoDetails::LLTextureInfoDetails()
: mType(REQUEST_TYPE_NONE),
mOffset(0)
{
}

View File

@@ -34,10 +34,10 @@
#define LL_LLTEXTUREINFODETAILS_H
#include "lluuid.h"
#include "llunits.h"
class LLTextureInfoDetails
struct LLTextureInfoDetails
{
public:
enum LLRequestType
{
REQUEST_TYPE_NONE,
@@ -45,11 +45,11 @@ public:
REQUEST_TYPE_UDP
};
U32 mStartTime;
U32 mCompleteTime;
U32 mOffset;
U32 mSize;
LLRequestType mType;
U32Microseconds mStartTime,
mCompleteTime;
U32 mOffset;
U32Bytes mSize;
LLRequestType mType;
LLTextureInfoDetails();
};

View File

@@ -110,7 +110,7 @@ LLViewerAssetStats::PerRegionStats::reset()
}
mFPS.reset();
mTotalTime = 0;
mTotalTime = U64Microseconds(0);
mStartTimestamp = LLViewerAssetStatsFF::get_timestamp();
}
@@ -315,9 +315,9 @@ LLViewerAssetStats::asLLSD(bool compact_output)
slot[enq_tag] = LLSD(S32(stats.mRequests[i].mEnqueued.getCount()));
slot[deq_tag] = LLSD(S32(stats.mRequests[i].mDequeued.getCount()));
slot[rcnt_tag] = LLSD(S32(stats.mRequests[i].mResponse.getCount()));
slot[rmin_tag] = LLSD(F64(stats.mRequests[i].mResponse.getMin() * 1.0e-6));
slot[rmax_tag] = LLSD(F64(stats.mRequests[i].mResponse.getMax() * 1.0e-6));
slot[rmean_tag] = LLSD(F64(stats.mRequests[i].mResponse.getMean() * 1.0e-6));
slot[rmin_tag] = LLSD(F64(stats.mRequests[i].mResponse.getMin().valueInUnits<LLUnits::Seconds>()));
slot[rmax_tag] = LLSD(F64(stats.mRequests[i].mResponse.getMax().valueInUnits<LLUnits::Seconds>()));
slot[rmean_tag] = LLSD(F64(stats.mRequests[i].mResponse.getMean().valueInUnits<LLUnits::Seconds>()));
}
}
@@ -334,13 +334,13 @@ LLViewerAssetStats::asLLSD(bool compact_output)
grid_from_region_handle(it->first, &grid_x, &grid_y);
reg_stat["grid_x"] = LLSD::Integer(grid_x);
reg_stat["grid_y"] = LLSD::Integer(grid_y);
reg_stat["duration"] = LLSD::Real(stats.mTotalTime * 1.0e-6);
reg_stat["duration"] = LLSD::Real(stats.mTotalTime.valueInUnits<LLUnits::Seconds>());
regions.append(reg_stat);
}
LLSD ret = LLSD::emptyMap();
ret["regions"] = regions;
ret["duration"] = LLSD::Real((now - mResetTimestamp) * 1.0e-6);
ret["duration"] = LLSD::Real((now - mResetTimestamp).valueInUnits<LLUnits::Seconds>());
return ret;
}

View File

@@ -94,7 +94,7 @@ public:
* for compatibility with the pre-existing timestamp on the texture
* fetcher class, LLTextureFetch.
*/
typedef U64 duration_t;
typedef U64Microseconds duration_t;
/**
* Type for the region identifier used in stats. Currently uses

View File

@@ -69,7 +69,7 @@ public:
protected:
void recordMetrics()
{
if (mMetricsStartTime)
if (mMetricsStartTime.value())
{
// Okay, it appears this request was used for useful things. Record
// the expected dequeue and duration of request processing.
@@ -77,7 +77,7 @@ protected:
LLViewerAssetStatsFF::record_response_main(mType, false, false,
(LLViewerAssetStatsFF::get_timestamp()
- mMetricsStartTime));
mMetricsStartTime = 0;
mMetricsStartTime = (U32Seconds)0;
}
}
@@ -113,7 +113,7 @@ void LLViewerAssetStorage::storeAssetData(
bool is_priority,
bool store_local,
bool user_waiting,
F64 timeout)
F64Seconds timeout)
{
LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
LL_DEBUGS("AssetStorage") << "LLViewerAssetStorage::storeAssetData (legacy) " << tid << ":" << LLAssetType::lookup(asset_type)
@@ -238,7 +238,7 @@ void LLViewerAssetStorage::storeAssetData(
bool temp_file,
bool is_priority,
bool user_waiting,
F64 timeout)
F64Seconds timeout)
{
if(filename.empty())
{
@@ -302,6 +302,7 @@ void LLViewerAssetStorage::storeAssetData(
{
// LLAssetStorage metric: Zero size
reportMetric( asset_id, asset_type, filename, LLUUID::null, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file was zero length" );
fclose(fp);
}
else
{

View File

@@ -51,7 +51,7 @@ public:
bool is_priority = false,
bool store_local = false,
bool user_waiting=FALSE,
F64 timeout=LL_ASSET_STORAGE_TIMEOUT);
F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT);
virtual void storeAssetData(
const std::string& filename,
@@ -62,7 +62,7 @@ public:
bool temp_file = false,
bool is_priority = false,
bool user_waiting=FALSE,
F64 timeout=LL_ASSET_STORAGE_TIMEOUT);
F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT);
protected:
using LLAssetStorage::_queueDataRequest;

View File

@@ -119,8 +119,8 @@ BOOL LLViewerObject::sPulseEnabled(FALSE);
BOOL LLViewerObject::sUseSharedDrawables(FALSE); // TRUE
// sMaxUpdateInterpolationTime must be greater than sPhaseOutUpdateInterpolationTime
F64 LLViewerObject::sMaxUpdateInterpolationTime = 3.0; // For motion interpolation: after X seconds with no updates, don't predict object motion
F64 LLViewerObject::sPhaseOutUpdateInterpolationTime = 2.0; // For motion interpolation: after Y seconds with no updates, taper off motion prediction
F64Seconds LLViewerObject::sMaxUpdateInterpolationTime(3.0); // For motion interpolation: after X seconds with no updates, don't predict object motion
F64Seconds LLViewerObject::sPhaseOutUpdateInterpolationTime(2.0); // For motion interpolation: after Y seconds with no updates, taper off motion prediction
static LLFastTimer::DeclareTimer FTM_CREATE_OBJECT("Create Object");
@@ -244,7 +244,6 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
mOnMap(FALSE),
mStatic(FALSE),
mNumFaces(0),
mTimeDilation(1.f),
mRotTime(0.f),
mAngularVelocityRot(),
mPreviousRotation(),
@@ -975,11 +974,14 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
return retval;
}
F32 time_dilation = 1.f;
if(mesgsys != NULL)
{
U16 time_dilation16;
mesgsys->getU16Fast(_PREHASH_RegionData, _PREHASH_TimeDilation, time_dilation16);
F32 time_dilation = ((F32) time_dilation16) / 65535.f;
mTimeDilation = time_dilation;
time_dilation = ((F32) time_dilation16) / 65535.f;
mRegionp->setTimeDilation(time_dilation);
}
// this will be used to determine if we've really changed position
// Use getPosition, not getPositionRegion, since this is what we're comparing directly against.
@@ -1770,7 +1772,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(mesgsys->getSender());
if (cdp)
{
F32 ping_delay = 0.5f * mTimeDilation * ( ((F32)cdp->getPingDelay()) * 0.001f + gFrameDTClamped);
F32 ping_delay = 0.5f * time_dilation * ( ((F32)cdp->getPingDelay().valueInUnits<LLUnits::Seconds>()) + gFrameDTClamped);
LLVector3 diff = getVelocity() * ping_delay;
new_pos_parent += diff;
}
@@ -2168,39 +2170,38 @@ BOOL LLViewerObject::isActive() const
void LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
{
//static LLFastTimer::DeclareTimer ftm("Viewer Object");
//LLFastTimer t(ftm);
//static LLTrace::BlockTimerStatHandle ftm("Viewer Object");
//LL_RECORD_BLOCK_TIME(ftm);
if (!mDead)
{
// CRO - don't velocity interp linked objects!
// Leviathan - but DO velocity interp joints
if (!mStatic && sVelocityInterpolate && !isSelected())
{
// calculate dt from last update
F32 dt_raw = (F32)(time - mLastInterpUpdateSecs);
F32 dt = mTimeDilation * dt_raw;
if (!mStatic && sVelocityInterpolate && !isSelected())
{
// calculate dt from last update
F32 time_dilation = mRegionp ? mRegionp->getTimeDilation() : 1.0f;
F32 dt_raw = ((F64Seconds)time - mLastInterpUpdateSecs).value();
F32 dt = time_dilation * dt_raw;
applyAngularVelocity(dt);
if (isAttachment())
{
mLastInterpUpdateSecs = time;
{
mLastInterpUpdateSecs = (F64Seconds)time;
return;
}
else
{ // Move object based on it's velocity and rotation
interpolateLinearMotion(time, dt);
}
}
else
{ // Move object based on it's velocity and rotation
interpolateLinearMotion(time, dt);
}
updateDrawable(FALSE);
}
updateDrawable(FALSE);
}
}
// Move an object due to idle-time viewer side updates by iterpolating motion
void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt)
// Move an object due to idle-time viewer side updates by interpolating motion
void LLViewerObject::interpolateLinearMotion(const F64SecondsImplicit& time, const F32SecondsImplicit& dt_seconds)
{
// linear motion
// PHYSICS_TIMESTEP is used below to correct for the fact that the velocity in object
@@ -2211,8 +2212,9 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt)
// to see if object is selected, instead of explicitly
// zeroing it out
F64 time_since_last_update = time - mLastMessageUpdateSecs;
if (time_since_last_update <= 0.0 || dt <= 0.f)
F32 dt = dt_seconds;
F64Seconds time_since_last_update = time - mLastMessageUpdateSecs;
if (time_since_last_update <= (F64Seconds)0.0 || dt <= 0.f)
{
return;
}
@@ -2220,7 +2222,7 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt)
LLVector3 accel = getAcceleration();
LLVector3 vel = getVelocity();
if (sMaxUpdateInterpolationTime <= 0.0)
if (sMaxUpdateInterpolationTime <= (F64Seconds)0.0)
{ // Old code path ... unbounded, simple interpolation
if (!(accel.isExactlyZero() && vel.isExactlyZero()))
{
@@ -2242,8 +2244,8 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt)
LLVector3 new_v = accel * dt;
if (time_since_last_update > sPhaseOutUpdateInterpolationTime &&
sPhaseOutUpdateInterpolationTime > 0.0)
{ // Haven't seen a viewer update in a while, check to see if the ciruit is still active
sPhaseOutUpdateInterpolationTime > (F64Seconds)0.0)
{ // Haven't seen a viewer update in a while, check to see if the circuit is still active
if (mRegionp)
{ // The simulator will NOT send updates if the object continues normally on the path
// predicted by the velocity and the acceleration (often gravity) sent to the viewer
@@ -2252,14 +2254,14 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt)
if (cdp)
{
// Find out how many seconds since last packet arrived on the circuit
F64 time_since_last_packet = LLMessageSystem::getMessageTimeSeconds() - cdp->getLastPacketInTime();
F64Seconds time_since_last_packet = LLMessageSystem::getMessageTimeSeconds() - cdp->getLastPacketInTime();
if (!cdp->isAlive() || // Circuit is dead or blocked
cdp->isBlocked() || // or doesn't seem to be getting any packets
(time_since_last_packet > sPhaseOutUpdateInterpolationTime))
{
// Start to reduce motion interpolation since we haven't seen a server update in a while
F64 time_since_last_interpolation = time - mLastInterpUpdateSecs;
F64Seconds time_since_last_interpolation = time - mLastInterpUpdateSecs;
F64 phase_out = 1.0;
if (time_since_last_update > sMaxUpdateInterpolationTime)
{ // Past the time limit, so stop the object

View File

@@ -591,7 +591,7 @@ private:
U32 checkMediaURL(const std::string &media_url);
// Motion prediction between updates
void interpolateLinearMotion(const F64 & time, const F32 & dt);
void interpolateLinearMotion(const F64SecondsImplicit & time, const F32SecondsImplicit & dt);
public:
//
@@ -710,8 +710,6 @@ protected:
void deleteParticleSource();
void setParticleSource(const LLPartSysData& particle_parameters, const LLUUID& owner_id);
public:
private:
void setNameValueList(const std::string& list); // clears nv pairs and then individually adds \n separated NV pairs from \0 terminated string
void deleteTEImages(); // correctly deletes list of images
@@ -722,8 +720,8 @@ protected:
child_list_t mChildList;
F64 mLastInterpUpdateSecs; // Last update for purposes of interpolation
F64 mLastMessageUpdateSecs; // Last update from a message from the simulator
F64Seconds mLastInterpUpdateSecs; // Last update for purposes of interpolation
F64Seconds mLastMessageUpdateSecs; // Last update from a message from the simulator
TPACKETID mLatestRecvPacketID; // Latest time stamp on message from simulator
// extra data sent from the sim...currently only used for tree species info
@@ -765,7 +763,6 @@ protected:
BOOL mStatic; // Object doesn't move.
S32 mNumFaces;
F32 mTimeDilation; // Time dilation sent with the object.
F32 mRotTime; // Amount (in seconds) that object has rotated according to angular velocity (llSetTargetOmega)
LLQuaternion mAngularVelocityRot; // accumulated rotation from the angular velocity computations
LLQuaternion mPreviousRotation;
@@ -791,12 +788,13 @@ protected:
static S32 sAxisArrowLength;
// These two caches are only correct for non-parented objects right now!
mutable LLVector3 mPositionRegion;
mutable LLVector3 mPositionAgent;
static void setPhaseOutUpdateInterpolationTime(F32 value) { sPhaseOutUpdateInterpolationTime = (F64) value; }
static void setMaxUpdateInterpolationTime(F32 value) { sMaxUpdateInterpolationTime = (F64) value; }
static void setPhaseOutUpdateInterpolationTime(F32 value) { sPhaseOutUpdateInterpolationTime = (F64Seconds) value; }
static void setMaxUpdateInterpolationTime(F32 value) { sMaxUpdateInterpolationTime = (F64Seconds) value; }
static void setVelocityInterpolate(BOOL value) { sVelocityInterpolate = value; }
static void setPingInterpolate(BOOL value) { sPingInterpolate = value; }
@@ -804,8 +802,8 @@ protected:
private:
static S32 sNumObjects;
static F64 sPhaseOutUpdateInterpolationTime; // For motion interpolation
static F64 sMaxUpdateInterpolationTime; // For motion interpolation
static F64Seconds sPhaseOutUpdateInterpolationTime; // For motion interpolation
static F64Seconds sMaxUpdateInterpolationTime; // For motion interpolation
static BOOL sVelocityInterpolate;
static BOOL sPingInterpolate;

View File

@@ -502,14 +502,14 @@ void LLViewerRegion::initStats()
{
mImpl->mLastNetUpdate.reset();
mPacketsIn = 0;
mBitsIn = 0;
mLastBitsIn = 0;
mBitsIn = (U32Bits)0;
mLastBitsIn = (U32Bits)0;
mLastPacketsIn = 0;
mPacketsOut = 0;
mLastPacketsOut = 0;
mPacketsLost = 0;
mLastPacketsLost = 0;
mPingDelay = 0;
mPingDelay = (U32Seconds)0;
mAlive = false; // can become false if circuit disconnects
}
@@ -1129,7 +1129,7 @@ void LLViewerRegion::updateNetStats()
mPacketsLost = cdp->getPacketsLost();
mPingDelay = cdp->getPingDelay();
mBitStat.addValue(mBitsIn - mLastBitsIn);
mBitStat.addValue((mBitsIn - mLastBitsIn).value());
mPacketsStat.addValue(mPacketsIn - mLastPacketsIn);
mPacketsLostStat.addValue(mPacketsLost);
}

View File

@@ -445,14 +445,14 @@ private:
BOOL mIsEstateManager;
U32 mPacketsIn;
U32 mBitsIn;
U32 mLastBitsIn;
U32Bits mBitsIn,
mLastBitsIn;
U32 mLastPacketsIn;
U32 mPacketsOut;
U32 mLastPacketsOut;
S32 mPacketsLost;
S32 mLastPacketsLost;
U32 mPingDelay;
U32Milliseconds mPingDelay;
F32 mDeltaTime; // Time since last measurement of lastPackets, Bits, etc
U64 mRegionFlags; // includes damage flags

View File

@@ -639,8 +639,8 @@ void update_statistics()
LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(gAgent.getRegion()->getHost());
if (cdp)
{
stats.mSimPingStat.addValue(cdp->getPingDelay());
gAvgSimPing = F32Milliseconds(((gAvgSimPing.value() * (F32)gSimPingCount) + (F32)(cdp->getPingDelay())) / ((F32)gSimPingCount + 1));
stats.mSimPingStat.addValue(cdp->getPingDelay().value());
gAvgSimPing = ((gAvgSimPing * gSimPingCount) + cdp->getPingDelay()) / (gSimPingCount + 1);
gSimPingCount++;
}
else

View File

@@ -6089,7 +6089,7 @@ void LLVOAvatar::getGround(const LLVector3 &in_pos_agent, LLVector3 &out_pos_age
//-----------------------------------------------------------------------------
F32 LLVOAvatar::getTimeDilation()
{
return mTimeDilation;
return mRegionp ? mRegionp->getTimeDilation() : 1.f;
}