summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindra/llcommon/llmemory.cpp18
-rwxr-xr-xindra/llcommon/llmemory.h17
-rwxr-xr-xindra/llcommon/llsys.cpp24
-rwxr-xr-xindra/llcommon/llsys.h6
-rwxr-xr-xindra/llmessage/llassetstorage.cpp6
-rwxr-xr-xindra/llmessage/llassetstorage.h8
-rwxr-xr-xindra/llmessage/llcircuit.cpp157
-rwxr-xr-xindra/llmessage/llcircuit.h74
-rwxr-xr-xindra/llmessage/llhttpassetstorage.cpp2
-rwxr-xr-xindra/llmessage/llpacketack.cpp6
-rwxr-xr-xindra/llmessage/llpacketack.h9
-rwxr-xr-xindra/llmessage/llthrottle.cpp36
-rwxr-xr-xindra/llmessage/llthrottle.h6
-rwxr-xr-xindra/llmessage/lltransfermanager.cpp2
-rwxr-xr-xindra/llmessage/message.cpp44
-rwxr-xr-xindra/llmessage/message.h40
-rwxr-xr-xindra/llui/llscrolllistctrl.cpp2
-rwxr-xr-xindra/newview/llappviewer.cpp6
-rwxr-xr-xindra/newview/llappviewer.h2
-rwxr-xr-xindra/newview/llfloaterabout.cpp2
-rwxr-xr-xindra/newview/llfloaterhardwaresettings.cpp8
-rwxr-xr-xindra/newview/llinspect.cpp2
-rwxr-xr-xindra/newview/llstartup.cpp2
-rwxr-xr-xindra/newview/llviewercontrol.cpp2
-rwxr-xr-xindra/newview/llviewerdisplay.cpp4
-rwxr-xr-xindra/newview/llviewerobject.cpp8
-rwxr-xr-xindra/newview/llviewerobject.h6
-rwxr-xr-xindra/newview/llviewerregion.h8
-rwxr-xr-xindra/newview/llviewerstats.cpp10
-rwxr-xr-xindra/newview/llviewertexturelist.cpp63
-rwxr-xr-xindra/newview/llviewertexturelist.h8
31 files changed, 294 insertions, 294 deletions
diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp
index a9256124f2..c59b61471a 100755
--- a/indra/llcommon/llmemory.cpp
+++ b/indra/llcommon/llmemory.cpp
@@ -47,11 +47,11 @@
//static
char* LLMemory::reserveMem = 0;
-U32 LLMemory::sAvailPhysicalMemInKB = U32_MAX ;
-U32 LLMemory::sMaxPhysicalMemInKB = 0;
-U32 LLMemory::sAllocatedMemInKB = 0;
-U32 LLMemory::sAllocatedPageSizeInKB = 0 ;
-U32 LLMemory::sMaxHeapSizeInKB = U32_MAX ;
+U32Kibibytes LLMemory::sAvailPhysicalMemInKB(U32_MAX);
+U32Kibibytes LLMemory::sMaxPhysicalMemInKB(0);
+U32Kibibytes LLMemory::sAllocatedMemInKB(0);
+U32Kibibytes LLMemory::sAllocatedPageSizeInKB(0);
+U32Kibibytes LLMemory::sMaxHeapSizeInKB(U32_MAX);
BOOL LLMemory::sEnableMemoryFailurePrevention = FALSE;
#if __DEBUG_PRIVATE_MEM__
@@ -116,7 +116,7 @@ void LLMemory::updateMemoryInfo()
sAllocatedMemInKB = (U32)(counters.WorkingSetSize / 1024) ;
sAllocatedPageSizeInKB = (U32)(counters.PagefileUsage / 1024) ;
- U32 avail_phys, avail_virtual;
+ U32Kibibytes avail_phys, avail_virtual;
LLMemoryInfo::getAvailableMemoryKB(avail_phys, avail_virtual) ;
sMaxPhysicalMemInKB = llmin(avail_phys + sAllocatedMemInKB, sMaxHeapSizeInKB);
@@ -232,19 +232,19 @@ bool LLMemory::isMemoryPoolLow()
}
//static
-U32 LLMemory::getAvailableMemKB()
+U32Kibibytes LLMemory::getAvailableMemKB()
{
return sAvailPhysicalMemInKB ;
}
//static
-U32 LLMemory::getMaxMemKB()
+U32Kibibytes LLMemory::getMaxMemKB()
{
return sMaxPhysicalMemInKB ;
}
//static
-U32 LLMemory::getAllocatedMemKB()
+U32Kibibytes LLMemory::getAllocatedMemKB()
{
return sAllocatedMemInKB ;
}
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index a24d97576f..c45c7ed213 100755
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -27,6 +27,7 @@
#define LLMEMORY_H
#include "linden_common.h"
+#include "llunit.h"
#if !LL_WINDOWS
#include <stdint.h>
#endif
@@ -170,17 +171,17 @@ public:
static void logMemoryInfo(BOOL update = FALSE);
static bool isMemoryPoolLow();
- static U32 getAvailableMemKB() ;
- static U32 getMaxMemKB() ;
- static U32 getAllocatedMemKB() ;
+ static U32Kibibytes getAvailableMemKB() ;
+ static U32Kibibytes getMaxMemKB() ;
+ static U32Kibibytes getAllocatedMemKB() ;
private:
static char* reserveMem;
- static U32 sAvailPhysicalMemInKB ;
- static U32 sMaxPhysicalMemInKB ;
- static U32 sAllocatedMemInKB;
- static U32 sAllocatedPageSizeInKB ;
+ static U32Kibibytes sAvailPhysicalMemInKB ;
+ static U32Kibibytes sMaxPhysicalMemInKB ;
+ static U32Kibibytes sAllocatedMemInKB;
+ static U32Kibibytes sAllocatedPageSizeInKB ;
- static U32 sMaxHeapSizeInKB;
+ static U32Kibibytes sMaxHeapSizeInKB;
static BOOL sEnableMemoryFailurePrevention;
};
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index cad02f491a..8f7e60fb68 100755
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -832,7 +832,7 @@ LLMemoryInfo::LLMemoryInfo()
}
#if LL_WINDOWS
-static U32 LLMemoryAdjustKBResult(U32 inKB)
+static U32Kibibytes LLMemoryAdjustKBResult(U32Kibibytes inKB)
{
// Moved this here from llfloaterabout.cpp
@@ -843,16 +843,16 @@ static U32 LLMemoryAdjustKBResult(U32 inKB)
// returned from the GetMemoryStatusEx function. Here we keep the
// original adjustment from llfoaterabout.cpp until this can be
// fixed somehow.
- inKB += 1024;
+ inKB += U32Mibibytes(1);
return inKB;
}
#endif
-U32 LLMemoryInfo::getPhysicalMemoryKB() const
+U32Kibibytes LLMemoryInfo::getPhysicalMemoryKB() const
{
#if LL_WINDOWS
- return LLMemoryAdjustKBResult(mStatsMap["Total Physical KB"].asInteger());
+ return LLMemoryAdjustKBResult(U32Kibibytes(mStatsMap["Total Physical KB"].asInteger()));
#elif LL_DARWIN
// This might work on Linux as well. Someone check...
@@ -862,17 +862,17 @@ U32 LLMemoryInfo::getPhysicalMemoryKB() const
size_t len = sizeof(phys);
sysctl(mib, 2, &phys, &len, NULL, 0);
- return (U32)(phys >> 10);
+ return U32Bytes(phys);
#elif LL_LINUX
U64 phys = 0;
phys = (U64)(getpagesize()) * (U64)(get_phys_pages());
- return (U32)(phys >> 10);
+ return U32Bytes(phys);
#elif LL_SOLARIS
U64 phys = 0;
phys = (U64)(getpagesize()) * (U64)(sysconf(_SC_PHYS_PAGES));
- return (U32)(phys >> 10);
+ return U32Bytes(phys);
#else
return 0;
@@ -880,24 +880,24 @@ U32 LLMemoryInfo::getPhysicalMemoryKB() const
#endif
}
-U32 LLMemoryInfo::getPhysicalMemoryClamped() const
+U32Bytes LLMemoryInfo::getPhysicalMemoryClamped() const
{
// Return the total physical memory in bytes, but clamp it
// to no more than U32_MAX
- U32 phys_kb = getPhysicalMemoryKB();
+ U32Bytes phys_kb = getPhysicalMemoryKB();
if (phys_kb >= 4194304 /* 4GB in KB */)
{
- return U32_MAX;
+ return U32Bytes(U32_MAX);
}
else
{
- return phys_kb << 10;
+ return phys_kb;
}
}
//static
-void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb)
+void LLMemoryInfo::getAvailableMemoryKB(U32Kibibytes& avail_physical_mem_kb, U32Kibibytes& avail_virtual_mem_kb)
{
#if LL_WINDOWS
// Sigh, this shouldn't be a static method, then we wouldn't have to
diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h
index aa60fc9b2e..ad4f243d05 100755
--- a/indra/llcommon/llsys.h
+++ b/indra/llcommon/llsys.h
@@ -112,15 +112,15 @@ public:
LLMemoryInfo(); ///< Default constructor
void stream(std::ostream& s) const; ///< output text info to s
- U32 getPhysicalMemoryKB() const; ///< Memory size in KiloBytes
+ U32Kibibytes getPhysicalMemoryKB() const;
/*! Memory size in bytes, if total memory is >= 4GB then U32_MAX will
** be returned.
*/
- U32 getPhysicalMemoryClamped() const; ///< Memory size in clamped bytes
+ U32Bytes getPhysicalMemoryClamped() const; ///< Memory size in clamped bytes
//get the available memory infomation in KiloBytes.
- static void getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb);
+ static void getAvailableMemoryKB(U32Kibibytes& avail_physical_mem_kb, U32Kibibytes& avail_virtual_mem_kb);
// Retrieve a map of memory statistics. The keys of the map are platform-
// dependent. The values are in kilobytes to try to avoid integer overflow.
diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp
index fe97501658..413266a29d 100755
--- a/indra/llmessage/llassetstorage.cpp
+++ b/indra/llmessage/llassetstorage.cpp
@@ -194,8 +194,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();
@@ -341,7 +341,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;
diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h
index 6ffd7ad309..6ed1027cee 100755
--- a/indra/llmessage/llassetstorage.h
+++ b/indra/llmessage/llassetstorage.h
@@ -119,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;
@@ -163,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;
@@ -193,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;
diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp
index 00e9266d47..1ace4d9b70 100755
--- a/indra/llmessage/llcircuit.cpp
+++ b/indra/llmessage/llcircuit.cpp
@@ -60,12 +60,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),
@@ -84,7 +84,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),
@@ -110,13 +110,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();
@@ -268,7 +268,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;
@@ -355,7 +355,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
{
@@ -427,10 +427,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()
{
@@ -521,17 +522,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;
@@ -541,7 +542,7 @@ void LLCircuitData::checkPeriodTime()
mBytesOutLastPeriod = mBytesOutThisPeriod;
mBytesInThisPeriod = 0;
mBytesOutThisPeriod = 0;
- mLastPeriodLength = (F32)period_length;
+ mLastPeriodLength = period_length;
mPeriodTime = mt_sec;
}
@@ -584,7 +585,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;
@@ -726,7 +727,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))
@@ -742,7 +743,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
}
// LL_INFOS() << "adding potential lost: " << index << LL_ENDL;
- mPotentialLostPackets[index] = time;
+ mPotentialLostPackets[index] = time.value();
index++;
index = index % LL_MAX_OUT_PACKET_ID;
gap_count++;
@@ -780,7 +781,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;
@@ -818,7 +819,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.
@@ -846,7 +847,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())
@@ -963,12 +964,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!
@@ -1014,7 +1015,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);
@@ -1025,8 +1026,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
@@ -1043,7 +1044,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)
@@ -1139,40 +1140,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 << " Packets Lost: " << circuit.mPacketsLost;
- s << " Measured Ping: " << circuit.mPingDelay;
- s << " Averaged Ping: " << circuit.mPingDelayAveraged;
- s << 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 << "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 << "Circuit " << circuit.mHost << " "
+ << circuit.mRemoteID << " "
+ << (circuit.mbAlive ? "Alive" : "Not Alive") << " "
+ << (circuit.mbAllowTimeout ? "Timeout Allowed" : "Timeout Not Allowed")
+ << endl;
+
+ s << " Packets Lost: " << circuit.mPacketsLost
+ << " Measured Ping: " << circuit.mPingDelay
+ << " Averaged Ping: " << circuit.mPingDelayAveraged
+ << endl;
+
+ s << "Global In/Out " << S32(age) << " sec"
+ << " KBytes: " << circuit.mBytesIn.valueInUnits<LLUnits::Kibibytes>() << "/" << circuit.mBytesOut.valueInUnits<LLUnits::Kibibytes>()
+ << " Kbps: "
+ << S32(circuit.mBytesIn.valueInUnits<LLUnits::Kibibits>() / circuit.mExistenceTimer.getElapsedTimeF32().value())
+ << "/"
+ << S32(circuit.mBytesOut.valueInUnits<LLUnits::Kibibits>() / circuit.mExistenceTimer.getElapsedTimeF32().value())
+ << " Packets: " << circuit.mPacketsIn << "/" << circuit.mPacketsOut
+ << endl;
+
+ s << "Recent In/Out " << circuit.mLastPeriodLength
+ << " KBytes: "
+ << circuit.mBytesInLastPeriod.valueInUnits<LLUnits::Kibibytes>()
+ << "/"
+ << circuit.mBytesOutLastPeriod.valueInUnits<LLUnits::Kibibytes>()
+ << " Kbps: "
+ << (S32)(circuit.mBytesInLastPeriod.valueInUnits<LLUnits::Kibibits>() / circuit.mLastPeriodLength.value())
+ << "/"
+ << (S32)(circuit.mBytesOutLastPeriod.valueInUnits<LLUnits::Kibibits>() / circuit.mLastPeriodLength.value())
+ << " Peak kbps: "
+ << S32(circuit.mPeakBPSIn / 1024.f)
+ << "/"
+ << S32(circuit.mPeakBPSOut / 1024.f)
+ << endl;
return s;
}
@@ -1256,10 +1257,10 @@ 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;
+ F64Seconds time = mt_secs - mPingTime;
if (time == 0.0)
{
// Ack, we got our ping response on the same frame! Sigh, let's get a real time otherwise
@@ -1276,7 +1277,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;
@@ -1305,13 +1306,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;
}
@@ -1353,41 +1354,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 - 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);
}
diff --git a/indra/llmessage/llcircuit.h b/indra/llmessage/llcircuit.h
index 11d4e1b11c..bc29805859 100755
--- a/indra/llmessage/llcircuit.h
+++ b/indra/llmessage/llcircuit.h
@@ -44,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;
@@ -77,10 +77,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);
@@ -106,18 +106,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;
@@ -125,10 +125,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; }
@@ -164,7 +164,7 @@ 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);
@@ -219,20 +219,20 @@ 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;
@@ -247,7 +247,7 @@ protected:
S32 mUnackedPacketCount;
S32 mUnackedPacketBytes;
- F64 mLastPacketInTime; // Time of last packet arrival
+ F64Seconds mLastPacketInTime; // Time of last packet arrival
LLUUID mLocalEndPointID;
@@ -259,24 +259,24 @@ protected:
U32 mPacketsOut;
U32 mPacketsIn;
S32 mPacketsLost;
- S32 mBytesIn;
- S32 mBytesOut;
-
- F32 mLastPeriodLength; // seconds
- S32 mBytesInLastPeriod;
- S32 mBytesOutLastPeriod;
- S32 mBytesInThisPeriod;
- S32 mBytesOutThisPeriod;
+ S32Bytes mBytesIn,
+ mBytesOut;
+
+ 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;
};
@@ -286,7 +286,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
@@ -341,7 +341,7 @@ protected:
mutable LLCircuitData* mLastCircuit;
private:
- const F32 mHeartbeatInterval;
- const F32 mHeartbeatTimeout;
+ const F32Seconds mHeartbeatInterval;
+ const F32Seconds mHeartbeatTimeout;
};
#endif
diff --git a/indra/llmessage/llhttpassetstorage.cpp b/indra/llmessage/llhttpassetstorage.cpp
index 0479f0fd32..d9b537941b 100755
--- a/indra/llmessage/llhttpassetstorage.cpp
+++ b/indra/llmessage/llhttpassetstorage.cpp
@@ -1064,7 +1064,7 @@ void LLHTTPAssetStorage::bumpTimedOutUploads()
{
bool user_waiting=FALSE;
- F64 mt_secs = LLMessageSystem::getMessageTimeSeconds();
+ F64Seconds mt_secs = LLMessageSystem::getMessageTimeSeconds();
if (mPendingUploads.size())
{
diff --git a/indra/llmessage/llpacketack.cpp b/indra/llmessage/llpacketack.cpp
index f08d3404ea..c3c022c297 100755
--- a/indra/llmessage/llpacketack.cpp
+++ b/indra/llmessage/llpacketack.cpp
@@ -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;
diff --git a/indra/llmessage/llpacketack.h b/indra/llmessage/llpacketack.h
index 2ef3c48e44..0a5604f74f 100755
--- a/indra/llmessage/llpacketack.h
+++ b/indra/llmessage/llpacketack.h
@@ -28,6 +28,7 @@
#define LL_LLPACKETACK_H
#include "llhost.h"
+#include "llunit.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;
@@ -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
diff --git a/indra/llmessage/llthrottle.cpp b/indra/llmessage/llthrottle.cpp
index 181c594205..00eaa7e2ec 100755
--- a/indra/llmessage/llthrottle.cpp
+++ b/indra/llmessage/llthrottle.cpp
@@ -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)
{
@@ -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)
diff --git a/indra/llmessage/llthrottle.h b/indra/llmessage/llthrottle.h
index ed0aeb4602..e43e54f61b 100755
--- a/indra/llmessage/llthrottle.h
+++ b/indra/llmessage/llthrottle.h
@@ -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.
};
diff --git a/indra/llmessage/lltransfermanager.cpp b/indra/llmessage/lltransfermanager.cpp
index e647df1c11..71be13ab18 100755
--- a/indra/llmessage/lltransfermanager.cpp
+++ b/indra/llmessage/lltransfermanager.cpp
@@ -815,7 +815,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
diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp
index 2b377670f1..1f4dd11f73 100755
--- a/indra/llmessage/message.cpp
+++ b/indra/llmessage/message.cpp
@@ -238,7 +238,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)
{
init();
@@ -303,11 +303,11 @@ 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;
@@ -531,7 +531,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();
}
@@ -758,7 +758,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)
{
@@ -789,7 +789,7 @@ S32 LLMessageSystem::getReceiveBytes() const
void LLMessageSystem::processAcks()
{
- F64 mt_sec = getMessageTimeSeconds();
+ F64Seconds mt_sec = getMessageTimeSeconds();
{
gTransferManager.updateTransfers();
@@ -836,7 +836,7 @@ void LLMessageSystem::processAcks()
if (mMaxMessageTime >= 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;
@@ -1010,13 +1010,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
{
@@ -1032,7 +1032,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)
{
@@ -1041,11 +1041,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));
}
}
@@ -1077,7 +1077,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)
{
@@ -1087,13 +1087,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
{
@@ -3389,15 +3389,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
{
@@ -3406,19 +3406,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());
}
}
diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h
index af0eb109e3..75eccc7f75 100755
--- a/indra/llmessage/message.h
+++ b/indra/llmessage/message.h
@@ -142,18 +142,14 @@ 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;
-
-// *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 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);
+
+const F32 LL_SEMIRELIABLE_TIMEOUT_FACTOR = 5.f; // averaged ping
+const F32 LL_RELIABLE_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;
@@ -270,7 +266,7 @@ public:
BOOL mSendReliable; // does the outgoing message require a pos ack?
LLCircuit mCircuitInfo;
- F64 mCircuitPrintTime; // used to print circuit debug info every couple minutes
+ F64Seconds mCircuitPrintTime; // used to print circuit debug info every couple minutes
F32 mCircuitPrintFreq; // seconds
std::map<U64, U32> mIPPortToCircuitCode;
@@ -469,7 +465,7 @@ public:
S32 sendReliable( const LLHost &host,
S32 retries,
BOOL ping_based_retries,
- F32 timeout,
+ F32Seconds timeout,
void (*callback)(void **,S32),
void ** callback_data);
@@ -489,7 +485,7 @@ public:
const LLHost &host,
S32 retries,
BOOL ping_based_timeout,
- F32 timeout,
+ F32Seconds timeout,
void (*callback)(void **,S32),
void ** callback_data);
@@ -683,8 +679,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);
@@ -783,16 +779,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;
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index f335b5dec3..224c2b918d 100755
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -1443,7 +1443,7 @@ void LLScrollListCtrl::drawItems()
LLColor4 highlight_color = LLColor4::white;
static LLUICachedControl<F32> type_ahead_timeout ("TypeAheadTimeout", 0);
- highlight_color.mV[VALPHA] = clamp_rescale(mSearchTimer.getElapsedTimeF32(), type_ahead_timeout * 0.7f, type_ahead_timeout, 0.4f, 0.f);
+ highlight_color.mV[VALPHA] = clamp_rescale(mSearchTimer.getElapsedTimeF32(), type_ahead_timeout * 0.7f, type_ahead_timeout(), 0.4f, 0.f);
S32 first_line = mScrollLines;
S32 last_line = llmin((S32)mItemList.size() - 1, mScrollLines + getLinesPerPage());
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 0a1a78c5b4..339a8f1ab0 100755
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -324,7 +324,7 @@ BOOL gUseWireframe = FALSE;
LLVFS* gStaticVFS = NULL;
LLMemoryInfo gSysMemory;
-U64 gMemoryAllocated = 0; // updated in display_stats() in llviewerdisplay.cpp
+U64Bytes gMemoryAllocated(0); // updated in display_stats() in llviewerdisplay.cpp
std::string gLastVersionChannel;
@@ -3329,8 +3329,8 @@ void LLAppViewer::writeSystemInfo()
gDebugInfo["CPUInfo"]["CPUSSE"] = gSysCPU.hasSSE();
gDebugInfo["CPUInfo"]["CPUSSE2"] = gSysCPU.hasSSE2();
- gDebugInfo["RAMInfo"]["Physical"] = (LLSD::Integer)(gSysMemory.getPhysicalMemoryKB());
- gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer)(gMemoryAllocated>>10); // MB -> KB
+ gDebugInfo["RAMInfo"]["Physical"] = (LLSD::Integer)(gSysMemory.getPhysicalMemoryKB().value());
+ gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer)(gMemoryAllocated.valueInUnits<LLUnits::Kibibytes>());
gDebugInfo["OSInfo"] = getOSInfo().getOSStringSimple();
// The user is not logged on yet, but record the current grid choice login url
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 60a1045f58..10452e64e2 100755
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -367,7 +367,7 @@ class LLVFS;
extern LLVFS *gStaticVFS;
extern LLMemoryInfo gSysMemory;
-extern U64 gMemoryAllocated;
+extern U64Bytes gMemoryAllocated;
extern std::string gLastVersionChannel;
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index 84f0d115ae..ad94949863 100755
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -259,7 +259,7 @@ LLSD LLFloaterAbout::getInfo()
// CPU
info["CPU"] = gSysCPU.getCPUString();
- info["MEMORY_MB"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB() / 1024);
+ info["MEMORY_MB"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB().valueInUnits<LLUnits::Mibibytes>());
// Moved hack adjustment to Windows memory size into llsys.cpp
info["OS_VERSION"] = LLAppViewer::instance()->getOSInfo().getOSString();
info["GRAPHICS_CARD_VENDOR"] = (const char*)(glGetString(GL_VENDOR));
diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp
index 116bd241c4..adb490d524 100755
--- a/indra/newview/llfloaterhardwaresettings.cpp
+++ b/indra/newview/llfloaterhardwaresettings.cpp
@@ -89,10 +89,10 @@ void LLFloaterHardwareSettings::refresh()
void LLFloaterHardwareSettings::refreshEnabledState()
{
- S32 min_tex_mem = LLViewerTextureList::getMinVideoRamSetting();
- S32 max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting();
- getChild<LLSliderCtrl>("GraphicsCardTextureMemory")->setMinValue(min_tex_mem);
- getChild<LLSliderCtrl>("GraphicsCardTextureMemory")->setMaxValue(max_tex_mem);
+ S32Mibibytes min_tex_mem = LLViewerTextureList::getMinVideoRamSetting();
+ S32Mibibytes max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting();
+ getChild<LLSliderCtrl>("GraphicsCardTextureMemory")->setMinValue(min_tex_mem.value());
+ getChild<LLSliderCtrl>("GraphicsCardTextureMemory")->setMaxValue(max_tex_mem.value());
if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") ||
!gGLManager.mHasVertexBufferObject)
diff --git a/indra/newview/llinspect.cpp b/indra/newview/llinspect.cpp
index 14382e82d7..e6cb068613 100755
--- a/indra/newview/llinspect.cpp
+++ b/indra/newview/llinspect.cpp
@@ -59,7 +59,7 @@ void LLInspect::draw()
}
else if (mCloseTimer.getStarted())
{
- F32 alpha = clamp_rescale(mCloseTimer.getElapsedTimeF32(), 0.f, FADE_TIME, 1.f, 0.f);
+ F32 alpha = clamp_rescale(mCloseTimer.getElapsedTimeF32(), 0.f, FADE_TIME(), 1.f, 0.f);
LLViewDrawContext context(alpha);
LLFloater::draw();
if (mCloseTimer.getElapsedTimeF32() > FADE_TIME)
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 61def8f723..fdd289c823 100755
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -1507,7 +1507,7 @@ bool idle_startup()
gFirstSim,
gSavedSettings.getS32("UseCircuitCodeMaxRetries"),
FALSE,
- gSavedSettings.getF32("UseCircuitCodeTimeout"),
+ (F32Seconds)gSavedSettings.getF32("UseCircuitCodeTimeout"),
use_circuit_callback,
NULL);
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 5523b541a9..d0491450dc 100755
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -287,7 +287,7 @@ static bool handleMaxPartCountChanged(const LLSD& newvalue)
static bool handleVideoMemoryChanged(const LLSD& newvalue)
{
- gTextureList.updateMaxResidentTexMem(newvalue.asInteger());
+ gTextureList.updateMaxResidentTexMem(S32Mibibytes(newvalue.asInteger()));
return true;
}
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 965c6ffbc6..cb5078b988 100755
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -221,8 +221,8 @@ void display_stats()
if (mem_log_freq > 0.f && gRecentMemoryTime.getElapsedTimeF32() >= mem_log_freq)
{
gMemoryAllocated = LLMemory::getCurrentRSS();
- U32 memory = (U32)(gMemoryAllocated / (1024*1024));
- LL_INFOS() << llformat("MEMORY: %d MB", memory) << LL_ENDL;
+ U32Mibibytes memory = gMemoryAllocated;
+ LL_INFOS() << llformat("MEMORY: %d MB", memory.value()) << LL_ENDL;
LLMemory::logMemoryInfo(TRUE) ;
gRecentMemoryTime.reset();
}
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 3d75f86154..b054e519e0 100755
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -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
std::map<std::string, U32> LLViewerObject::sObjectDataMap;
@@ -2190,7 +2190,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 * mTimeDilation * ( ((F32)cdp->getPingDelay().valueInUnits<LLUnits::Seconds>()) + gFrameDTClamped);
LLVector3 diff = getVelocity() * ping_delay;
new_pos_parent += diff;
}
@@ -2491,7 +2491,7 @@ 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
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index 5556a4c7d3..3943709049 100755
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -780,7 +780,7 @@ protected:
mutable LLVector3 mPositionRegion;
mutable LLVector3 mPositionAgent;
- static void setPhaseOutUpdateInterpolationTime(F32 value) { sPhaseOutUpdateInterpolationTime = (F64) value; }
+ static void setPhaseOutUpdateInterpolationTime(F32 value) { sPhaseOutUpdateInterpolationTime = (F64Seconds) value; }
static void setMaxUpdateInterpolationTime(F32 value) { sMaxUpdateInterpolationTime = (F64) value; }
static void setVelocityInterpolate(BOOL value) { sVelocityInterpolate = value; }
@@ -789,8 +789,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;
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index 9d2a333b1b..e07c2aa8d0 100755
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -401,7 +401,7 @@ public:
LLWind mWind;
LLViewerParcelOverlay *mParcelOverlay;
- F32 mBitsReceived;
+ F32Bits mBitsReceived;
F32 mPacketsReceived;
LLMatrix4 mRenderMatrix;
@@ -436,14 +436,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
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index 67005e1978..bb2c13df33 100755
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -304,8 +304,8 @@ U32Bytes gTotalWorldData,
gTotalTextureData;
U32 gSimPingCount = 0;
U32Bits gObjectData;
-F32 gAvgSimPing = 0.f;
-U32Bytes gTotalTextureBytesPerBoostLevel[LLViewerTexture::MAX_GL_IMAGE_CATEGORY] = {U32Bytes(0)};
+F32Milliseconds gAvgSimPing(0.f);
+U32Bytes gTotalTextureBytesPerBoostLevel[LLViewerTexture::MAX_GL_IMAGE_CATEGORY] = {U32Bytes(0)};
extern U32 gVisCompared;
extern U32 gVisTested;
@@ -359,7 +359,7 @@ void update_statistics()
if (cdp)
{
sample(LLStatViewer::SIM_PING, F64Milliseconds (cdp->getPingDelay()));
- gAvgSimPing = ((gAvgSimPing * (F32)gSimPingCount) + (F32)(cdp->getPingDelay())) / ((F32)gSimPingCount + 1);
+ gAvgSimPing = ((gAvgSimPing * (F32)gSimPingCount) + (F32)(cdp->getPingDelay().value())) / ((F32)gSimPingCount + 1);
gSimPingCount++;
}
else
@@ -494,14 +494,14 @@ void send_stats()
gSimFrames = (F32) gFrameCount;
agent["agents_in_view"] = LLVOAvatar::sNumVisibleAvatars;
- agent["ping"] = gAvgSimPing;
+ agent["ping"] = gAvgSimPing.value();
agent["meters_traveled"] = gAgent.getDistanceTraveled();
agent["regions_visited"] = gAgent.getRegionsVisited();
agent["mem_use"] = LLMemory::getCurrentRSS() / 1024.0;
LLSD &system = body["system"];
- system["ram"] = (S32) gSysMemory.getPhysicalMemoryKB();
+ system["ram"] = (S32) gSysMemory.getPhysicalMemoryKB().value();
system["os"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
system["cpu"] = gSysCPU.getCPUString();
unsigned char MACAddress[MAC_ADDRESS_BYTES];
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 888174a6cf..f4dc04bd51 100755
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -89,7 +89,7 @@ void LLViewerTextureList::init()
mMaxTotalTextureMemInMegaBytes = 0 ;
// Update how much texture RAM we're allowed to use.
- updateMaxResidentTexMem(0); // 0 = use current
+ updateMaxResidentTexMem(S32Mibibytes(0)); // 0 = use current
doPreloadImages();
}
@@ -1231,28 +1231,28 @@ const S32 MIN_VIDEO_RAM = 32;
const S32 MAX_VIDEO_RAM = 512; // 512MB max for performance reasons.
// Returns min setting for TextureMemory (in MB)
-S32 LLViewerTextureList::getMinVideoRamSetting()
+S32Mibibytes LLViewerTextureList::getMinVideoRamSetting()
{
- S32 system_ram = (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped());
+ S32Mibibytes system_ram = gSysMemory.getPhysicalMemoryClamped();
//min texture mem sets to 64M if total physical mem is more than 1.5GB
- return (system_ram > 1500) ? 64 : gMinVideoRam.value() ;
+ return (system_ram > S32Mibibytes(1500)) ? S32Mibibytes(64) : gMinVideoRam ;
}
//static
// Returns max setting for TextureMemory (in MB)
-S32 LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended)
+S32Mibibytes LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended)
{
- S32 max_texmem;
+ S32Mibibytes max_texmem;
if (gGLManager.mVRAM != 0)
{
// Treat any card with < 32 MB (shudder) as having 32 MB
// - it's going to be swapping constantly regardless
- S32 max_vram = gGLManager.mVRAM;
+ S32Mibibytes max_vram(gGLManager.mVRAM);
if(gGLManager.mIsATI)
{
//shrink the availabe vram for ATI cards because some of them do not handel texture swapping well.
- max_vram = (S32)(max_vram * 0.75f);
+ max_vram = max_vram * 0.75f;
}
max_vram = llmax(max_vram, getMinVideoRamSetting());
@@ -1278,26 +1278,26 @@ S32 LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended)
LL_WARNS() << "VRAM amount not detected, defaulting to " << max_texmem << " MB" << LL_ENDL;
}
- S32 system_ram = (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped()); // In MB
+ S32Mibibytes system_ram = gSysMemory.getPhysicalMemoryClamped(); // In MB
//LL_INFOS() << "*** DETECTED " << system_ram << " MB of system memory." << LL_ENDL;
if (get_recommended)
- max_texmem = llmin(max_texmem, (S32)(system_ram/2));
+ max_texmem = llmin(max_texmem, system_ram/2);
else
- max_texmem = llmin(max_texmem, (S32)(system_ram));
+ max_texmem = llmin(max_texmem, system_ram);
- max_texmem = llclamp(max_texmem, getMinVideoRamSetting(), gMaxVideoRam.value());
+ max_texmem = llclamp(max_texmem, getMinVideoRamSetting(), gMaxVideoRam);
return max_texmem;
}
-const S32 VIDEO_CARD_FRAMEBUFFER_MEM = 12; // MB
-const S32 MIN_MEM_FOR_NON_TEXTURE = 512 ; //MB
-void LLViewerTextureList::updateMaxResidentTexMem(S32 mem)
+const S32Mibibytes VIDEO_CARD_FRAMEBUFFER_MEM(12);
+const S32Mibibytes MIN_MEM_FOR_NON_TEXTURE(512);
+void LLViewerTextureList::updateMaxResidentTexMem(S32Mibibytes mem)
{
// Initialize the image pipeline VRAM settings
- S32 cur_mem = gSavedSettings.getS32("TextureMemory");
+ S32Mibibytes cur_mem(gSavedSettings.getS32("TextureMemory"));
F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple");
- S32 default_mem = getMaxVideoRamSetting(true); // recommended default
+ S32Mibibytes default_mem(getMaxVideoRamSetting(true)); // recommended default
if (mem == 0)
{
mem = cur_mem > 0 ? cur_mem : default_mem;
@@ -1308,20 +1308,20 @@ void LLViewerTextureList::updateMaxResidentTexMem(S32 mem)
}
// limit the texture memory to a multiple of the default if we've found some cards to behave poorly otherwise
- mem = llmin(mem, (S32) (mem_multiplier * (F32) default_mem));
+ mem = llmin(mem, S32Mibibytes(mem_multiplier * (F32Mibibytes)default_mem));
mem = llclamp(mem, getMinVideoRamSetting(), getMaxVideoRamSetting());
if (mem != cur_mem)
{
- gSavedSettings.setS32("TextureMemory", mem);
+ gSavedSettings.setS32("TextureMemory", mem.value());
return; //listener will re-enter this function
}
// TODO: set available resident texture mem based on use by other subsystems
// currently max(12MB, VRAM/4) assumed...
- S32 vb_mem = mem;
- S32 fb_mem = llmax(VIDEO_CARD_FRAMEBUFFER_MEM, vb_mem/4);
+ S32Mibibytes vb_mem = mem;
+ S32Mibibytes fb_mem = llmax(VIDEO_CARD_FRAMEBUFFER_MEM, vb_mem/4);
mMaxResidentTexMemInMegaBytes = (vb_mem - fb_mem) ; //in MB
mMaxTotalTextureMemInMegaBytes = mMaxResidentTexMemInMegaBytes * 2;
@@ -1331,12 +1331,12 @@ void LLViewerTextureList::updateMaxResidentTexMem(S32 mem)
}
//system mem
- S32 system_ram = (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped()); // In MB
+ S32Mibibytes system_ram = gSysMemory.getPhysicalMemoryClamped();
//minimum memory reserved for non-texture use.
//if system_raw >= 1GB, reserve at least 512MB for non-texture use;
//otherwise reserve half of the system_ram for non-texture use.
- S32 min_non_texture_mem = llmin(system_ram / 2, MIN_MEM_FOR_NON_TEXTURE) ;
+ S32Mibibytes min_non_texture_mem = llmin(system_ram / 2, MIN_MEM_FOR_NON_TEXTURE) ;
if (mMaxTotalTextureMemInMegaBytes > system_ram - min_non_texture_mem)
{
@@ -1514,18 +1514,19 @@ void LLViewerTextureList::processImageNotInDatabase(LLMessageSystem *msg,void **
///////////////////////////////////////////////////////////////////////////////
//static
-const U32 SIXTEEN_MEG = 0x1000000;
-S32 LLViewerTextureList::calcMaxTextureRAM()
+const LLUnitImplicit<F32, LLUnits::Mibibytes> SIXTEEN_MEG(16);
+S32Bytes LLViewerTextureList::calcMaxTextureRAM()
{
// Decide the maximum amount of RAM we should allow the user to allocate to texture cache
LLMemoryInfo memory_info;
- U32 available_memory = memory_info.getPhysicalMemoryClamped();
+ LLUnitImplicit<F32, LLUnits::Mibibytes> available_memory = memory_info.getPhysicalMemoryClamped();
- clamp_rescale((F32)available_memory,
- (F32)(SIXTEEN_MEG * 16),
- (F32)U32_MAX,
- (F32)(SIXTEEN_MEG * 4),
- (F32)(U32_MAX >> 1));
+ // as originally written, this code was a no-op. Not sure of the side effect of making it actually work
+ /*clamp_rescale(available_memory.value(),
+ (SIXTEEN_MEG * 16),
+ (F32Mibibytes)U32_MAX,
+ (SIXTEEN_MEG * 4),
+ (F32Mibibytes)(U32_MAX >> 1));*/
return available_memory;
}
diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h
index 53bda6e6ab..9817fea811 100755
--- a/indra/newview/llviewertexturelist.h
+++ b/indra/newview/llviewertexturelist.h
@@ -71,7 +71,7 @@ public:
static BOOL createUploadFile(const std::string& filename, const std::string& out_filename, const U8 codec);
static LLPointer<LLImageJ2C> convertToUploadFile(LLPointer<LLImageRaw> raw_image);
static void processImageNotInDatabase( LLMessageSystem *msg, void **user_data );
- static S32 calcMaxTextureRAM();
+ static S32Bytes calcMaxTextureRAM();
static void receiveImageHeader(LLMessageSystem *msg, void **user_data);
static void receiveImagePacket(LLMessageSystem *msg, void **user_data);
@@ -105,7 +105,7 @@ public:
S32Mibibytes getMaxTotalTextureMem() const { return mMaxTotalTextureMemInMegaBytes;}
S32 getNumImages() { return mImageList.size(); }
- void updateMaxResidentTexMem(S32 mem);
+ void updateMaxResidentTexMem(S32Mibibytes mem);
void doPreloadImages();
void doPrefetchImages();
@@ -113,8 +113,8 @@ public:
void clearFetchingRequests();
void setDebugFetching(LLViewerFetchedTexture* tex, S32 debug_level);
- static S32 getMinVideoRamSetting();
- static S32 getMaxVideoRamSetting(bool get_recommended = false);
+ static S32Mibibytes getMinVideoRamSetting();
+ static S32Mibibytes getMaxVideoRamSetting(bool get_recommended = false);
private:
void updateImagesDecodePriorities();