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(-) (limited to 'indra/llcommon') 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(-) (limited to 'indra/llcommon') 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(+) (limited to 'indra/llcommon') 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(+) (limited to 'indra/llcommon') 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(-) (limited to 'indra/llcommon') 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(-) (limited to 'indra/llcommon') 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 7f8ec9f142f34057fc10436f94ce420183cf75b8 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 29 Jun 2011 20:35:44 -0400 Subject: CHOP-753: Introduce LLSD access to LLMemoryInfo ** BROKEN ** This is known not to compile on Mac yet; checking in to concurrently work on Linux-specific code. --- indra/llcommon/llsys.cpp | 211 +++++++++++++++++++++++++++++++++++++++++++++++ indra/llcommon/llsys.h | 28 +++++++ 2 files changed, 239 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index f0f98f5bf6..40914dca3f 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -43,8 +43,15 @@ #include "llerrorcontrol.h" #include "llevents.h" #include "lltimer.h" +#include "llsdserialize.h" +#include "llsdutil.h" #include #include +#include +#include +#include + +using namespace llsd; #if LL_WINDOWS # define WIN32_LEAN_AND_MEAN @@ -633,6 +640,7 @@ void LLCPUInfo::stream(std::ostream& s) const LLMemoryInfo::LLMemoryInfo() { + refresh(); } #if LL_WINDOWS @@ -873,6 +881,209 @@ void LLMemoryInfo::stream(std::ostream& s) const #endif } +LLSD LLMemoryInfo::getStatsMap() const +{ + LLSD map; + + BOOST_FOREACH(LLSD pair, inArray(mData)) + { + // Have to be clear that we want the key asString() to specify map + // indexing rather than array subscripting. + map[pair[0].asString()] = pair[1]; + } + + return map; +} + +LLSD LLMemoryInfo::getStatsArray() const +{ + return mData; +} + +LLMemoryInfo& LLMemoryInfo::refresh() +{ + // This implementation is derived from stream() code (as of 2011-06-29). + // Hopefully we'll reimplement stream() to use mData before long... + mData = LLSD::emptyArray(); + +#if LL_WINDOWS + MEMORYSTATUSEX state; + state.dwLength = sizeof(state); + GlobalMemoryStatusEx(&state); + + mData.append(LLSDArray("Percent Memory use")(LLSD::Integer(state.dwMemoryLoad))); + mData.append(LLSDArray("Total Physical KB") (LLSD::Integer(state.ullTotalPhys/1024))); + mData.append(LLSDArray("Avail Physical KB") (LLSD::Integer(state.ullAvailPhys/1024))); + mData.append(LLSDArray("Total page KB") (LLSD::Integer(state.ullTotalPageFile/1024))); + mData.append(LLSDArray("Avail page KB") (LLSD::Integer(state.ullAvailPageFile/1024))); + mData.append(LLSDArray("Total Virtual KB") (LLSD::Integer(state.ullTotalVirtual/1024))); + mData.append(LLSDArray("Avail Virtual KB") (LLSD::Integer(state.ullAvailVirtual/1024))); + +#elif LL_DARWIN + uint64_t phys = 0; + + size_t len = sizeof(phys); + + if (sysctlbyname("hw.memsize", &phys, &len, NULL, 0) == 0) + { + mData.append(LLSDArray("Total Physical KB")(LLSD::Integer(phys/1024))); + } + else + { + LL_WARNS("LLMemoryInfo") << "Unable to collect hw.memsize memory information" << LL_ENDL; + } + + FILE* pout = popen("vm_stat 2>&1", "r"); + if (! pout) + { + LL_WARNS("LLMemoryInfo") << "Unable to collect vm_stat memory information" << LL_ENDL; + } + else + { + // 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) + + boost::regex pagesize_rx("\\(page size of ([0-9]+) bytes\\)"); + boost::regex stat_rx("(.+): +([0-9]+)\\."); + boost::regex pages_rx("Pages "); + boost::cmatch matched; + LLSD::Integer pagesizekb(4096/1024); + + // Here 'pout' is vm_stat's stdout. Search it for relevant data. + char line[100]; + line[sizeof(line)-1] = '\0'; + while (fgets(line, sizeof(line)-1, pout)) + { + size_t linelen(strlen(line)); + // Truncate any trailing newline + if (line[linelen - 1] == '\n') + { + line[--linelen] = '\0'; + } + if (boost::regex_search(&line[0], line+linelen, matched, pagesize_rx)) + { + // "Mach Virtual Memory Statistics: (page size of 4096 bytes)" + std::string pagesize_str(matched[1].first, matched[1].second); + // Reasonable to assume that pagesize will always be a + // multiple of 1Kb? + pagesizekb = boost::lexical_cast(pagesize_str)/1024; + } + else if (boost::regex_match(&line[0], line+linelen, matched, stat_rx)) + { + // e.g. "Pages free: 462078." + // Strip double-quotes off certain statistic names + if (matched[1].first[0] == '"' && matched[1].second[-1] == '"') + { + ++matched[1].first; + --matched[1].second; + } + LLSD::String key(matched[1].first, matched[1].second); + LLSD::String value_str(matched[2].first, matched[2].second); + LLSD::Integer value(boost::lexical_cast(value_str)); + // Store this statistic. + mData.append(LLSDArray(key)(value)); + // Is this in units of pages? If so, convert to Kb. + // boost::regex_match() doc sez: "If you want to match a + // prefix of the character string then use regex_search with + // the flag match_continuous set." + boost::smatch smatched; + if (boost::regex_search(key, smatched, pages_rx, boost::match_continuous)) + { + // Synthesize a new key with kB in place of Pages + LLSD::String kbkey("kB "); + kbkey.append(smatched[0].second, key.end()); + mData.append(LLSDArray(kbkey)(value * pagesizekb)); + } + } + else + { + LL_WARNS("LLMemoryInfo") << "unrecognized vm_stat line: " << line << LL_ENDL; + } + } + fclose(pout); + } + +#elif LL_SOLARIS + U64 phys = 0; + + phys = (U64)(sysconf(_SC_PHYS_PAGES)) * (U64)(sysconf(_SC_PAGESIZE)/1024); + + mData.append(LLSDArray("Total Physical KB")(phys)); + +#elif LL_LINUX + std::ifstream meminfo(MEMINFO_FILE); + if (meminfo.is_open()) + { + // MemTotal: 4108424 kB + // MemFree: 1244064 kB + // Buffers: 85164 kB + // Cached: 1990264 kB + // SwapCached: 0 kB + // Active: 1176648 kB + // Inactive: 1427532 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 + + boost::regex stat_rx("(.+): +([0-9]+)( kB)?"); + boost::smatch matched; + + std::string line; + while (std::getline(meminfo, line)) + { + if (boost::regex_match(line, line+linelen, matched, stat_rx)) + { + // e.g. "MemTotal: 4108424 kB" + LLSD::String key(matched[1].first, matched[1].second); + LLSD::String value_str(matched[2].first, matched[2].second); + LLSD::Integer value(boost::lexical_cast(value_str)); + // Store this statistic. + mData.append(LLSDArray(key)(value)); + } + else + { + LL_WARNS("LLMemoryInfo") << "unrecognized " << MEMINFO_FILE << " line: " + << line << LL_ENDL; + } + } + } + else + { + s << "Unable to collect memory information" << std::endl; + } + +#else + s << "Unknown system; unable to collect memory information" << std::endl; + +#endif + + // should become LL_DEBUGS when we're happy + LL_INFOS("LLMemoryInfo") << "Populated mData:\n"; + LLSDSerialize::toPrettyXML(mData, LL_CONT); + LL_ENDL; + + return *this; +} + std::ostream& operator<<(std::ostream& s, const LLOSInfo& info) { info.stream(s); diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h index 41a4f25000..5b44757e08 100644 --- a/indra/llcommon/llsys.h +++ b/indra/llcommon/llsys.h @@ -36,6 +36,7 @@ // llinfos << info << llendl; // +#include "llsd.h" #include #include @@ -117,6 +118,33 @@ public: //get the available memory infomation in KiloBytes. static void getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb); + + // Retrieve a map of memory statistics. The keys of the map are platform- + // dependent. The values are in kilobytes. + LLSD getStatsMap() const; + + // Retrieve memory statistics: an array of pair arrays [name, value]. This + // is the same data as presented in getStatsMap(), but it preserves the + // order in which we retrieved it from the OS in case that's useful. The + // set of statistics names is platform-dependent. The values are in + // kilobytes to try to avoid integer overflow. + LLSD getStatsArray() const; + + // Re-fetch memory data (as reported by stream() and getStats*()) from the + // system. Normally this is fetched at construction time. Return (*this) + // to permit usage of the form: + // @code + // LLMemoryInfo info; + // ... + // info.refresh().getStatsArray(); + // @endcode + LLMemoryInfo& refresh(); + +private: + // Internally, we store memory stats as for getStatsArray(). It's + // straightforward to convert that to getStatsMap() form, less so to + // reconstruct the original order when converting the other way. + LLSD mData; }; -- cgit v1.2.3 From 21ff3d0d1ce10446cbb1cf9bc08d2c0ebe9705fe Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 29 Jun 2011 20:42:30 -0400 Subject: CHOP-753: fix minor compilation errors on Linux --- indra/llcommon/llsys.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 40914dca3f..2897a533d9 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -1050,7 +1050,7 @@ LLMemoryInfo& LLMemoryInfo::refresh() std::string line; while (std::getline(meminfo, line)) { - if (boost::regex_match(line, line+linelen, matched, stat_rx)) + if (boost::regex_match(line, matched, stat_rx)) { // e.g. "MemTotal: 4108424 kB" LLSD::String key(matched[1].first, matched[1].second); @@ -1068,11 +1068,11 @@ LLMemoryInfo& LLMemoryInfo::refresh() } else { - s << "Unable to collect memory information" << std::endl; + LL_WARNS("LLMemoryInfo") << "Unable to collect memory information" << LL_ENDL; } #else - s << "Unknown system; unable to collect memory information" << std::endl; + LL_WARNS("LLMemoryInfo") << "Unknown system; unable to collect memory information" << LL_ENDL; #endif -- cgit v1.2.3 From b75eedb0dce0c6b11e248c4f244e0020a5b97a42 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 30 Jun 2011 10:12:45 -0400 Subject: CHOP-753: Fix errors in LLMemoryInfo Mac-specific code. Handle conversion errors (boost::bad_lexical_cast). Glean additional LLSD statistics from vm_stat output. --- indra/llcommon/llsys.cpp | 93 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 73 insertions(+), 20 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 2897a533d9..e4404f31c7 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -50,6 +50,7 @@ #include #include #include +#include using namespace llsd; @@ -955,7 +956,8 @@ LLMemoryInfo& LLMemoryInfo::refresh() boost::regex pagesize_rx("\\(page size of ([0-9]+) bytes\\)"); boost::regex stat_rx("(.+): +([0-9]+)\\."); - boost::regex pages_rx("Pages "); + boost::regex cache_rx("Object cache: ([0-9]+) hits of ([0-9]+) lookups " + "\\(([0-9]+)% hit rate\\)"); boost::cmatch matched; LLSD::Integer pagesizekb(4096/1024); @@ -970,41 +972,81 @@ LLMemoryInfo& LLMemoryInfo::refresh() { line[--linelen] = '\0'; } - if (boost::regex_search(&line[0], line+linelen, matched, pagesize_rx)) + if (boost::regex_search(line, matched, pagesize_rx)) { // "Mach Virtual Memory Statistics: (page size of 4096 bytes)" std::string pagesize_str(matched[1].first, matched[1].second); - // Reasonable to assume that pagesize will always be a - // multiple of 1Kb? - pagesizekb = boost::lexical_cast(pagesize_str)/1024; + try + { + // Reasonable to assume that pagesize will always be a + // multiple of 1Kb? + pagesizekb = boost::lexical_cast(pagesize_str)/1024; + } + catch (const boost::bad_lexical_cast&) + { + LL_WARNS("LLMemoryInfo") << "couldn't parse '" << pagesize_str + << "' in vm_stat line: " << line << LL_ENDL; + continue; + } + mData.append(LLSDArray("page size")(pagesizekb)); } - else if (boost::regex_match(&line[0], line+linelen, matched, stat_rx)) + else if (boost::regex_match(line, matched, stat_rx)) { // e.g. "Pages free: 462078." // Strip double-quotes off certain statistic names - if (matched[1].first[0] == '"' && matched[1].second[-1] == '"') + const char *key_begin(matched[1].first), *key_end(matched[1].second); + if (key_begin[0] == '"' && key_end[-1] == '"') { - ++matched[1].first; - --matched[1].second; + ++key_begin; + --key_end; } - LLSD::String key(matched[1].first, matched[1].second); + LLSD::String key(key_begin, key_end); LLSD::String value_str(matched[2].first, matched[2].second); - LLSD::Integer value(boost::lexical_cast(value_str)); + LLSD::Integer value(0); + try + { + value = boost::lexical_cast(value_str); + } + catch (const boost::bad_lexical_cast&) + { + LL_WARNS("LLMemoryInfo") << "couldn't parse '" << value_str + << "' in vm_stat line: " << line << LL_ENDL; + continue; + } // Store this statistic. mData.append(LLSDArray(key)(value)); // Is this in units of pages? If so, convert to Kb. - // boost::regex_match() doc sez: "If you want to match a - // prefix of the character string then use regex_search with - // the flag match_continuous set." - boost::smatch smatched; - if (boost::regex_search(key, smatched, pages_rx, boost::match_continuous)) + static const LLSD::String pages("Pages "); + if (key.substr(0, pages.length()) == pages) { - // Synthesize a new key with kB in place of Pages - LLSD::String kbkey("kB "); - kbkey.append(smatched[0].second, key.end()); + // Synthesize a new key with kb in place of Pages + LLSD::String kbkey("kb "); + kbkey.append(key.substr(pages.length())); mData.append(LLSDArray(kbkey)(value * pagesizekb)); } } + else if (boost::regex_match(line, matched, cache_rx)) + { + // e.g. "Object cache: 841598 hits of 7629869 lookups (11% hit rate)" + static const char* cache_keys[] = { "cache hits", "cache lookups", "cache hit%" }; + std::vector cache_values; + for (size_t i = 0; i < (sizeof(cache_keys)/sizeof(cache_keys[0])); ++i) + { + LLSD::String value_str(matched[i+1].first, matched[i+1].second); + LLSD::Integer value(0); + try + { + value = boost::lexical_cast(value_str); + } + catch (boost::bad_lexical_cast&) + { + LL_WARNS("LLMemoryInfo") << "couldn't parse '" << value_str + << "' in vm_stat line: " << line << LL_ENDL; + continue; + } + mData.append(LLSDArray(cache_keys[i])(value)); + } + } else { LL_WARNS("LLMemoryInfo") << "unrecognized vm_stat line: " << line << LL_ENDL; @@ -1055,7 +1097,18 @@ LLMemoryInfo& LLMemoryInfo::refresh() // e.g. "MemTotal: 4108424 kB" LLSD::String key(matched[1].first, matched[1].second); LLSD::String value_str(matched[2].first, matched[2].second); - LLSD::Integer value(boost::lexical_cast(value_str)); + LLSD::Integer value(0); + try + { + value = boost::lexical_cast(value_str); + } + catch (const boost::bad_lexical_cast&) + { + LL_WARNS("LLMemoryInfo") << "couldn't parse '" << value_str + << "' in " << MEMINFO_FILE << " line: " + << line << LL_ENDL; + continue; + } // Store this statistic. mData.append(LLSDArray(key)(value)); } -- cgit v1.2.3 From 01607fe418b19e7439020047c270c0e7c86725e7 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 30 Jun 2011 11:50:54 -0400 Subject: CHOP-753: Reduce redundancy in LLMemoryInfo. Recast stream() to display data from LLSD array rather than reinvoking OS operations used to capture it. Make refresh() cache LLSD data in map form as well as array; fetch items from that in a few places to avoid going back to OS. --- indra/llcommon/llsys.cpp | 159 ++++++++++++++++------------------------------- indra/llcommon/llsys.h | 10 +-- 2 files changed, 58 insertions(+), 111 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index e4404f31c7..8222702c50 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -665,11 +665,7 @@ static U32 LLMemoryAdjustKBResult(U32 inKB) U32 LLMemoryInfo::getPhysicalMemoryKB() const { #if LL_WINDOWS - MEMORYSTATUSEX state; - state.dwLength = sizeof(state); - GlobalMemoryStatusEx(&state); - - return LLMemoryAdjustKBResult((U32)(state.ullTotalPhys >> 10)); + return LLMemoryAdjustKBResult(mStatsMap["Total Physical KB"]); #elif LL_DARWIN // This might work on Linux as well. Someone check... @@ -717,15 +713,11 @@ U32 LLMemoryInfo::getPhysicalMemoryClamped() const void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb) { #if LL_WINDOWS - MEMORYSTATUSEX state; - state.dwLength = sizeof(state); - GlobalMemoryStatusEx(&state); - - avail_physical_mem_kb = (U32)(state.ullAvailPhys/1024) ; - avail_virtual_mem_kb = (U32)(state.ullAvailVirtual/1024) ; + avail_physical_mem_kb = mStatsMap["Avail Physical KB"]; + avail_virtual_mem_kb = mStatsMap["Avail Virtual KB"]; #elif LL_DARWIN - // Run vm_stat and filter output, scaling for page size: + // mStatsMap is derived from vm_stat, look for (e.g.) "kb free": // $ vm_stat // Mach Virtual Memory Statistics: (page size of 4096 bytes) // Pages free: 462078. @@ -743,7 +735,7 @@ void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_v avail_virtual_mem_kb = -1 ; #elif LL_LINUX - // Read selected lines from MEMINFO_FILE: + // mStatsMap is derived from MEMINFO_FILE: // $ cat /proc/meminfo // MemTotal: 4108424 kB // MemFree: 1244064 kB @@ -811,114 +803,58 @@ void LLMemoryInfo::stream(std::ostream& s) const // introducer line, then read subsequent lines, etc... std::string pfx(LLError::utcTime() + " "); -#if LL_WINDOWS - MEMORYSTATUSEX state; - state.dwLength = sizeof(state); - GlobalMemoryStatusEx(&state); - - 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; - - size_t len = sizeof(phys); - - if(sysctlbyname("hw.memsize", &phys, &len, NULL, 0) == 0) - { - s << pfx << "Total Physical KB: " << phys/1024 << std::endl; - } - else - { - s << "Unable to collect hw.memsize memory information" << std::endl; - } + // Most of the reason we even store mStatsArray is to preserve the + // original order in which we obtained these stats from the OS. So use + // mStatsArray in this method rather than mStatsMap, which should present + // the same information but in arbitrary order. - FILE* pout = popen("vm_stat 2>&1", "r"); - if (! pout) - { - s << "Unable to collect vm_stat memory information" << std::endl; - } - else + // Max key length + size_t key_width(0); + BOOST_FOREACH(LLSD pair, inArray(mStatsArray)) { - // Here 'pout' is vm_stat's stdout. Copy it to output stream. - char line[100]; - while (fgets(line, sizeof(line), pout)) + size_t len(pair[0].asString().length()); + if (len > key_width) { - s << pfx << line; + key_width = len; } - fclose(pout); } -#elif LL_SOLARIS - U64 phys = 0; - - phys = (U64)(sysconf(_SC_PHYS_PAGES)) * (U64)(sysconf(_SC_PAGESIZE)/1024); - - s << pfx << "Total Physical KB: " << phys << std::endl; - -#elif LL_LINUX - std::ifstream meminfo(MEMINFO_FILE); - if (meminfo.is_open()) - { - std::string line; - while (std::getline(meminfo, line)) - { - s << pfx << line << '\n'; - } - } - else + // Now stream stats + BOOST_FOREACH(LLSD pair, inArray(mStatsArray)) { - s << "Unable to collect memory information" << std::endl; + s << pfx << std::setw(key_width+1) << (pair[0].asString() + ':') + << ' ' + << std::setw(12) << pair[1].asInteger() << std::endl; } - -#else - s << "Unknown system; unable to collect memory information" << std::endl; - -#endif } LLSD LLMemoryInfo::getStatsMap() const { - LLSD map; - - BOOST_FOREACH(LLSD pair, inArray(mData)) - { - // Have to be clear that we want the key asString() to specify map - // indexing rather than array subscripting. - map[pair[0].asString()] = pair[1]; - } - - return map; + return mStatsMap; } LLSD LLMemoryInfo::getStatsArray() const { - return mData; + return mStatsArray; } LLMemoryInfo& LLMemoryInfo::refresh() { - // This implementation is derived from stream() code (as of 2011-06-29). - // Hopefully we'll reimplement stream() to use mData before long... - mData = LLSD::emptyArray(); + // This implementation is derived from stream() code (as of 2011-06-29). + mStatsArray = LLSD::emptyArray(); #if LL_WINDOWS MEMORYSTATUSEX state; state.dwLength = sizeof(state); GlobalMemoryStatusEx(&state); - mData.append(LLSDArray("Percent Memory use")(LLSD::Integer(state.dwMemoryLoad))); - mData.append(LLSDArray("Total Physical KB") (LLSD::Integer(state.ullTotalPhys/1024))); - mData.append(LLSDArray("Avail Physical KB") (LLSD::Integer(state.ullAvailPhys/1024))); - mData.append(LLSDArray("Total page KB") (LLSD::Integer(state.ullTotalPageFile/1024))); - mData.append(LLSDArray("Avail page KB") (LLSD::Integer(state.ullAvailPageFile/1024))); - mData.append(LLSDArray("Total Virtual KB") (LLSD::Integer(state.ullTotalVirtual/1024))); - mData.append(LLSDArray("Avail Virtual KB") (LLSD::Integer(state.ullAvailVirtual/1024))); + mStatsArray.append(LLSDArray("Percent Memory use")(LLSD::Integer(state.dwMemoryLoad))); + mStatsArray.append(LLSDArray("Total Physical KB") (LLSD::Integer(state.ullTotalPhys/1024))); + mStatsArray.append(LLSDArray("Avail Physical KB") (LLSD::Integer(state.ullAvailPhys/1024))); + mStatsArray.append(LLSDArray("Total page KB") (LLSD::Integer(state.ullTotalPageFile/1024))); + mStatsArray.append(LLSDArray("Avail page KB") (LLSD::Integer(state.ullAvailPageFile/1024))); + mStatsArray.append(LLSDArray("Total Virtual KB") (LLSD::Integer(state.ullTotalVirtual/1024))); + mStatsArray.append(LLSDArray("Avail Virtual KB") (LLSD::Integer(state.ullAvailVirtual/1024))); #elif LL_DARWIN uint64_t phys = 0; @@ -927,7 +863,7 @@ LLMemoryInfo& LLMemoryInfo::refresh() if (sysctlbyname("hw.memsize", &phys, &len, NULL, 0) == 0) { - mData.append(LLSDArray("Total Physical KB")(LLSD::Integer(phys/1024))); + mStatsArray.append(LLSDArray("Total Physical KB")(LLSD::Integer(phys/1024))); } else { @@ -972,6 +908,7 @@ LLMemoryInfo& LLMemoryInfo::refresh() { line[--linelen] = '\0'; } + LL_DEBUGS("LLMemoryInfo") << line << LL_ENDL; if (boost::regex_search(line, matched, pagesize_rx)) { // "Mach Virtual Memory Statistics: (page size of 4096 bytes)" @@ -988,7 +925,7 @@ LLMemoryInfo& LLMemoryInfo::refresh() << "' in vm_stat line: " << line << LL_ENDL; continue; } - mData.append(LLSDArray("page size")(pagesizekb)); + mStatsArray.append(LLSDArray("page size")(pagesizekb)); } else if (boost::regex_match(line, matched, stat_rx)) { @@ -1014,7 +951,7 @@ LLMemoryInfo& LLMemoryInfo::refresh() continue; } // Store this statistic. - mData.append(LLSDArray(key)(value)); + mStatsArray.append(LLSDArray(key)(value)); // Is this in units of pages? If so, convert to Kb. static const LLSD::String pages("Pages "); if (key.substr(0, pages.length()) == pages) @@ -1022,7 +959,7 @@ LLMemoryInfo& LLMemoryInfo::refresh() // Synthesize a new key with kb in place of Pages LLSD::String kbkey("kb "); kbkey.append(key.substr(pages.length())); - mData.append(LLSDArray(kbkey)(value * pagesizekb)); + mStatsArray.append(LLSDArray(kbkey)(value * pagesizekb)); } } else if (boost::regex_match(line, matched, cache_rx)) @@ -1044,7 +981,7 @@ LLMemoryInfo& LLMemoryInfo::refresh() << "' in vm_stat line: " << line << LL_ENDL; continue; } - mData.append(LLSDArray(cache_keys[i])(value)); + mStatsArray.append(LLSDArray(cache_keys[i])(value)); } } else @@ -1060,7 +997,7 @@ LLMemoryInfo& LLMemoryInfo::refresh() phys = (U64)(sysconf(_SC_PHYS_PAGES)) * (U64)(sysconf(_SC_PAGESIZE)/1024); - mData.append(LLSDArray("Total Physical KB")(phys)); + mStatsArray.append(LLSDArray("Total Physical KB")(phys)); #elif LL_LINUX std::ifstream meminfo(MEMINFO_FILE); @@ -1092,6 +1029,7 @@ LLMemoryInfo& LLMemoryInfo::refresh() std::string line; while (std::getline(meminfo, line)) { + LL_DEBUGS("LLMemoryInfo") << line << LL_ENDL; if (boost::regex_match(line, matched, stat_rx)) { // e.g. "MemTotal: 4108424 kB" @@ -1110,7 +1048,7 @@ LLMemoryInfo& LLMemoryInfo::refresh() continue; } // Store this statistic. - mData.append(LLSDArray(key)(value)); + mStatsArray.append(LLSDArray(key)(value)); } else { @@ -1129,12 +1067,19 @@ LLMemoryInfo& LLMemoryInfo::refresh() #endif - // should become LL_DEBUGS when we're happy - LL_INFOS("LLMemoryInfo") << "Populated mData:\n"; - LLSDSerialize::toPrettyXML(mData, LL_CONT); - LL_ENDL; + // Recast same data as mStatsMap for easy access + BOOST_FOREACH(LLSD pair, inArray(mStatsArray)) + { + // Specify asString() to disambiguate map indexing from array + // subscripting. + mStatsMap[pair[0].asString()] = pair[1]; + } + + LL_DEBUGS("LLMemoryInfo") << "Populated mStatsMap:\n"; + LLSDSerialize::toPrettyXML(mStatsMap, LL_CONT); + LL_ENDL; - return *this; + return *this; } std::ostream& operator<<(std::ostream& s, const LLOSInfo& info) diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h index 5b44757e08..8565bfa0b9 100644 --- a/indra/llcommon/llsys.h +++ b/indra/llcommon/llsys.h @@ -141,10 +141,12 @@ public: LLMemoryInfo& refresh(); private: - // Internally, we store memory stats as for getStatsArray(). It's - // straightforward to convert that to getStatsMap() form, less so to - // reconstruct the original order when converting the other way. - LLSD mData; + // Memory stats for getStatsArray(). It's straightforward to convert that + // to getStatsMap() form, less so to reconstruct the original order when + // converting the other way. + LLSD mStatsArray; + // Memory stats for getStatsMap(). + LLSD mStatsMap; }; -- cgit v1.2.3 From abf50e8c7d3cf0bab46286f4b300c7d3be976775 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 30 Jun 2011 13:57:11 -0400 Subject: CHOP-753: Fix compile errors in LLMemoryInfo Windows-specific code. --- indra/llcommon/llsys.cpp | 72 ++++++++++++++++++++++++++++++------------------ indra/llcommon/llsys.h | 4 +++ 2 files changed, 49 insertions(+), 27 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 8222702c50..d02a807000 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -665,7 +665,7 @@ static U32 LLMemoryAdjustKBResult(U32 inKB) U32 LLMemoryInfo::getPhysicalMemoryKB() const { #if LL_WINDOWS - return LLMemoryAdjustKBResult(mStatsMap["Total Physical KB"]); + return LLMemoryAdjustKBResult(mStatsMap["Total Physical KB"].asInteger()); #elif LL_DARWIN // This might work on Linux as well. Someone check... @@ -712,9 +712,13 @@ U32 LLMemoryInfo::getPhysicalMemoryClamped() const //static void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb) { + // Sigh, this shouldn't be a static method, then we wouldn't have to + // reload this data separately from refresh() + LLSD statsMap(loadStatsMap(loadStatsArray())); + #if LL_WINDOWS - avail_physical_mem_kb = mStatsMap["Avail Physical KB"]; - avail_virtual_mem_kb = mStatsMap["Avail Virtual KB"]; + avail_physical_mem_kb = statsMap["Avail Physical KB"].asInteger(); + avail_virtual_mem_kb = statsMap["Avail Virtual KB"].asInteger(); #elif LL_DARWIN // mStatsMap is derived from vm_stat, look for (e.g.) "kb free": @@ -839,22 +843,35 @@ LLSD LLMemoryInfo::getStatsArray() const } LLMemoryInfo& LLMemoryInfo::refresh() +{ + mStatsArray = loadStatsArray(); + // Recast same data as mStatsMap for easy access + mStatsMap = loadStatsMap(mStatsArray); + + LL_DEBUGS("LLMemoryInfo") << "Populated mStatsMap:\n"; + LLSDSerialize::toPrettyXML(mStatsMap, LL_CONT); + LL_ENDL; + + return *this; +} + +LLSD LLMemoryInfo::loadStatsArray() { // This implementation is derived from stream() code (as of 2011-06-29). - mStatsArray = LLSD::emptyArray(); + LLSD statsArray(LLSD::emptyArray()); #if LL_WINDOWS MEMORYSTATUSEX state; state.dwLength = sizeof(state); GlobalMemoryStatusEx(&state); - mStatsArray.append(LLSDArray("Percent Memory use")(LLSD::Integer(state.dwMemoryLoad))); - mStatsArray.append(LLSDArray("Total Physical KB") (LLSD::Integer(state.ullTotalPhys/1024))); - mStatsArray.append(LLSDArray("Avail Physical KB") (LLSD::Integer(state.ullAvailPhys/1024))); - mStatsArray.append(LLSDArray("Total page KB") (LLSD::Integer(state.ullTotalPageFile/1024))); - mStatsArray.append(LLSDArray("Avail page KB") (LLSD::Integer(state.ullAvailPageFile/1024))); - mStatsArray.append(LLSDArray("Total Virtual KB") (LLSD::Integer(state.ullTotalVirtual/1024))); - mStatsArray.append(LLSDArray("Avail Virtual KB") (LLSD::Integer(state.ullAvailVirtual/1024))); + statsArray.append(LLSDArray("Percent Memory use")(LLSD::Integer(state.dwMemoryLoad))); + statsArray.append(LLSDArray("Total Physical KB") (LLSD::Integer(state.ullTotalPhys/1024))); + statsArray.append(LLSDArray("Avail Physical KB") (LLSD::Integer(state.ullAvailPhys/1024))); + statsArray.append(LLSDArray("Total page KB") (LLSD::Integer(state.ullTotalPageFile/1024))); + statsArray.append(LLSDArray("Avail page KB") (LLSD::Integer(state.ullAvailPageFile/1024))); + statsArray.append(LLSDArray("Total Virtual KB") (LLSD::Integer(state.ullTotalVirtual/1024))); + statsArray.append(LLSDArray("Avail Virtual KB") (LLSD::Integer(state.ullAvailVirtual/1024))); #elif LL_DARWIN uint64_t phys = 0; @@ -863,7 +880,7 @@ LLMemoryInfo& LLMemoryInfo::refresh() if (sysctlbyname("hw.memsize", &phys, &len, NULL, 0) == 0) { - mStatsArray.append(LLSDArray("Total Physical KB")(LLSD::Integer(phys/1024))); + statsArray.append(LLSDArray("Total Physical KB")(LLSD::Integer(phys/1024))); } else { @@ -925,7 +942,7 @@ LLMemoryInfo& LLMemoryInfo::refresh() << "' in vm_stat line: " << line << LL_ENDL; continue; } - mStatsArray.append(LLSDArray("page size")(pagesizekb)); + statsArray.append(LLSDArray("page size")(pagesizekb)); } else if (boost::regex_match(line, matched, stat_rx)) { @@ -951,7 +968,7 @@ LLMemoryInfo& LLMemoryInfo::refresh() continue; } // Store this statistic. - mStatsArray.append(LLSDArray(key)(value)); + statsArray.append(LLSDArray(key)(value)); // Is this in units of pages? If so, convert to Kb. static const LLSD::String pages("Pages "); if (key.substr(0, pages.length()) == pages) @@ -959,7 +976,7 @@ LLMemoryInfo& LLMemoryInfo::refresh() // Synthesize a new key with kb in place of Pages LLSD::String kbkey("kb "); kbkey.append(key.substr(pages.length())); - mStatsArray.append(LLSDArray(kbkey)(value * pagesizekb)); + statsArray.append(LLSDArray(kbkey)(value * pagesizekb)); } } else if (boost::regex_match(line, matched, cache_rx)) @@ -981,7 +998,7 @@ LLMemoryInfo& LLMemoryInfo::refresh() << "' in vm_stat line: " << line << LL_ENDL; continue; } - mStatsArray.append(LLSDArray(cache_keys[i])(value)); + statsArray.append(LLSDArray(cache_keys[i])(value)); } } else @@ -997,7 +1014,7 @@ LLMemoryInfo& LLMemoryInfo::refresh() phys = (U64)(sysconf(_SC_PHYS_PAGES)) * (U64)(sysconf(_SC_PAGESIZE)/1024); - mStatsArray.append(LLSDArray("Total Physical KB")(phys)); + statsArray.append(LLSDArray("Total Physical KB")(phys)); #elif LL_LINUX std::ifstream meminfo(MEMINFO_FILE); @@ -1048,7 +1065,7 @@ LLMemoryInfo& LLMemoryInfo::refresh() continue; } // Store this statistic. - mStatsArray.append(LLSDArray(key)(value)); + statsArray.append(LLSDArray(key)(value)); } else { @@ -1067,19 +1084,20 @@ LLMemoryInfo& LLMemoryInfo::refresh() #endif - // Recast same data as mStatsMap for easy access - BOOST_FOREACH(LLSD pair, inArray(mStatsArray)) + return statsArray; +} + +LLSD LLMemoryInfo::loadStatsMap(const LLSD& statsArray) +{ + LLSD statsMap; + + BOOST_FOREACH(LLSD pair, inArray(statsArray)) { // Specify asString() to disambiguate map indexing from array // subscripting. - mStatsMap[pair[0].asString()] = pair[1]; + statsMap[pair[0].asString()] = pair[1]; } - - LL_DEBUGS("LLMemoryInfo") << "Populated mStatsMap:\n"; - LLSDSerialize::toPrettyXML(mStatsMap, LL_CONT); - LL_ENDL; - - return *this; + return statsMap; } std::ostream& operator<<(std::ostream& s, const LLOSInfo& info) diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h index 8565bfa0b9..7fcb050ed0 100644 --- a/indra/llcommon/llsys.h +++ b/indra/llcommon/llsys.h @@ -141,6 +141,10 @@ public: LLMemoryInfo& refresh(); private: + // These methods are used to set mStatsArray and mStatsMap. + static LLSD loadStatsArray(); + static LLSD loadStatsMap(const LLSD&); + // Memory stats for getStatsArray(). It's straightforward to convert that // to getStatsMap() form, less so to reconstruct the original order when // converting the other way. -- cgit v1.2.3 From bfbd7c6df5d00b40a5a36fe7d99527084f19e76d Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 5 Jul 2011 20:20:26 -0400 Subject: CHOP-753: On Windows, add GetPerformanceInfo to LLMemoryInfo stats. So far we've only been querying GlobalMemoryStatusEx(), but GetPerformanceInfo() delivers a bunch more memory-related stats that may be pertinent. Try capturing those too. May not yet compile on Windows... --- indra/llcommon/llsys.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index d02a807000..e0ce74234d 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -58,6 +58,7 @@ using namespace llsd; # define WIN32_LEAN_AND_MEAN # include # include +# include #elif LL_DARWIN # include # include @@ -873,6 +874,25 @@ LLSD LLMemoryInfo::loadStatsArray() statsArray.append(LLSDArray("Total Virtual KB") (LLSD::Integer(state.ullTotalVirtual/1024))); statsArray.append(LLSDArray("Avail Virtual KB") (LLSD::Integer(state.ullAvailVirtual/1024))); + PERFORMANCE_INFORMATION perf; + perf.cb = sizeof(perf); + GetPerformanceInfo(&perf, sizeof(perf)); + + SIZE_T pagekb(perf.PageSize/1024); + statsArray.append(LLSDArray("CommitTotal KB") (LLSD::Integer(perf.CommitTotal * pagekb))); + statsArray.append(LLSDArray("CommitLimit KB") (LLSD::Integer(perf.CommitLimit * pagekb))); + statsArray.append(LLSDArray("CommitPeak KB") (LLSD::Integer(perf.CommitPeak * pagekb))); + statsArray.append(LLSDArray("PhysicalTotal KB") (LLSD::Integer(perf.PhysicalTotal * pagekb))); + statsArray.append(LLSDArray("PhysicalAvail KB") (LLSD::Integer(perf.PhysicalAvailable * pagekb))); + statsArray.append(LLSDArray("SystemCache KB") (LLSD::Integer(perf.SystemCache * pagekb))); + statsArray.append(LLSDArray("KernelTotal KB") (LLSD::Integer(perf.KernelTotal * pagekb))); + statsArray.append(LLSDArray("KernelPaged KB") (LLSD::Integer(perf.KernelPaged * pagekb))); + statsArray.append(LLSDArray("KernelNonpaged KB")(LLSD::Integer(perf.KernelNonpaged * pagekb))); + statsArray.append(LLSDArray("PageSize KB") (LLSD::Integer(pagekb))); + statsArray.append(LLSDArray("HandleCount") (LLSD::Integer(perf.HandleCount))); + statsArray.append(LLSDArray("ProcessCount") (LLSD::Integer(perf.ProcessCount))); + statsArray.append(LLSDArray("ThreadCount") (LLSD::Integer(perf.ThreadCount))); + #elif LL_DARWIN uint64_t phys = 0; -- cgit v1.2.3 From 6c0d6956da046df9638932030d4c95ff299ca76f Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 7 Jul 2011 14:05:56 -0400 Subject: CHOP-753: add stats from GetProcessMemoryInfo() on Windows. Introduce StatsArray helper class to facilitate accumulating stats in the array-of-pair-arrays form cached internally by LLMemoryInfo. --- indra/llcommon/llsys.cpp | 96 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 30 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index e0ce74234d..cec1cd90e9 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -58,7 +58,8 @@ using namespace llsd; # define WIN32_LEAN_AND_MEAN # include # include -# include +# include // GetPerformanceInfo() et al. +# include // GetCurrentProcess() #elif LL_DARWIN # include # include @@ -640,6 +641,26 @@ void LLCPUInfo::stream(std::ostream& s) const s << "->mCPUString: " << mCPUString << std::endl; } +// Helper class for LLMemoryInfo: accumulate stats in the array-of-pair-arrays +// form we store for LLMemoryInfo::getStatsArray(). +class StatsArray +{ +public: + StatsArray(): + mStats(LLSD::emptyArray()) + {} + + void add(const LLSD::String& name, LLSD::Integer value) + { + mStats.append(LLSDArray(name)(value)); + } + + LLSD get() const { return mStats; } + +private: + LLSD mStats; +}; + LLMemoryInfo::LLMemoryInfo() { refresh(); @@ -859,39 +880,54 @@ LLMemoryInfo& LLMemoryInfo::refresh() LLSD LLMemoryInfo::loadStatsArray() { // This implementation is derived from stream() code (as of 2011-06-29). - LLSD statsArray(LLSD::emptyArray()); + StatsArray stats; #if LL_WINDOWS MEMORYSTATUSEX state; state.dwLength = sizeof(state); GlobalMemoryStatusEx(&state); - statsArray.append(LLSDArray("Percent Memory use")(LLSD::Integer(state.dwMemoryLoad))); - statsArray.append(LLSDArray("Total Physical KB") (LLSD::Integer(state.ullTotalPhys/1024))); - statsArray.append(LLSDArray("Avail Physical KB") (LLSD::Integer(state.ullAvailPhys/1024))); - statsArray.append(LLSDArray("Total page KB") (LLSD::Integer(state.ullTotalPageFile/1024))); - statsArray.append(LLSDArray("Avail page KB") (LLSD::Integer(state.ullAvailPageFile/1024))); - statsArray.append(LLSDArray("Total Virtual KB") (LLSD::Integer(state.ullTotalVirtual/1024))); - statsArray.append(LLSDArray("Avail Virtual KB") (LLSD::Integer(state.ullAvailVirtual/1024))); + stats.add("Percent Memory use", state.dwMemoryLoad); + stats.add("Total Physical KB", state.ullTotalPhys/1024); + stats.add("Avail Physical KB", state.ullAvailPhys/1024); + stats.add("Total page KB", state.ullTotalPageFile/1024); + stats.add("Avail page KB", state.ullAvailPageFile/1024); + stats.add("Total Virtual KB", state.ullTotalVirtual/1024); + stats.add("Avail Virtual KB", state.ullAvailVirtual/1024); PERFORMANCE_INFORMATION perf; perf.cb = sizeof(perf); GetPerformanceInfo(&perf, sizeof(perf)); SIZE_T pagekb(perf.PageSize/1024); - statsArray.append(LLSDArray("CommitTotal KB") (LLSD::Integer(perf.CommitTotal * pagekb))); - statsArray.append(LLSDArray("CommitLimit KB") (LLSD::Integer(perf.CommitLimit * pagekb))); - statsArray.append(LLSDArray("CommitPeak KB") (LLSD::Integer(perf.CommitPeak * pagekb))); - statsArray.append(LLSDArray("PhysicalTotal KB") (LLSD::Integer(perf.PhysicalTotal * pagekb))); - statsArray.append(LLSDArray("PhysicalAvail KB") (LLSD::Integer(perf.PhysicalAvailable * pagekb))); - statsArray.append(LLSDArray("SystemCache KB") (LLSD::Integer(perf.SystemCache * pagekb))); - statsArray.append(LLSDArray("KernelTotal KB") (LLSD::Integer(perf.KernelTotal * pagekb))); - statsArray.append(LLSDArray("KernelPaged KB") (LLSD::Integer(perf.KernelPaged * pagekb))); - statsArray.append(LLSDArray("KernelNonpaged KB")(LLSD::Integer(perf.KernelNonpaged * pagekb))); - statsArray.append(LLSDArray("PageSize KB") (LLSD::Integer(pagekb))); - statsArray.append(LLSDArray("HandleCount") (LLSD::Integer(perf.HandleCount))); - statsArray.append(LLSDArray("ProcessCount") (LLSD::Integer(perf.ProcessCount))); - statsArray.append(LLSDArray("ThreadCount") (LLSD::Integer(perf.ThreadCount))); + stats.add("CommitTotal KB", perf.CommitTotal * pagekb); + stats.add("CommitLimit KB", perf.CommitLimit * pagekb); + stats.add("CommitPeak KB", perf.CommitPeak * pagekb); + stats.add("PhysicalTotal KB", perf.PhysicalTotal * pagekb); + stats.add("PhysicalAvail KB", perf.PhysicalAvailable * pagekb); + stats.add("SystemCache KB", perf.SystemCache * pagekb); + stats.add("KernelTotal KB", perf.KernelTotal * pagekb); + stats.add("KernelPaged KB", perf.KernelPaged * pagekb); + stats.add("KernelNonpaged KB", perf.KernelNonpaged * pagekb); + stats.add("PageSize KB", pagekb); + stats.add("HandleCount", perf.HandleCount); + stats.add("ProcessCount", perf.ProcessCount); + stats.add("ThreadCount", perf.ThreadCount); + + PROCESS_MEMORY_COUNTERS_EX pmem; + pmem.cb = sizeof(pmem); + GetProcessMemoryInfo(GetCurrentProcess(), &pmem, sizeof(pmem)); + + stats.add("Page Fault Count", pmem.PageFaultCount); + stats.add("PeakWorkingSetSize KB", pmem.PeakWorkingSetSize/1024); + stats.add("WorkingSetSize KB", pmem.WorkingSetSize/1024); + stats.add("QutaPeakPagedPoolUsage KB", pmem.QuotaPeakPagedPoolUsage/1024); + stats.add("QuotaPagedPoolUsage KB", pmem.QuotaPagedPoolUsage/1024); + stats.add("QuotaPeakNonPagedPoolUsage KB", pmem.QuotaPeakNonPagedPoolUsage/1024); + stats.add("QuotaNonPagedPoolUsage KB", pmem.QuotaNonPagedPoolUsage/1024); + stats.add("PagefileUsage KB", pmem.PagefileUsage/1024); + stats.add("PeakPagefileUsage KB", pmem.PeakPagefileUsage/1024); + stats.add("PrivateUsage KB", pmem.PrivateUsage/1024); #elif LL_DARWIN uint64_t phys = 0; @@ -900,7 +936,7 @@ LLSD LLMemoryInfo::loadStatsArray() if (sysctlbyname("hw.memsize", &phys, &len, NULL, 0) == 0) { - statsArray.append(LLSDArray("Total Physical KB")(LLSD::Integer(phys/1024))); + stats.add("Total Physical KB", phys/1024); } else { @@ -962,7 +998,7 @@ LLSD LLMemoryInfo::loadStatsArray() << "' in vm_stat line: " << line << LL_ENDL; continue; } - statsArray.append(LLSDArray("page size")(pagesizekb)); + stats.add("page size", pagesizekb); } else if (boost::regex_match(line, matched, stat_rx)) { @@ -988,7 +1024,7 @@ LLSD LLMemoryInfo::loadStatsArray() continue; } // Store this statistic. - statsArray.append(LLSDArray(key)(value)); + stats.add(key, value); // Is this in units of pages? If so, convert to Kb. static const LLSD::String pages("Pages "); if (key.substr(0, pages.length()) == pages) @@ -996,7 +1032,7 @@ LLSD LLMemoryInfo::loadStatsArray() // Synthesize a new key with kb in place of Pages LLSD::String kbkey("kb "); kbkey.append(key.substr(pages.length())); - statsArray.append(LLSDArray(kbkey)(value * pagesizekb)); + stats.add(kbkey, value * pagesizekb); } } else if (boost::regex_match(line, matched, cache_rx)) @@ -1018,7 +1054,7 @@ LLSD LLMemoryInfo::loadStatsArray() << "' in vm_stat line: " << line << LL_ENDL; continue; } - statsArray.append(LLSDArray(cache_keys[i])(value)); + stats.add(cache_keys[i], value); } } else @@ -1034,7 +1070,7 @@ LLSD LLMemoryInfo::loadStatsArray() phys = (U64)(sysconf(_SC_PHYS_PAGES)) * (U64)(sysconf(_SC_PAGESIZE)/1024); - statsArray.append(LLSDArray("Total Physical KB")(phys)); + stats.add("Total Physical KB", phys); #elif LL_LINUX std::ifstream meminfo(MEMINFO_FILE); @@ -1085,7 +1121,7 @@ LLSD LLMemoryInfo::loadStatsArray() continue; } // Store this statistic. - statsArray.append(LLSDArray(key)(value)); + stats.add(key, value); } else { @@ -1104,7 +1140,7 @@ LLSD LLMemoryInfo::loadStatsArray() #endif - return statsArray; + return stats.get(); } LLSD LLMemoryInfo::loadStatsMap(const LLSD& statsArray) -- cgit v1.2.3 From 65657b9f5cf04b5a84e566b7491daabb1291ace9 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 7 Jul 2011 14:20:37 -0400 Subject: CHOP-753: uh, Microsoft docs lied about header file to use? Remove , documented header file for GetCurrentProcess(). --- indra/llcommon/llsys.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index cec1cd90e9..68566cdbfa 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -59,7 +59,6 @@ using namespace llsd; # include # include # include // GetPerformanceInfo() et al. -# include // GetCurrentProcess() #elif LL_DARWIN # include # include -- cgit v1.2.3 From 774306bc25b4b737d318bdd28ab0b078dc60db74 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 7 Jul 2011 14:47:20 -0400 Subject: CHOP-753: have to cast pointer passed to GetProcessMemoryInfo(). GetProcessMemoryInfo() is prototyped with PROCESS_MEMORY_COUNTERS*, so to accept PROCESS_MEMORY_COUNTERS_EX* as documented, have to cast. --- indra/llcommon/llsys.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 68566cdbfa..b3ab5008fb 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -915,7 +915,13 @@ LLSD LLMemoryInfo::loadStatsArray() PROCESS_MEMORY_COUNTERS_EX pmem; pmem.cb = sizeof(pmem); - GetProcessMemoryInfo(GetCurrentProcess(), &pmem, sizeof(pmem)); + // GetProcessMemoryInfo() is documented to accept either + // PROCESS_MEMORY_COUNTERS* or PROCESS_MEMORY_COUNTERS_EX*, presumably + // using the redundant size info to distinguish. But its prototype + // specifically accepts PROCESS_MEMORY_COUNTERS*, and since this is a + // classic-C API, PROCESS_MEMORY_COUNTERS_EX isn't a subclass. Cast the + // pointer. + GetProcessMemoryInfo(GetCurrentProcess(), PPROCESS_MEMORY_COUNTERS(&pmem), sizeof(pmem)); stats.add("Page Fault Count", pmem.PageFaultCount); stats.add("PeakWorkingSetSize KB", pmem.PeakWorkingSetSize/1024); -- cgit v1.2.3 From 607f60d6f6ddf18e69b5106bbb6ef31b72ba78f2 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 11 Jul 2011 10:57:14 -0400 Subject: CHOP-753: Add timestamp to LLMemoryInfo's LLSD stats block. For postprocessing these stats, we'll want the time at which they were captured. We'll want the current framerate too, but handle that at a higher level. --- indra/llcommon/llsys.cpp | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index b3ab5008fb..74a9a68dc8 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -51,6 +51,9 @@ #include #include #include +#include +#include +#include using namespace llsd; @@ -649,7 +652,24 @@ public: mStats(LLSD::emptyArray()) {} - void add(const LLSD::String& name, LLSD::Integer value) + // Store every integer type as LLSD::Integer. + template + void add(const LLSD::String& name, const T& value, + typename boost::enable_if >::type* = 0) + { + mStats.append(LLSDArray(name)(LLSD::Integer(value))); + } + + // Store every floating-point type as LLSD::Real. + template + void add(const LLSD::String& name, const T& value, + typename boost::enable_if >::type* = 0) + { + mStats.append(LLSDArray(name)(LLSD::Real(value))); + } + + // Hope that LLSD::Date values are sufficiently unambiguous. + void add(const LLSD::String& name, const LLSD::Date& value) { mStats.append(LLSDArray(name)(value)); } @@ -847,9 +867,16 @@ void LLMemoryInfo::stream(std::ostream& s) const // Now stream stats BOOST_FOREACH(LLSD pair, inArray(mStatsArray)) { - s << pfx << std::setw(key_width+1) << (pair[0].asString() + ':') - << ' ' - << std::setw(12) << pair[1].asInteger() << std::endl; + s << pfx << std::setw(key_width+1) << (pair[0].asString() + ':') << ' '; + if (pair[1].isInteger()) + s << std::setw(12) << pair[1].asInteger(); + else if (pair[1].isReal()) + s << std::fixed << std::setprecision(1) << pair[1].asReal(); + else if (pair[1].isDate()) + pair[1].asDate().toStream(s); + else + s << pair[1]; // just use default LLSD formatting + s << std::endl; } } @@ -881,6 +908,9 @@ LLSD LLMemoryInfo::loadStatsArray() // This implementation is derived from stream() code (as of 2011-06-29). StatsArray stats; + // associate timestamp for analysis over time + stats.add("timestamp", LLDate::now()); + #if LL_WINDOWS MEMORYSTATUSEX state; state.dwLength = sizeof(state); -- cgit v1.2.3 From 8fcda650a71d4784dcb24e86b3fc59ad15bc6a2d Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 11 Jul 2011 14:24:28 -0400 Subject: CHOP-753: Add classic-C-style diagnostics around popen("vm_stat"). On Mac, where LLMemoryInfo relies on a child process rather than any sort of internal system API, try to produce more informative LL_WARNS output if popen() fails to run vm_stat, or if vm_stat terminates with nonzero rc. --- indra/llcommon/llsys.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 4 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 74a9a68dc8..9390fc170c 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -68,6 +68,8 @@ using namespace llsd; # include # include # include +# include +# include #elif LL_LINUX # include # include @@ -979,11 +981,23 @@ LLSD LLMemoryInfo::loadStatsArray() } FILE* pout = popen("vm_stat 2>&1", "r"); - if (! pout) + if (! pout) // popen() couldn't run vm_stat { - LL_WARNS("LLMemoryInfo") << "Unable to collect vm_stat memory information" << LL_ENDL; + // Save errno right away. + int popen_errno(errno); + LL_WARNS("LLMemoryInfo") << "Unable to collect vm_stat memory information: "; + char buffer[256]; + if (0 == strerror_r(popen_errno, buffer, sizeof(buffer))) + { + LL_CONT << buffer; + } + else + { + LL_CONT << "errno " << popen_errno; + } + LL_CONT << LL_ENDL; } - else + else // popen() launched vm_stat { // Mach Virtual Memory Statistics: (page size of 4096 bytes) // Pages free: 462078. @@ -1097,7 +1111,47 @@ LLSD LLMemoryInfo::loadStatsArray() LL_WARNS("LLMemoryInfo") << "unrecognized vm_stat line: " << line << LL_ENDL; } } - fclose(pout); + int status(pclose(pout)); + if (status == -1) // pclose() couldn't retrieve rc + { + // Save errno right away. + int pclose_errno(errno); + // The ECHILD error happens so frequently that unless filtered, + // the warning below spams the log file. This is too bad, because + // sometimes the logic above fails to produce any output derived + // from vm_stat, but we've been unable to observe any specific + // error indicating the problem. + if (pclose_errno != ECHILD) + { + LL_WARNS("LLMemoryInfo") << "Unable to obtain vm_stat termination code: "; + char buffer[256]; + if (0 == strerror_r(pclose_errno, buffer, sizeof(buffer))) + { + LL_CONT << buffer; + } + else + { + LL_CONT << "errno " << pclose_errno; + } + LL_CONT << LL_ENDL; + } + } + else // pclose() retrieved rc; analyze + { + if (WIFEXITED(status)) + { + int rc(WEXITSTATUS(status)); + if (rc != 0) + { + LL_WARNS("LLMemoryInfo") << "vm_stat terminated with rc " << rc << LL_ENDL; + } + } + else if (WIFSIGNALED(status)) + { + LL_WARNS("LLMemoryInfo") << "vm_stat terminated by signal " << WTERMSIG(status) + << LL_ENDL; + } + } } #elif LL_SOLARIS -- cgit v1.2.3 From 4e2355036358ed712dd7df2668ec705931ad13a1 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 12 Jul 2011 13:34:09 -0400 Subject: CHOP-753: make getAvailableMemoryKB() only load data on Windows. (per Monty code review) Other platforms return -1 anyway, so don't need to call load methods. --- indra/llcommon/llsys.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 9390fc170c..aa71590eae 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -755,11 +755,11 @@ U32 LLMemoryInfo::getPhysicalMemoryClamped() const //static void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb) { +#if LL_WINDOWS // Sigh, this shouldn't be a static method, then we wouldn't have to // reload this data separately from refresh() LLSD statsMap(loadStatsMap(loadStatsArray())); -#if LL_WINDOWS avail_physical_mem_kb = statsMap["Avail Physical KB"].asInteger(); avail_virtual_mem_kb = statsMap["Avail Virtual KB"].asInteger(); -- cgit v1.2.3 From e58a0e9b26dc374155b90a8f42c3a5b09e8ed1f7 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 12 Jul 2011 14:34:31 -0400 Subject: CHOP-753: Defend against boost::regex exceptions. (per Monty code review) Explain why we intentionally don't suppress exceptions from boost::regex objects constructed with string literals. Catch std::runtime_error from boost::regex_search() and boost::regex_match(); log and return false. --- indra/llcommon/llsys.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index aa71590eae..ebdef56c2a 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -70,11 +70,13 @@ using namespace llsd; # include # include # include +# include #elif LL_LINUX # include # include # include # include +# include const char MEMINFO_FILE[] = "/proc/meminfo"; #elif LL_SOLARIS # include @@ -682,6 +684,38 @@ private: LLSD mStats; }; +// Wrap boost::regex_match() with a function that doesn't throw. +template +static bool regex_match_no_exc(const S& string, M& match, const R& regex) +{ + try + { + return boost::regex_match(string, match, regex); + } + catch (const std::runtime_error& e) + { + LL_WARNS("LLMemoryInfo") << "error matching with '" << regex.str() << "': " + << e.what() << ":\n'" << string << "'" << LL_ENDL; + return false; + } +} + +// Wrap boost::regex_search() with a function that doesn't throw. +template +static bool regex_search_no_exc(const S& string, M& match, const R& regex) +{ + try + { + return boost::regex_search(string, match, regex); + } + catch (const std::runtime_error& e) + { + LL_WARNS("LLMemoryInfo") << "error searching with '" << regex.str() << "': " + << e.what() << ":\n'" << string << "'" << LL_ENDL; + return false; + } +} + LLMemoryInfo::LLMemoryInfo() { refresh(); @@ -1012,6 +1046,10 @@ LLSD LLMemoryInfo::loadStatsArray() // Pageouts: 41759. // Object cache: 841598 hits of 7629869 lookups (11% hit rate) + // Intentionally don't pass the boost::no_except flag. These + // boost::regex objects are constructed with string literals, so they + // should be valid every time. If they become invalid, we WANT an + // exception, hopefully even before the dev checks in. boost::regex pagesize_rx("\\(page size of ([0-9]+) bytes\\)"); boost::regex stat_rx("(.+): +([0-9]+)\\."); boost::regex cache_rx("Object cache: ([0-9]+) hits of ([0-9]+) lookups " @@ -1031,7 +1069,7 @@ LLSD LLMemoryInfo::loadStatsArray() line[--linelen] = '\0'; } LL_DEBUGS("LLMemoryInfo") << line << LL_ENDL; - if (boost::regex_search(line, matched, pagesize_rx)) + if (regex_search_no_exc(line, matched, pagesize_rx)) { // "Mach Virtual Memory Statistics: (page size of 4096 bytes)" std::string pagesize_str(matched[1].first, matched[1].second); @@ -1049,7 +1087,7 @@ LLSD LLMemoryInfo::loadStatsArray() } stats.add("page size", pagesizekb); } - else if (boost::regex_match(line, matched, stat_rx)) + else if (regex_match_no_exc(line, matched, stat_rx)) { // e.g. "Pages free: 462078." // Strip double-quotes off certain statistic names @@ -1084,7 +1122,7 @@ LLSD LLMemoryInfo::loadStatsArray() stats.add(kbkey, value * pagesizekb); } } - else if (boost::regex_match(line, matched, cache_rx)) + else if (regex_match_no_exc(line, matched, cache_rx)) { // e.g. "Object cache: 841598 hits of 7629869 lookups (11% hit rate)" static const char* cache_keys[] = { "cache hits", "cache lookups", "cache hit%" }; @@ -1185,6 +1223,10 @@ LLSD LLMemoryInfo::loadStatsArray() // DirectMap4k: 434168 kB // DirectMap2M: 477184 kB + // Intentionally don't pass the boost::no_except flag. This + // boost::regex object is constructed with a string literal, so it + // should be valid every time. If it becomes invalid, we WANT an + // exception, hopefully even before the dev checks in. boost::regex stat_rx("(.+): +([0-9]+)( kB)?"); boost::smatch matched; @@ -1192,7 +1234,7 @@ LLSD LLMemoryInfo::loadStatsArray() while (std::getline(meminfo, line)) { LL_DEBUGS("LLMemoryInfo") << line << LL_ENDL; - if (boost::regex_match(line, matched, stat_rx)) + if (regex_match_no_exc(line, matched, stat_rx)) { // e.g. "MemTotal: 4108424 kB" LLSD::String key(matched[1].first, matched[1].second); -- cgit v1.2.3 From 42daa3497b6626cbb5f32ba54162558cd025069b Mon Sep 17 00:00:00 2001 From: Aaron Stone Date: Tue, 12 Jul 2011 15:48:02 -0700 Subject: STORM-1482 The Viewer shouldn't overwrite the crash behavior settings, some cleanups to the crash reporters, and the ability to use --set GroupName.SettingName to set parameters outside of the (default) Global settings group. --- indra/llcommon/indra_constants.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index d0f287657e..0745696ef3 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -387,8 +387,6 @@ const S32 MAP_SIM_RETURN_NULL_SIMS = 0x00010000; const S32 MAP_SIM_PRELUDE = 0x00020000; // Crash reporter behavior -const char* const CRASH_SETTINGS_FILE = "settings_crash_behavior.xml"; -const char* const CRASH_BEHAVIOR_SETTING = "CrashSubmitBehavior"; const S32 CRASH_BEHAVIOR_ASK = 0; const S32 CRASH_BEHAVIOR_ALWAYS_SEND = 1; const S32 CRASH_BEHAVIOR_NEVER_SEND = 2; -- cgit v1.2.3 From ed648b1f08a191250c5c37f831280c31950b502a Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 12 Jul 2011 20:14:39 -0400 Subject: CHOP-753: Eliminate redundant array-of-pair-arrays in LLMemoryInfo. (per Monty code review) The notion of storing LLMemoryInfo data both as an LLSD::Map and an LLSD::Array of pair arrays arose from a (possibly misguided) desire to continue producing stats output into the viewer log in the same order it always used to be produced. There is no evidence that anyone cares about the order of those stats in the log; there is no other use case for preserving order. At Monty's recommendation, eliminate generating and storing the array-of-pair-arrays form: directly store LLSD::Map. --- indra/llcommon/llsys.cpp | 72 ++++++++++++++++-------------------------------- indra/llcommon/llsys.h | 24 ++++------------ 2 files changed, 30 insertions(+), 66 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index ebdef56c2a..99e61433c6 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -647,13 +647,13 @@ void LLCPUInfo::stream(std::ostream& s) const s << "->mCPUString: " << mCPUString << std::endl; } -// Helper class for LLMemoryInfo: accumulate stats in the array-of-pair-arrays -// form we store for LLMemoryInfo::getStatsArray(). -class StatsArray +// Helper class for LLMemoryInfo: accumulate stats in the form we store for +// LLMemoryInfo::getStatsMap(). +class Stats { public: - StatsArray(): - mStats(LLSD::emptyArray()) + Stats(): + mStats(LLSD::emptyMap()) {} // Store every integer type as LLSD::Integer. @@ -661,7 +661,7 @@ public: void add(const LLSD::String& name, const T& value, typename boost::enable_if >::type* = 0) { - mStats.append(LLSDArray(name)(LLSD::Integer(value))); + mStats[name] = LLSD::Integer(value); } // Store every floating-point type as LLSD::Real. @@ -669,13 +669,13 @@ public: void add(const LLSD::String& name, const T& value, typename boost::enable_if >::type* = 0) { - mStats.append(LLSDArray(name)(LLSD::Real(value))); + mStats[name] = LLSD::Real(value); } // Hope that LLSD::Date values are sufficiently unambiguous. void add(const LLSD::String& name, const LLSD::Date& value) { - mStats.append(LLSDArray(name)(value)); + mStats[name] = value; } LLSD get() const { return mStats; } @@ -792,7 +792,7 @@ void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_v #if LL_WINDOWS // Sigh, this shouldn't be a static method, then we wouldn't have to // reload this data separately from refresh() - LLSD statsMap(loadStatsMap(loadStatsArray())); + LLSD statsMap(loadStatsMap()); avail_physical_mem_kb = statsMap["Avail Physical KB"].asInteger(); avail_virtual_mem_kb = statsMap["Avail Virtual KB"].asInteger(); @@ -884,16 +884,11 @@ void LLMemoryInfo::stream(std::ostream& s) const // introducer line, then read subsequent lines, etc... std::string pfx(LLError::utcTime() + " "); - // Most of the reason we even store mStatsArray is to preserve the - // original order in which we obtained these stats from the OS. So use - // mStatsArray in this method rather than mStatsMap, which should present - // the same information but in arbitrary order. - // Max key length size_t key_width(0); - BOOST_FOREACH(LLSD pair, inArray(mStatsArray)) + BOOST_FOREACH(const MapEntry& pair, inMap(mStatsMap)) { - size_t len(pair[0].asString().length()); + size_t len(pair.first.length()); if (len > key_width) { key_width = len; @@ -901,17 +896,18 @@ void LLMemoryInfo::stream(std::ostream& s) const } // Now stream stats - BOOST_FOREACH(LLSD pair, inArray(mStatsArray)) + BOOST_FOREACH(const MapEntry& pair, inMap(mStatsMap)) { - s << pfx << std::setw(key_width+1) << (pair[0].asString() + ':') << ' '; - if (pair[1].isInteger()) - s << std::setw(12) << pair[1].asInteger(); - else if (pair[1].isReal()) - s << std::fixed << std::setprecision(1) << pair[1].asReal(); - else if (pair[1].isDate()) - pair[1].asDate().toStream(s); + s << pfx << std::setw(key_width+1) << (pair.first + ':') << ' '; + LLSD value(pair.second); + if (value.isInteger()) + s << std::setw(12) << value.asInteger(); + else if (value.isReal()) + s << std::fixed << std::setprecision(1) << value.asReal(); + else if (value.isDate()) + value.asDate().toStream(s); else - s << pair[1]; // just use default LLSD formatting + s << value; // just use default LLSD formatting s << std::endl; } } @@ -921,16 +917,9 @@ LLSD LLMemoryInfo::getStatsMap() const return mStatsMap; } -LLSD LLMemoryInfo::getStatsArray() const -{ - return mStatsArray; -} - LLMemoryInfo& LLMemoryInfo::refresh() { - mStatsArray = loadStatsArray(); - // Recast same data as mStatsMap for easy access - mStatsMap = loadStatsMap(mStatsArray); + mStatsMap = loadStatsMap(); LL_DEBUGS("LLMemoryInfo") << "Populated mStatsMap:\n"; LLSDSerialize::toPrettyXML(mStatsMap, LL_CONT); @@ -939,10 +928,10 @@ LLMemoryInfo& LLMemoryInfo::refresh() return *this; } -LLSD LLMemoryInfo::loadStatsArray() +LLSD LLMemoryInfo::loadStatsMap() { // This implementation is derived from stream() code (as of 2011-06-29). - StatsArray stats; + Stats stats; // associate timestamp for analysis over time stats.add("timestamp", LLDate::now()); @@ -1274,19 +1263,6 @@ LLSD LLMemoryInfo::loadStatsArray() return stats.get(); } -LLSD LLMemoryInfo::loadStatsMap(const LLSD& statsArray) -{ - LLSD statsMap; - - BOOST_FOREACH(LLSD pair, inArray(statsArray)) - { - // Specify asString() to disambiguate map indexing from array - // subscripting. - statsMap[pair[0].asString()] = pair[1]; - } - return statsMap; -} - std::ostream& operator<<(std::ostream& s, const LLOSInfo& info) { info.stream(s); diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h index 7fcb050ed0..739e795d3a 100644 --- a/indra/llcommon/llsys.h +++ b/indra/llcommon/llsys.h @@ -120,35 +120,23 @@ public: static void getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb); // Retrieve a map of memory statistics. The keys of the map are platform- - // dependent. The values are in kilobytes. + // dependent. The values are in kilobytes to try to avoid integer overflow. LLSD getStatsMap() const; - // Retrieve memory statistics: an array of pair arrays [name, value]. This - // is the same data as presented in getStatsMap(), but it preserves the - // order in which we retrieved it from the OS in case that's useful. The - // set of statistics names is platform-dependent. The values are in - // kilobytes to try to avoid integer overflow. - LLSD getStatsArray() const; - - // Re-fetch memory data (as reported by stream() and getStats*()) from the + // Re-fetch memory data (as reported by stream() and getStatsMap()) from the // system. Normally this is fetched at construction time. Return (*this) // to permit usage of the form: // @code // LLMemoryInfo info; // ... - // info.refresh().getStatsArray(); + // info.refresh().getStatsMap(); // @endcode LLMemoryInfo& refresh(); private: - // These methods are used to set mStatsArray and mStatsMap. - static LLSD loadStatsArray(); - static LLSD loadStatsMap(const LLSD&); - - // Memory stats for getStatsArray(). It's straightforward to convert that - // to getStatsMap() form, less so to reconstruct the original order when - // converting the other way. - LLSD mStatsArray; + // set mStatsMap + static LLSD loadStatsMap(); + // Memory stats for getStatsMap(). LLSD mStatsMap; }; -- cgit v1.2.3 From 50d271a2ae28334b7dc1170d6222b3b4125fac6b Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 18 Jul 2011 08:31:32 -0400 Subject: increment viewer version to 2.8.2 --- indra/llcommon/llversionviewer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 0018b8e844..6c1d233425 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -29,7 +29,7 @@ const S32 LL_VERSION_MAJOR = 2; const S32 LL_VERSION_MINOR = 8; -const S32 LL_VERSION_PATCH = 1; +const S32 LL_VERSION_PATCH = 2; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Developer"; -- cgit v1.2.3