From ef916bd3ae39fb6fd718428aa2a695bbea891940 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Thu, 22 Aug 2024 00:43:50 -0400 Subject: Remove or suppress left over debug messages in hot paths (#2392) --- indra/llcommon/llcallstack.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llcallstack.h b/indra/llcommon/llcallstack.h index ad10a9dbf7..33f2b507b8 100644 --- a/indra/llcommon/llcallstack.h +++ b/indra/llcommon/llcallstack.h @@ -79,9 +79,13 @@ struct LLContextStatus LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLContextStatus& context_status); +#ifndef LL_RELEASE_FOR_DOWNLOAD #define dumpStack(tag) \ LL_DEBUGS(tag) << "STACK:\n" \ << "====================\n" \ << LLCallStack() \ << "====================" \ << LL_ENDL; +#else +#define dumpStack(tag) +#endif -- cgit v1.2.3 From 316f0f0b8cb05515068e2acb72740fbab2365ce0 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Thu, 22 Aug 2024 09:11:28 -0700 Subject: secondlife/viewer#2391: Remove avatar rigging "callstack" logging --- indra/llcommon/CMakeLists.txt | 2 - indra/llcommon/llcallstack.cpp | 188 ----------------------------------------- indra/llcommon/llcallstack.h | 91 -------------------- 3 files changed, 281 deletions(-) delete mode 100644 indra/llcommon/llcallstack.cpp delete mode 100644 indra/llcommon/llcallstack.h (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index c4041f0c79..437b8d0168 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -26,7 +26,6 @@ set(llcommon_SOURCE_FILES llbase64.cpp llbitpack.cpp llcallbacklist.cpp - llcallstack.cpp llcleanup.cpp llcommon.cpp llcommonutils.cpp @@ -134,7 +133,6 @@ set(llcommon_HEADER_FILES llbitpack.h llboost.h llcallbacklist.h - llcallstack.h llcleanup.h llcommon.h llcommonutils.h diff --git a/indra/llcommon/llcallstack.cpp b/indra/llcommon/llcallstack.cpp deleted file mode 100644 index c0be4f598e..0000000000 --- a/indra/llcommon/llcallstack.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/** - * @file llcallstack.cpp - * @brief run-time extraction of the current callstack - * - * $LicenseInfo:firstyear=2016&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2016, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "llcommon.h" -#include "llcallstack.h" -#include "StackWalker.h" -#include "llthreadlocalstorage.h" - -#if LL_WINDOWS -class LLCallStackImpl: public StackWalker -{ -public: - LLCallStackImpl(): - StackWalker(false,0) // non-verbose, options = 0 - { - } - ~LLCallStackImpl() - { - } - void getStack(std::vector& stack, S32 skip_count=0, bool verbose=false) - { - m_stack.clear(); - ShowCallstack(verbose); - // Skip the first few lines because they're just bookkeeping for LLCallStack, - // plus any additional lines requested to skip. - S32 first_line = skip_count + 3; - for (S32 i=first_line; i m_stack; -}; -#else -// Stub - not implemented currently on other platforms. -class LLCallStackImpl -{ -public: - LLCallStackImpl() {} - ~LLCallStackImpl() {} - void getStack(std::vector& stack, S32 skip_count=0, bool verbose=false) - { - stack.clear(); - } -}; -#endif - -LLCallStackImpl *LLCallStack::s_impl = NULL; - -LLCallStack::LLCallStack(S32 skip_count, bool verbose): - m_skipCount(skip_count), - m_verbose(verbose) -{ - if (!s_impl) - { - s_impl = new LLCallStackImpl; - } - LLTimer t; - s_impl->getStack(m_strings, m_skipCount, m_verbose); -} - -bool LLCallStack::contains(const std::string& str) -{ - for (const std::string& src_str : m_strings) - { - if (src_str.find(str) != std::string::npos) - { - return true; - } - } - return false; -} - -std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack) -{ -#ifndef LL_RELEASE_FOR_DOWNLOAD - for (const std::string& str : call_stack.m_strings) - { - s << str; - } -#else - s << "UNAVAILABLE IN RELEASE"; -#endif - return s; -} - -LLContextStrings::LLContextStrings() -{ -} - -// static -LLContextStrings* LLContextStrings::getThreadLocalInstance() -{ - LLContextStrings *cons = LLThreadLocalSingletonPointer::getInstance(); - if (!cons) - { - LLThreadLocalSingletonPointer::setInstance(new LLContextStrings); - } - return LLThreadLocalSingletonPointer::getInstance(); -} - -// static -void LLContextStrings::addContextString(const std::string& str) -{ - LLContextStrings *cons = getThreadLocalInstance(); - //LL_INFOS() << "CTX " << (S32)cons << " ADD " << str << " CNT " << cons->m_contextStrings[str] << LL_ENDL; - cons->m_contextStrings[str]++; -} - -// static -void LLContextStrings::removeContextString(const std::string& str) -{ - LLContextStrings *cons = getThreadLocalInstance(); - cons->m_contextStrings[str]--; - //LL_INFOS() << "CTX " << (S32)cons << " REMOVE " << str << " CNT " << cons->m_contextStrings[str] << LL_ENDL; - if (cons->m_contextStrings[str] == 0) - { - cons->m_contextStrings.erase(str); - } -} - -// static -bool LLContextStrings::contains(const std::string& str) -{ - const std::map& strings = - LLThreadLocalSingletonPointer::getInstance()->m_contextStrings; - for (const std::map::value_type& str_pair : strings) - { - if (str_pair.first.find(str) != std::string::npos) - { - return true; - } - } - return false; -} - -// static -void LLContextStrings::output(std::ostream& os) -{ - const std::map& strings = - LLThreadLocalSingletonPointer::getInstance()->m_contextStrings; - for (const std::map::value_type& str_pair : strings) - { - os << str_pair.first << "[" << str_pair.second << "]" << "\n"; - } -} - -// static -std::ostream& operator<<(std::ostream& s, const LLContextStatus& context_status) -{ - LLThreadLocalSingletonPointer::getInstance()->output(s); - return s; -} - -bool LLContextStatus::contains(const std::string& str) -{ - return LLThreadLocalSingletonPointer::getInstance()->contains(str); -} diff --git a/indra/llcommon/llcallstack.h b/indra/llcommon/llcallstack.h deleted file mode 100644 index 33f2b507b8..0000000000 --- a/indra/llcommon/llcallstack.h +++ /dev/null @@ -1,91 +0,0 @@ -/** - * @file llcallstack.h - * @brief run-time extraction of the current callstack - * - * $LicenseInfo:firstyear=2016&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2016, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include - -class LLCallStackImpl; - -class LLCallStack -{ -public: - LLCallStack(S32 skip_count=0, bool verbose=false); - std::vector m_strings; - bool m_verbose; - bool contains(const std::string& str); -private: - static LLCallStackImpl *s_impl; - S32 m_skipCount; -}; - -LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack); - -class LLContextStrings -{ -public: - LLContextStrings(); - static void addContextString(const std::string& str); - static void removeContextString(const std::string& str); - static void output(std::ostream& os); - static LLContextStrings* getThreadLocalInstance(); - static bool contains(const std::string& str); -private: - std::map m_contextStrings; -}; - -class LLScopedContextString -{ -public: - LLScopedContextString(const std::string& str): - m_str(str) - { - LLContextStrings::addContextString(m_str); - } - ~LLScopedContextString() - { - LLContextStrings::removeContextString(m_str); - } -private: - std::string m_str; -}; - -// Mostly exists as a class to hook an ostream override to. -struct LLContextStatus -{ - bool contains(const std::string& str); -}; - -LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLContextStatus& context_status); - -#ifndef LL_RELEASE_FOR_DOWNLOAD -#define dumpStack(tag) \ - LL_DEBUGS(tag) << "STACK:\n" \ - << "====================\n" \ - << LLCallStack() \ - << "====================" \ - << LL_ENDL; -#else -#define dumpStack(tag) -#endif -- cgit v1.2.3 From 367c8f2363cebbcd6c37484d15e0863612bcc1c9 Mon Sep 17 00:00:00 2001 From: Brad Linden <46733234+brad-linden@users.noreply.github.com> Date: Mon, 26 Aug 2024 17:24:07 -0700 Subject: Improve safety of macOS available RAM calcuations at suggestion of Ansariel and Beq (#2423) --- indra/llcommon/llmemory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 99c803e46f..ba48319a16 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -129,7 +129,7 @@ void LLMemory::updateMemoryInfo() { // Our Windows definition of PagefileUsage is documented by Microsoft as "the total amount of // memory that the memory manager has committed for a running process", which is rss. - sAllocatedPageSizeInKB = U32Bytes(info.resident_size); + sAllocatedPageSizeInKB = U32Kilobytes::convert(U64Bytes(info.resident_size)); // Activity Monitor => Inspect Process => Real Memory Size appears to report resident_size // Activity monitor => main window memory column appears to report phys_footprint, which spot checks as at least 30% less. @@ -139,7 +139,7 @@ void LLMemory::updateMemoryInfo() // reported for the app by the Memory Monitor in Instruments.' It is still about 8% bigger than phys_footprint. // // (On Windows, we use WorkingSetSize.) - sAllocatedMemInKB = U32Bytes(info.resident_size - info.reusable); + sAllocatedMemInKB = U32Kilobytes::convert(U64Bytes(info.resident_size - info.reusable)); } else { -- cgit v1.2.3