From 1a44e5b3e93c80bc09ae5ea0a3f600658d51324e Mon Sep 17 00:00:00 2001 From: Thickbrick Sleaford Date: Wed, 15 Jun 2011 21:19:12 +0300 Subject: FIX STORM-1325 Retry bake uploads in case of upload failure --- indra/newview/llassetuploadresponders.cpp | 2 +- indra/newview/llassetuploadresponders.h | 1 + indra/newview/lltexlayer.cpp | 87 +++++++++++++++++++++---------- indra/newview/lltexlayer.h | 6 ++- 4 files changed, 66 insertions(+), 30 deletions(-) diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index c08771c5e7..e1d3de8409 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -449,7 +449,7 @@ void LLSendTexLayerResponder::uploadComplete(const LLSD& content) std::string result = content["state"]; LLUUID new_id = content["new_asset"]; - llinfos << "result: " << result << "new_id:" << new_id << llendl; + llinfos << "result: " << result << " new_id: " << new_id << llendl; if (result == "complete" && mBakedUploadData != NULL) { // Invoke diff --git a/indra/newview/llassetuploadresponders.h b/indra/newview/llassetuploadresponders.h index 70871b62e2..381b919c4a 100644 --- a/indra/newview/llassetuploadresponders.h +++ b/indra/newview/llassetuploadresponders.h @@ -112,6 +112,7 @@ private: struct LLBakedUploadData; class LLSendTexLayerResponder : public LLAssetUploadResponder { + LOG_CLASS(LLSendTexLayerResponder); public: LLSendTexLayerResponder(const LLSD& post_data, const LLUUID& vfile_id, diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index 500c2a7b86..bd41aa64f0 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -51,6 +51,9 @@ using namespace LLVOAvatarDefines; +static const S32 BAKE_UPLOAD_ATTEMPTS = 7; +static const F32 BAKE_UPLOAD_RETRY_DELAY = 2.f; // actual delay grows by power of 2 each attempt + class LLTexLayerInfo { friend class LLTexLayer; @@ -93,11 +96,13 @@ private: //----------------------------------------------------------------------------- LLBakedUploadData::LLBakedUploadData(const LLVOAvatarSelf* avatar, LLTexLayerSet* layerset, - const LLUUID& id) : + const LLUUID& id, + bool highest_res) : mAvatar(avatar), mTexLayerSet(layerset), mID(id), - mStartTime(LLFrameTimer::getTotalTime()) // Record starting time + mStartTime(LLFrameTimer::getTotalTime()), // Record starting time + mIsHighestRes(highest_res) { } @@ -116,6 +121,7 @@ LLTexLayerSetBuffer::LLTexLayerSetBuffer(LLTexLayerSet* const owner, mUploadPending(FALSE), // Not used for any logic here, just to sync sending of updates mNeedsUpload(FALSE), mNumLowresUploads(0), + mUploadFailCount(0), mNeedsUpdate(TRUE), mNumLowresUpdates(0), mTexLayerSet(owner) @@ -204,6 +210,7 @@ void LLTexLayerSetBuffer::cancelUpload() mNeedsUpload = FALSE; mUploadPending = FALSE; mNeedsUploadTimer.pause(); + mUploadRetryTimer.reset(); } void LLTexLayerSetBuffer::pushProjection() const @@ -356,25 +363,38 @@ BOOL LLTexLayerSetBuffer::isReadyToUpload() const if (!gAgentQueryManager.hasNoPendingQueries()) return FALSE; // Can't upload if there are pending queries. if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures()) return FALSE; // Don't upload if avatar is using composites. - // If we requested an upload and have the final LOD ready, then upload. - if (mTexLayerSet->isLocalTextureDataFinal()) return TRUE; - - // Upload if we've hit a timeout. Upload is a pretty expensive process so we need to make sure - // we aren't doing uploads too frequently. - const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedTextureUploadTimeout"); - if (texture_timeout != 0) + BOOL ready = FALSE; + if (mTexLayerSet->isLocalTextureDataFinal()) + { + // If we requested an upload and have the final LOD ready, upload (or wait a while if this is a retry) + if (mUploadFailCount == 0) + { + ready = TRUE; + } + else + { + ready = mUploadRetryTimer.getElapsedTimeF32() >= BAKE_UPLOAD_RETRY_DELAY * (1 << (mUploadFailCount - 1)); + } + } + else { - // The timeout period increases exponentially between every lowres upload in order to prevent - // spamming the server with frequent uploads. - const U32 texture_timeout_threshold = texture_timeout*(1 << mNumLowresUploads); + // Upload if we've hit a timeout. Upload is a pretty expensive process so we need to make sure + // we aren't doing uploads too frequently. + const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedTextureUploadTimeout"); + if (texture_timeout != 0) + { + // The timeout period increases exponentially between every lowres upload in order to prevent + // spamming the server with frequent uploads. + const U32 texture_timeout_threshold = texture_timeout*(1 << mNumLowresUploads); - // If we hit our timeout and have textures available at even lower resolution, then upload. - const BOOL is_upload_textures_timeout = mNeedsUploadTimer.getElapsedTimeF32() >= texture_timeout_threshold; - const BOOL has_lower_lod = mTexLayerSet->isLocalTextureDataAvailable(); - if (has_lower_lod && is_upload_textures_timeout) return TRUE; + // If we hit our timeout and have textures available at even lower resolution, then upload. + const BOOL is_upload_textures_timeout = mNeedsUploadTimer.getElapsedTimeF32() >= texture_timeout_threshold; + const BOOL has_lower_lod = mTexLayerSet->isLocalTextureDataAvailable(); + ready = has_lower_lod && is_upload_textures_timeout; + } } - return FALSE; + return ready; } BOOL LLTexLayerSetBuffer::isReadyToUpdate() const @@ -482,17 +502,20 @@ void LLTexLayerSetBuffer::doUpload() if (valid) { + const bool highest_lod = mTexLayerSet->isLocalTextureDataFinal(); // Baked_upload_data is owned by the responder and deleted after the request completes. LLBakedUploadData* baked_upload_data = new LLBakedUploadData(gAgentAvatarp, this->mTexLayerSet, - asset_id); + asset_id, + highest_lod); // upload ID is used to avoid overlaps, e.g. when the user rapidly makes two changes outside of Face Edit. mUploadID = asset_id; // Upload the image const std::string url = gAgent.getRegion()->getCapability("UploadBakedTexture"); if(!url.empty() - && !LLPipeline::sForceOldBakedUpload) // toggle debug setting UploadBakedTexOld to change between the new caps method and old method + && !LLPipeline::sForceOldBakedUpload // toggle debug setting UploadBakedTexOld to change between the new caps method and old method + && (mUploadFailCount < (BAKE_UPLOAD_ATTEMPTS - 1))) // Try last ditch attempt via asset store if cap upload is failing. { LLSD body = LLSD::emptyMap(); // The responder will call LLTexLayerSetBuffer::onTextureUploadComplete() @@ -511,7 +534,6 @@ void LLTexLayerSetBuffer::doUpload() llinfos << "Baked texture upload via Asset Store." << llendl; } - const BOOL highest_lod = mTexLayerSet->isLocalTextureDataFinal(); if (highest_lod) { // Sending the final LOD for the baked texture. All done, pause @@ -603,14 +625,15 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, { LLBakedUploadData* baked_upload_data = (LLBakedUploadData*)userdata; - if ((result == 0) && - isAgentAvatarValid() && + if (isAgentAvatarValid() && !gAgentAvatarp->isDead() && (baked_upload_data->mAvatar == gAgentAvatarp) && // Sanity check: only the user's avatar should be uploading textures. (baked_upload_data->mTexLayerSet->hasComposite())) { LLTexLayerSetBuffer* layerset_buffer = baked_upload_data->mTexLayerSet->getComposite(); - + S32 failures = layerset_buffer->mUploadFailCount; + layerset_buffer->mUploadFailCount = 0; + if (layerset_buffer->mUploadID.isNull()) { // The upload got canceled, we should be in the @@ -626,20 +649,28 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, { // This is the upload we're currently waiting for. layerset_buffer->mUploadID.setNull(); + const std::string name(baked_upload_data->mTexLayerSet->getBodyRegionName()); + const std::string resolution = baked_upload_data->mIsHighestRes ? " full res " : " low res "; if (result >= 0) { - layerset_buffer->mUploadPending = FALSE; + layerset_buffer->mUploadPending = FALSE; // Allows sending of AgentSetAppearance later LLVOAvatarDefines::ETextureIndex baked_te = gAgentAvatarp->getBakedTE(layerset_buffer->mTexLayerSet); // Update baked texture info with the new UUID U64 now = LLFrameTimer::getTotalTime(); // Record starting time - llinfos << "Baked texture upload took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << llendl; + llinfos << "Baked" << resolution << "texture upload for " << name << " took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << llendl; gAgentAvatarp->setNewBakedTexture(baked_te, uuid); } else { - // Avatar appearance is changing, ignore the upload results - llinfos << "Baked upload failed. Reason: " << result << llendl; - // *FIX: retry upload after n seconds, asset server could be busy + ++failures; + S32 max_attempts = baked_upload_data->mIsHighestRes ? BAKE_UPLOAD_ATTEMPTS : 1; // only retry final bakes + llwarns << "Baked" << resolution << "texture upload for " << name << " failed (attempt " << failures << "/" << max_attempts << ")" << llendl; + if (failures < max_attempts) + { + layerset_buffer->mUploadFailCount = failures; + layerset_buffer->mUploadRetryTimer.start(); + layerset_buffer->requestUpload(); + } } } else diff --git a/indra/newview/lltexlayer.h b/indra/newview/lltexlayer.h index 2d710d2dce..85dadb213c 100644 --- a/indra/newview/lltexlayer.h +++ b/indra/newview/lltexlayer.h @@ -312,6 +312,8 @@ private: BOOL mUploadPending; // Whether we have received back the new baked textures LLUUID mUploadID; // The current upload process (null if none). LLFrameTimer mNeedsUploadTimer; // Tracks time since upload was requested and performed. + S32 mUploadFailCount; // Number of consecutive upload failures + LLFrameTimer mUploadRetryTimer; // Tracks time since last upload failure. //-------------------------------------------------------------------- // Updates @@ -363,12 +365,14 @@ struct LLBakedUploadData { LLBakedUploadData(const LLVOAvatarSelf* avatar, LLTexLayerSet* layerset, - const LLUUID& id); + const LLUUID& id, + bool highest_res); ~LLBakedUploadData() {} const LLUUID mID; const LLVOAvatarSelf* mAvatar; // note: backlink only; don't LLPointer LLTexLayerSet* mTexLayerSet; const U64 mStartTime; // for measuring baked texture upload time + const bool mIsHighestRes; // whether this is a "final" bake, or intermediate low res }; #endif // LL_LLTEXLAYER_H -- cgit v1.2.3 From 1f15f91d18a37fda5b13ca329aac39d8f01e7790 Mon Sep 17 00:00:00 2001 From: Thickbrick Sleaford Date: Mon, 20 Jun 2011 16:44:48 +0300 Subject: contributions.txt for STORM-1325 --- doc/contributions.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/contributions.txt b/doc/contributions.txt index daaffe2dee..d41ee7b24d 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -824,6 +824,7 @@ Thickbrick Sleaford VWR-24420 STORM-956 STORM-1147 + STORM-1325 Thraxis Epsilon SVC-371 VWR-383 -- cgit v1.2.3 From 0488142b93b6a5cc804a98e28e5dedc28cd4ea54 Mon Sep 17 00:00:00 2001 From: Boroondas Gupte Date: Tue, 21 Jun 2011 00:09:17 +0200 Subject: OPEN-99: use -march=pentium3 for 32-bit builds only --- doc/contributions.txt | 1 + indra/cmake/00-Common.cmake | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index 5f209a6675..5baaf6d12e 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -148,6 +148,7 @@ Blakar Ogre blino Nakamura VWR-17 Boroondas Gupte + OPEN-99 SNOW-278 VWR-233 WEB-262 diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 2cc8fa5e5f..d9e1dd9afb 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -169,7 +169,10 @@ if (LINUX) add_definitions(-fvisibility=hidden) # don't catch SIGCHLD in our base application class for the viewer - some of our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! The viewer doesn't need to catch SIGCHLD anyway. add_definitions(-DLL_IGNORE_SIGCHLD) - add_definitions(-march=pentium3 -mfpmath=sse -ftree-vectorize) + if (WORD_SIZE EQUAL 32) + add_definitions(-march=pentium3) + endif (WORD_SIZE EQUAL 32) + add_definitions(-mfpmath=sse -ftree-vectorize) if (NOT STANDALONE) # this stops us requiring a really recent glibc at runtime add_definitions(-fno-stack-protector) -- cgit v1.2.3 From 0ec4d813ebfd80f82bb2b84e993f7a192e3fddb5 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 23 Jun 2011 14:50:28 -0400 Subject: Log enriched memory info for Mac too. Add Mac logic to LLMemoryInfo::stream(): run vm_stat and log its output. Add comments with Mac and Linux suggestions to LLMemoryInfo::getAvailableMemoryKB(), responding to comment: //do not know how to collect available memory info for other systems. --- indra/llcommon/llsys.cpp | 106 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 99 insertions(+), 7 deletions(-) diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index e8616a9be6..4190c91fd8 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -1,6 +1,6 @@ /** * @file llsys.cpp - * @brief Impelementation of the basic system query functions. + * @brief Implementation of the basic system query functions. * * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code @@ -697,6 +697,76 @@ void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_v avail_physical_mem_kb = (U32)(state.ullAvailPhys/1024) ; avail_virtual_mem_kb = (U32)(state.ullAvailVirtual/1024) ; +#elif LL_DARWIN + // Run vm_stat and filter output, scaling for page size: + // $ vm_stat + // Mach Virtual Memory Statistics: (page size of 4096 bytes) + // Pages free: 462078. + // Pages active: 142010. + // Pages inactive: 220007. + // Pages wired down: 159552. + // "Translation faults": 220825184. + // Pages copy-on-write: 2104153. + // Pages zero filled: 167034876. + // Pages reactivated: 65153. + // Pageins: 2097212. + // Pageouts: 41759. + // Object cache: 841598 hits of 7629869 lookups (11% hit rate) + avail_physical_mem_kb = -1 ; + avail_virtual_mem_kb = -1 ; + +#elif LL_LINUX + // Read selected lines from MEMINFO_FILE: + // $ cat /proc/meminfo + // MemTotal: 4108424 kB + // MemFree: 1244064 kB + // Buffers: 85164 kB + // Cached: 1990264 kB + // SwapCached: 0 kB + // Active: 1176648 kB + // Inactive: 1427532 kB + // Active(anon): 529152 kB + // Inactive(anon): 15924 kB + // Active(file): 647496 kB + // Inactive(file): 1411608 kB + // Unevictable: 16 kB + // Mlocked: 16 kB + // HighTotal: 3266316 kB + // HighFree: 721308 kB + // LowTotal: 842108 kB + // LowFree: 522756 kB + // SwapTotal: 6384632 kB + // SwapFree: 6384632 kB + // Dirty: 28 kB + // Writeback: 0 kB + // AnonPages: 528820 kB + // Mapped: 89472 kB + // Shmem: 16324 kB + // Slab: 159624 kB + // SReclaimable: 145168 kB + // SUnreclaim: 14456 kB + // KernelStack: 2560 kB + // PageTables: 5560 kB + // NFS_Unstable: 0 kB + // Bounce: 0 kB + // WritebackTmp: 0 kB + // CommitLimit: 8438844 kB + // Committed_AS: 1271596 kB + // VmallocTotal: 122880 kB + // VmallocUsed: 65252 kB + // VmallocChunk: 52356 kB + // HardwareCorrupted: 0 kB + // HugePages_Total: 0 + // HugePages_Free: 0 + // HugePages_Rsvd: 0 + // HugePages_Surp: 0 + // Hugepagesize: 2048 kB + // DirectMap4k: 434168 kB + // DirectMap2M: 477184 kB + // (could also run 'free', but easier to read a file than run a program) + avail_physical_mem_kb = -1 ; + avail_virtual_mem_kb = -1 ; + #else //do not know how to collect available memory info for other systems. //leave it blank here for now. @@ -720,6 +790,7 @@ void LLMemoryInfo::stream(std::ostream& s) const s << "Avail page KB: " << (U32)(state.ullAvailPageFile/1024) << std::endl; s << "Total Virtual KB: " << (U32)(state.ullTotalVirtual/1024) << std::endl; s << "Avail Virtual KB: " << (U32)(state.ullAvailVirtual/1024) << std::endl; + #elif LL_DARWIN uint64_t phys = 0; @@ -731,22 +802,39 @@ void LLMemoryInfo::stream(std::ostream& s) const } else { - s << "Unable to collect memory information"; + s << "Unable to collect hw.memsize memory information" << std::endl; + } + + FILE* pout = popen("vm_stat 2>&1", "r"); + if (! pout) + { + s << "Unable to collect vm_stat memory information" << std::endl; } + else + { + // Here 'pout' is vm_stat's stdout. Copy it to output stream. + char line[100]; + while (fgets(line, sizeof(line), pout)) + { + s << line; + } + fclose(pout); + } + #elif LL_SOLARIS U64 phys = 0; phys = (U64)(sysconf(_SC_PHYS_PAGES)) * (U64)(sysconf(_SC_PAGESIZE)/1024); s << "Total Physical KB: " << phys << std::endl; -#else - // *NOTE: This works on linux. What will it do on other systems? + +#elif LL_LINUX LLFILE* meminfo = LLFile::fopen(MEMINFO_FILE,"rb"); if(meminfo) { char line[MAX_STRING]; /* Flawfinder: ignore */ - memset(line, 0, MAX_STRING); - while(fgets(line, MAX_STRING, meminfo)) + memset(line, 0, sizeof(line)); + while(fgets(line, sizeof(line), meminfo)) { line[strlen(line)-1] = ' '; /*Flawfinder: ignore*/ s << line; @@ -755,8 +843,12 @@ void LLMemoryInfo::stream(std::ostream& s) const } else { - s << "Unable to collect memory information"; + s << "Unable to collect memory information" << std::endl; } + +#else + s << "Unknown system; unable to collect memory information" << std::endl; + #endif } -- cgit v1.2.3 From 2619f3db1f781489b9efab0c5ed26c526b013158 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 24 Jun 2011 10:46:38 -0400 Subject: CHOP-753: add timestamp and marker to memory stats log lines --- indra/llcommon/llsys.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 4190c91fd8..015a24cf23 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -36,6 +36,7 @@ #endif #include "llprocessor.h" +#include "llerrorcontrol.h" #if LL_WINDOWS # define WIN32_LEAN_AND_MEAN @@ -778,18 +779,24 @@ void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_v void LLMemoryInfo::stream(std::ostream& s) const { + // We want these memory stats to be easy to grep from the log, along with + // the timestamp. So preface each line with the timestamp and a + // distinctive marker. Without that, we'd have to search the log for the + // introducer line, then read subsequent lines, etc... + std::string pfx(LLError::utcTime() + " "); + #if LL_WINDOWS MEMORYSTATUSEX state; state.dwLength = sizeof(state); GlobalMemoryStatusEx(&state); - s << "Percent Memory use: " << (U32)state.dwMemoryLoad << '%' << std::endl; - s << "Total Physical KB: " << (U32)(state.ullTotalPhys/1024) << std::endl; - s << "Avail Physical KB: " << (U32)(state.ullAvailPhys/1024) << std::endl; - s << "Total page KB: " << (U32)(state.ullTotalPageFile/1024) << std::endl; - s << "Avail page KB: " << (U32)(state.ullAvailPageFile/1024) << std::endl; - s << "Total Virtual KB: " << (U32)(state.ullTotalVirtual/1024) << std::endl; - s << "Avail Virtual KB: " << (U32)(state.ullAvailVirtual/1024) << std::endl; + s << pfx << "Percent Memory use: " << (U32)state.dwMemoryLoad << '%' << std::endl; + s << pfx << "Total Physical KB: " << (U32)(state.ullTotalPhys/1024) << std::endl; + s << pfx << "Avail Physical KB: " << (U32)(state.ullAvailPhys/1024) << std::endl; + s << pfx << "Total page KB: " << (U32)(state.ullTotalPageFile/1024) << std::endl; + s << pfx << "Avail page KB: " << (U32)(state.ullAvailPageFile/1024) << std::endl; + s << pfx << "Total Virtual KB: " << (U32)(state.ullTotalVirtual/1024) << std::endl; + s << pfx << "Avail Virtual KB: " << (U32)(state.ullAvailVirtual/1024) << std::endl; #elif LL_DARWIN uint64_t phys = 0; @@ -798,7 +805,7 @@ void LLMemoryInfo::stream(std::ostream& s) const if(sysctlbyname("hw.memsize", &phys, &len, NULL, 0) == 0) { - s << "Total Physical KB: " << phys/1024 << std::endl; + s << pfx << "Total Physical KB: " << phys/1024 << std::endl; } else { @@ -816,7 +823,7 @@ void LLMemoryInfo::stream(std::ostream& s) const char line[100]; while (fgets(line, sizeof(line), pout)) { - s << line; + s << pfx << line; } fclose(pout); } @@ -826,7 +833,7 @@ void LLMemoryInfo::stream(std::ostream& s) const phys = (U64)(sysconf(_SC_PHYS_PAGES)) * (U64)(sysconf(_SC_PAGESIZE)/1024); - s << "Total Physical KB: " << phys << std::endl; + s << pfx << "Total Physical KB: " << phys << std::endl; #elif LL_LINUX LLFILE* meminfo = LLFile::fopen(MEMINFO_FILE,"rb"); @@ -837,7 +844,7 @@ void LLMemoryInfo::stream(std::ostream& s) const while(fgets(line, sizeof(line), meminfo)) { line[strlen(line)-1] = ' '; /*Flawfinder: ignore*/ - s << line; + s << pfx << line; } fclose(meminfo); } -- cgit v1.2.3 From abb8a7018d0fc7a52aa35f4be1cec372719e4eda Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 28 Jun 2011 08:21:49 -0400 Subject: CHOP-753: Log LLMemoryInfo whenever framerate hits a new low. Introduce FrameWatcher, a static object that hooks into the LLEventPump named "mainloop" to get a call every frame. Track framerate over a defined sample time (20 seconds atm); track minimum and log LLMemoryInfo every time we hit a new minimum. --- indra/llcommon/llsys.cpp | 106 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 015a24cf23..92fdf4f327 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -37,6 +37,9 @@ #include "llprocessor.h" #include "llerrorcontrol.h" +#include "llevents.h" +#include "lltimer.h" +#include #if LL_WINDOWS # define WIN32_LEAN_AND_MEAN @@ -71,6 +74,10 @@ extern int errno; static const S32 CPUINFO_BUFFER_SIZE = 16383; LLCPUInfo gSysCPU; +// Don't log memory info any more often than this. It also serves as our +// framerate sample size. +static const F32 MEM_INFO_THROTTLE = 20; + #if LL_WINDOWS #ifndef DLLVERSIONINFO typedef struct _DllVersionInfo @@ -877,6 +884,105 @@ std::ostream& operator<<(std::ostream& s, const LLMemoryInfo& info) return s; } +class FrameWatcher +{ +public: + FrameWatcher(): + // Hooking onto the "mainloop" event pump gets us one call per frame. + mConnection(LLEventPumps::instance() + .obtain("mainloop") + .listen("FrameWatcher", boost::bind(&FrameWatcher::tick, this, _1))), + // Initializing mSampleStart to an invalid timestamp alerts us to skip + // trying to compute framerate on the first call. + mSampleStart(-1), + // Initializing mSampleEnd to 0 ensures that we treat the first call + // as the completion of a sample window. + mSampleEnd(0), + mFrames(0), + // Initializing to F32_MAX means that the first real frame will become + // the slowest ever, which sounds like a good idea. + mSlowest(F32_MAX), + mDesc("startup") + {} + + bool tick(const LLSD&) + { + F32 timestamp(mTimer.getElapsedTimeF32()); + + // Count this frame in the interval just completed. + ++mFrames; + + // Have we finished a sample window yet? + if (timestamp < mSampleEnd) + { + // no, just keep waiting + return false; + } + + // Set up for next sample window. Capture values for previous frame in + // local variables and reset data members. + U32 frames(mFrames); + F32 sampleStart(mSampleStart); + // No frames yet in next window + mFrames = 0; + // which starts right now + mSampleStart = timestamp; + // and ends MEM_INFO_THROTTLE seconds in the future + mSampleEnd = mSampleStart + MEM_INFO_THROTTLE; + + // On the very first call, that's all we can do, no framerate + // computation is possible. + if (sampleStart < 0) + { + return false; + } + + // How long did this actually take? As framerate slows, the duration + // of the frame we just finished could push us WELL beyond our desired + // sample window size. + F32 elapsed(timestamp - sampleStart); + F32 framerate(frames/elapsed); + + // We're especially interested in memory as framerate drops. Only log + // when framerate is lower than ever before. (Should always be true + // for the end of the very first sample window.) + if (framerate >= mSlowest) + { + return false; + } + // Congratulations, we've hit a new low. :-P + mSlowest = framerate; + + LL_INFOS("FrameWatcher") << mDesc << " framerate " + << std::fixed << std::setprecision(1) << framerate << '\n' + << LLMemoryInfo() << LL_ENDL; + mDesc = "new lowest"; + + return false; + } + +private: + // Storing the connection in an LLTempBoundListener ensures it will be + // disconnected when we're destroyed. + LLTempBoundListener mConnection; + // Track elapsed time + LLTimer mTimer; + // Some of what you see here is in fact redundant with functionality you + // can get from LLTimer. Unfortunately the LLTimer API is missing the + // feature we need: has at least the stated interval elapsed, and if so, + // exactly how long has passed? So we have to do it by hand, sigh. + // Time at start, end of sample window + F32 mSampleStart, mSampleEnd; + // Frames this sample window + U32 mFrames; + // Slowest framerate EVAR + F32 mSlowest; + // Description of next notable framerate + std::string mDesc; +}; + +static FrameWatcher sFrameWatcher; + BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile) { std::string tmpfile; -- cgit v1.2.3 From 57c230b73ea171d310ad3c132624a8fdd6751b0e Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 28 Jun 2011 08:58:10 -0400 Subject: CHOP-753: suppress VS fatal warning 4355 --- indra/llcommon/llsys.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 92fdf4f327..156c78b1e8 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -24,6 +24,10 @@ * $/LicenseInfo$ */ +#if LL_WINDOWS +#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally +#endif + #include "linden_common.h" #include "llsys.h" -- cgit v1.2.3 From 26be53aede499182252bb797e798611169ea0553 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 28 Jun 2011 16:01:16 -0400 Subject: CHOP-753: Introduce a sliding window of framerate samples. The trouble with remembering the slowest-ever framerate is that framerate drops dramatically on login, then typically bounces back to something reasonable during the session. So the session-normal framerate has to drop pretty dramatically before it falls below the original login framerate. To address this, only remember the last ~10 minutes of framerates, and log memory stats every time a new framerate is slower than the previous 10 minutes. --- indra/llcommon/llsys.cpp | 70 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 13 deletions(-) diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 156c78b1e8..ccd6f261b7 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -44,6 +44,7 @@ #include "llevents.h" #include "lltimer.h" #include +#include #if LL_WINDOWS # define WIN32_LEAN_AND_MEAN @@ -81,6 +82,11 @@ LLCPUInfo gSysCPU; // Don't log memory info any more often than this. It also serves as our // framerate sample size. static const F32 MEM_INFO_THROTTLE = 20; +// Sliding window of samples. We intentionally limit the length of time we +// remember "the slowest" framerate because framerate is very slow at login. +// If we only triggered FrameWatcher logging when the session framerate +// dropped below the login framerate, we'd have very little additional data. +static const F32 MEM_INFO_WINDOW = 10*60; #if LL_WINDOWS #ifndef DLLVERSIONINFO @@ -903,10 +909,13 @@ public: // as the completion of a sample window. mSampleEnd(0), mFrames(0), + // Both MEM_INFO_WINDOW and MEM_INFO_THROTTLE are in seconds. We need + // the number of integer MEM_INFO_THROTTLE sample slots that will fit + // in MEM_INFO_WINDOW. Round up. + mSamples(int((MEM_INFO_WINDOW / MEM_INFO_THROTTLE) + 0.7)), // Initializing to F32_MAX means that the first real frame will become // the slowest ever, which sounds like a good idea. - mSlowest(F32_MAX), - mDesc("startup") + mSlowest(F32_MAX) {} bool tick(const LLSD&) @@ -947,20 +956,54 @@ public: F32 elapsed(timestamp - sampleStart); F32 framerate(frames/elapsed); + // Remember previous slowest framerate because we're just about to + // update it. + F32 slowest(mSlowest); + // Remember previous number of samples. + boost::circular_buffer::size_type prevSize(mSamples.size()); + + // Capture new framerate in our samples buffer. Once the buffer is + // full (after MEM_INFO_WINDOW seconds), this will displace the oldest + // sample. ("So they all rolled over, and one fell out...") + mSamples.push_back(framerate); + + // Calculate the new minimum framerate. I know of no way to update a + // rolling minimum without ever rescanning the buffer. But since there + // are only a few tens of items in this buffer, rescanning it is + // probably cheaper (and certainly easier to reason about) than + // attempting to optimize away some of the scans. + mSlowest = framerate; // pick an arbitrary entry to start + for (boost::circular_buffer::const_iterator si(mSamples.begin()), send(mSamples.end()); + si != send; ++si) + { + if (*si < mSlowest) + { + mSlowest = *si; + } + } + // We're especially interested in memory as framerate drops. Only log - // when framerate is lower than ever before. (Should always be true - // for the end of the very first sample window.) - if (framerate >= mSlowest) + // when framerate drops below the slowest framerate we remember. + // (Should always be true for the end of the very first sample + // window.) + if (framerate >= slowest) { return false; } // Congratulations, we've hit a new low. :-P - mSlowest = framerate; - LL_INFOS("FrameWatcher") << mDesc << " framerate " - << std::fixed << std::setprecision(1) << framerate << '\n' - << LLMemoryInfo() << LL_ENDL; - mDesc = "new lowest"; + LL_INFOS("FrameWatcher") << ' '; + if (! prevSize) + { + LL_CONT << "initial framerate "; + } + else + { + LL_CONT << "slowest framerate for last " << int(prevSize * MEM_INFO_THROTTLE) + << " seconds "; + } + LL_CONT << std::fixed << std::setprecision(1) << framerate << '\n' + << LLMemoryInfo() << LL_ENDL; return false; } @@ -979,12 +1022,13 @@ private: F32 mSampleStart, mSampleEnd; // Frames this sample window U32 mFrames; - // Slowest framerate EVAR + // Sliding window of framerate samples + boost::circular_buffer mSamples; + // Slowest framerate in mSamples F32 mSlowest; - // Description of next notable framerate - std::string mDesc; }; +// Need an instance of FrameWatcher before it does any good static FrameWatcher sFrameWatcher; BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile) -- cgit v1.2.3 From 1262f710b548100e4522866341febba3d7cf535d Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 28 Jun 2011 23:09:00 -0400 Subject: CHOP-753: Report Linux memory stats 1/line, like other platforms. Previous code deliberately flowed the different lines from MEMINFO_FILE together on a single line, which seems pointless to me, since we want to be able to grep the viewer log to recognize individual stats. Also replace classic-C LLFILE* machinery used to read MEMINFO_FILE with std::ifstream and std::getline(). --- indra/llcommon/llsys.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index ccd6f261b7..f0f98f5bf6 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -853,17 +853,14 @@ void LLMemoryInfo::stream(std::ostream& s) const s << pfx << "Total Physical KB: " << phys << std::endl; #elif LL_LINUX - LLFILE* meminfo = LLFile::fopen(MEMINFO_FILE,"rb"); - if(meminfo) + std::ifstream meminfo(MEMINFO_FILE); + if (meminfo.is_open()) { - char line[MAX_STRING]; /* Flawfinder: ignore */ - memset(line, 0, sizeof(line)); - while(fgets(line, sizeof(line), meminfo)) + std::string line; + while (std::getline(meminfo, line)) { - line[strlen(line)-1] = ' '; /*Flawfinder: ignore*/ - s << pfx << line; + s << pfx << line << '\n'; } - fclose(meminfo); } else { -- cgit v1.2.3 From 68c8248fb9450cc9adb41f53f0d2f03d5fd4124e Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 29 Jun 2011 10:28:06 -0400 Subject: STORM-1459 "Wearing Tab" - Add ability to copy displayed inventory names to clipboard --- doc/contributions.txt | 2 ++ indra/newview/llpanelwearing.cpp | 26 ++++++++++++++++++++++ indra/newview/llpanelwearing.h | 1 + .../skins/default/xui/en/panel_outfits_wearing.xml | 11 ++++++++- 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index 256c39eb9e..b253a7662d 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -449,6 +449,7 @@ Jonathan Yap STORM-1313 STORM-899 STORM-1273 + STORM-1459 Kage Pixel VWR-11 Ken March @@ -690,6 +691,7 @@ Robin Cornelius STORM-1019 STORM-1095 STORM-1128 + STORM-1459 VWR-2488 VWR-9557 VWR-10579 diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp index 911a9e5dda..e0109675a6 100644 --- a/indra/newview/llpanelwearing.cpp +++ b/indra/newview/llpanelwearing.cpp @@ -38,6 +38,8 @@ #include "llsidetray.h" #include "llviewermenu.h" #include "llwearableitemslist.h" +#include "llsdserialize.h" +#include "llclipboard.h" // Context menu and Gear menu helper. static void edit_outfit() @@ -182,6 +184,7 @@ BOOL LLPanelWearing::postBuild() { mCOFItemsList = getChild("cof_items_list"); mCOFItemsList->setRightMouseDownCallback(boost::bind(&LLPanelWearing::onWearableItemsListRightClick, this, _1, _2, _3)); + childSetAction("copy_to_clipboard", boost::bind(&LLPanelWearing::copyToClipboard, this)); LLMenuButton* menu_gear_btn = getChild("options_gear_btn"); @@ -280,4 +283,27 @@ void LLPanelWearing::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const mCOFItemsList->getSelectedUUIDs(selected_uuids); } +void LLPanelWearing::copyToClipboard() +{ + std::string text; + bool need_cr = false; + std::vector data; + mCOFItemsList->getValues(data); + for(std::vector::iterator iter = data.begin(); iter != data.end(); iter++) + { + LLSD uuid = (*iter); + LLViewerInventoryItem* item = gInventory.getItem(uuid); + if (!need_cr) + { + text += item->getName(); + need_cr = true; + } + else + { + text += "\n" + item->getName(); + } + } + gClipboard.copyFromString(utf8str_to_wstring(text)); +} + // EOF diff --git a/indra/newview/llpanelwearing.h b/indra/newview/llpanelwearing.h index 157b2c4c5f..4c9f5ed079 100644 --- a/indra/newview/llpanelwearing.h +++ b/indra/newview/llpanelwearing.h @@ -66,6 +66,7 @@ public: private: void onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y); + void copyToClipboard(); LLInventoryCategoriesObserver* mCategoriesObserver; LLWearableItemsList* mCOFItemsList; diff --git a/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml b/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml index d85b778db2..eef499184c 100644 --- a/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml +++ b/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml @@ -42,6 +42,15 @@ tool_tip="Show additional options" top="1" width="31" /> + diff --git a/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_folder.xml b/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_folder.xml new file mode 100644 index 0000000000..2c987b158d --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_folder.xml @@ -0,0 +1,10 @@ + + + + diff --git a/indra/newview/skins/default/xui/en/widgets/inbox_inventory_panel.xml b/indra/newview/skins/default/xui/en/widgets/inbox_inventory_panel.xml new file mode 100644 index 0000000000..830c27bdac --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/inbox_inventory_panel.xml @@ -0,0 +1,2 @@ + + diff --git a/indra/newview/skins/default/xui/en/widgets/inventory_panel.xml b/indra/newview/skins/default/xui/en/widgets/inventory_panel.xml index 93875d66e6..00f4c43915 100644 --- a/indra/newview/skins/default/xui/en/widgets/inventory_panel.xml +++ b/indra/newview/skins/default/xui/en/widgets/inventory_panel.xml @@ -3,4 +3,12 @@ bg_opaque_color="InventoryBackgroundColor" background_visible="true" background_opaque="true" - /> + show_load_status="true" + > + + diff --git a/indra/newview/skins/default/xui/en/widgets/location_input.xml b/indra/newview/skins/default/xui/en/widgets/location_input.xml index 37d60f1671..44436fb6f2 100644 --- a/indra/newview/skins/default/xui/en/widgets/location_input.xml +++ b/indra/newview/skins/default/xui/en/widgets/location_input.xml @@ -123,6 +123,14 @@ font="SansSerifSmall" text_color="TextFgColor" /> + \ No newline at end of file + chrome="false" + accepts_badge="true"/> \ No newline at end of file diff --git a/indra/newview/skins/default/xui/es/panel_edit_pick.xml b/indra/newview/skins/default/xui/es/panel_edit_pick.xml index 9b101ee4ba..cda465da9c 100644 --- a/indra/newview/skins/default/xui/es/panel_edit_pick.xml +++ b/indra/newview/skins/default/xui/es/panel_edit_pick.xml @@ -29,7 +29,7 @@