diff options
Diffstat (limited to 'indra/llcommon/llsys.cpp')
-rw-r--r-- | indra/llcommon/llsys.cpp | 91 |
1 files changed, 10 insertions, 81 deletions
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 1f8d558fbe..4e61fb8a58 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -55,6 +55,7 @@ #include <boost/utility/enable_if.hpp> #include <boost/type_traits/is_integral.hpp> #include <boost/type_traits/is_float.hpp> +#include "llfasttimer.h" using namespace llsd; @@ -87,17 +88,6 @@ using namespace llsd; # include <stdexcept> const char MEMINFO_FILE[] = "/proc/meminfo"; # include <gnu/libc-version.h> -#elif LL_SOLARIS -# include <stdio.h> -# include <unistd.h> -# include <sys/utsname.h> -# define _STRUCTURED_PROC 1 -# include <sys/procfs.h> -# include <sys/types.h> -# include <sys/stat.h> -# include <fcntl.h> -# include <errno.h> -extern int errno; #endif LLCPUInfo gSysCPU; @@ -543,8 +533,6 @@ const std::string& LLOSInfo::getOSVersionString() const U32 LLOSInfo::getProcessVirtualSizeKB() { U32 virtual_size = 0; -#if LL_WINDOWS -#endif #if LL_LINUX # define STATUS_SIZE 2048 LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb"); @@ -564,24 +552,6 @@ U32 LLOSInfo::getProcessVirtualSizeKB() } fclose(status_filep); } -#elif LL_SOLARIS - char proc_ps[LL_MAX_PATH]; - sprintf(proc_ps, "/proc/%d/psinfo", (int)getpid()); - int proc_fd = -1; - if((proc_fd = open(proc_ps, O_RDONLY)) == -1){ - LL_WARNS() << "unable to open " << proc_ps << LL_ENDL; - return 0; - } - psinfo_t proc_psinfo; - if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ - LL_WARNS() << "Unable to read " << proc_ps << LL_ENDL; - close(proc_fd); - return 0; - } - - close(proc_fd); - - virtual_size = proc_psinfo.pr_size; #endif return virtual_size; } @@ -590,8 +560,6 @@ U32 LLOSInfo::getProcessVirtualSizeKB() U32 LLOSInfo::getProcessResidentSizeKB() { U32 resident_size = 0; -#if LL_WINDOWS -#endif #if LL_LINUX LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb"); if (status_filep != NULL) @@ -610,24 +578,6 @@ U32 LLOSInfo::getProcessResidentSizeKB() } fclose(status_filep); } -#elif LL_SOLARIS - char proc_ps[LL_MAX_PATH]; - sprintf(proc_ps, "/proc/%d/psinfo", (int)getpid()); - int proc_fd = -1; - if((proc_fd = open(proc_ps, O_RDONLY)) == -1){ - LL_WARNS() << "unable to open " << proc_ps << LL_ENDL; - return 0; - } - psinfo_t proc_psinfo; - if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ - LL_WARNS() << "Unable to read " << proc_ps << LL_ENDL; - close(proc_fd); - return 0; - } - - close(proc_fd); - - resident_size = proc_psinfo.pr_rssize; #endif return resident_size; } @@ -772,11 +722,6 @@ U32Kilobytes LLMemoryInfo::getPhysicalMemoryKB() const phys = (U64)(getpagesize()) * (U64)(get_phys_pages()); return U64Bytes(phys); -#elif LL_SOLARIS - U64 phys = 0; - phys = (U64)(getpagesize()) * (U64)(sysconf(_SC_PHYS_PAGES)); - return U64Bytes(phys); - #else return 0; @@ -925,8 +870,12 @@ LLMemoryInfo& LLMemoryInfo::refresh() return *this; } +static LLTrace::BlockTimerStatHandle FTM_MEMINFO_LOAD_STATS("MemInfo Load Stats"); + LLSD LLMemoryInfo::loadStatsMap() { + LL_RECORD_BLOCK_TIME(FTM_MEMINFO_LOAD_STATS); + // This implementation is derived from stream() code (as of 2011-06-29). Stats stats; @@ -948,24 +897,11 @@ LLSD LLMemoryInfo::loadStatsMap() stats.add("Total Virtual KB", state.ullTotalVirtual/div); stats.add("Avail Virtual KB", state.ullAvailVirtual/div); - PERFORMANCE_INFORMATION perf; - perf.cb = sizeof(perf); - GetPerformanceInfo(&perf, sizeof(perf)); - - SIZE_T pagekb(perf.PageSize/1024); - 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); + // SL-12122 - Call to GetPerformanceInfo() was removed here. Took + // on order of 10 ms, causing unacceptable frame time spike every + // second, and results were never used. If this is needed in the + // future, must find a way to avoid frame time impact (e.g. move + // to another thread, call much less often). PROCESS_MEMORY_COUNTERS_EX pmem; pmem.cb = sizeof(pmem); @@ -1074,13 +1010,6 @@ LLSD LLMemoryInfo::loadStatsMap() } } -#elif LL_SOLARIS - U64 phys = 0; - - phys = (U64)(sysconf(_SC_PHYS_PAGES)) * (U64)(sysconf(_SC_PAGESIZE)/1024); - - stats.add("Total Physical KB", phys); - #elif LL_LINUX std::ifstream meminfo(MEMINFO_FILE); if (meminfo.is_open()) |