<feed xmlns='http://www.w3.org/2005/Atom'>
<title>viewer.git/indra/llcommon/lltrace.h, branch main</title>
<subtitle>Megapahit's fork of the Second Life viewer.
</subtitle>
<id>https://www.megapahit.org/viewer.git/atom?h=main</id>
<link rel='self' href='https://www.megapahit.org/viewer.git/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://www.megapahit.org/viewer.git/'/>
<updated>2024-04-29T04:56:09Z</updated>
<entry>
<title>#824 Process source files in bulk: replace tabs with spaces, convert CRLF to LF, and trim trailing whitespaces as needed</title>
<updated>2024-04-29T04:56:09Z</updated>
<author>
<name>Andrey Lihatskiy</name>
<email>alihatskiy@productengine.com</email>
</author>
<published>2024-04-29T04:43:28Z</published>
<link rel='alternate' type='text/html' href='https://www.megapahit.org/viewer.git/commit/?id=1b68f71348ecf3983b76b40d7940da8377f049b7'/>
<id>urn:sha1:1b68f71348ecf3983b76b40d7940da8377f049b7</id>
<content type='text'>
</content>
</entry>
<entry>
<title>SL-18620 Statistics-&gt;Advanced-&gt;Memory Usage no longer updating</title>
<updated>2023-08-24T18:47:26Z</updated>
<author>
<name>Alexander Gavriliuk</name>
<email>alexandrgproductengine@lindenlab.com</email>
</author>
<published>2023-08-24T14:02:08Z</published>
<link rel='alternate' type='text/html' href='https://www.megapahit.org/viewer.git/commit/?id=57d784f80728f9ecd75f8dbc989cd75cf328c353'/>
<id>urn:sha1:57d784f80728f9ecd75f8dbc989cd75cf328c353</id>
<content type='text'>
</content>
</entry>
<entry>
<title>DRTVWR-575: Fix llcommon assumptions that size_t fits in 4 bytes.</title>
<updated>2022-11-03T18:58:32Z</updated>
<author>
<name>Nat Goodspeed</name>
<email>nat@lindenlab.com</email>
</author>
<published>2022-11-03T18:58:32Z</published>
<link rel='alternate' type='text/html' href='https://www.megapahit.org/viewer.git/commit/?id=9522a0b7c16414fce2103cf58bfdd63aaf0cb01b'/>
<id>urn:sha1:9522a0b7c16414fce2103cf58bfdd63aaf0cb01b</id>
<content type='text'>
It's a little distressing how often we have historically coded S32 or U32 to
pass a length or index.

There are more such assumptions in other viewer subdirectories, but this is a
start.
</content>
</entry>
<entry>
<title>SL-16606: Add profiler category STATS</title>
<updated>2022-01-14T19:50:21Z</updated>
<author>
<name>Ptolemy</name>
<email>ptolemy@lindenlab.com</email>
</author>
<published>2022-01-13T20:47:54Z</published>
<link rel='alternate' type='text/html' href='https://www.megapahit.org/viewer.git/commit/?id=31b0e8cef83780de19fc713791a30f56108b75f6'/>
<id>urn:sha1:31b0e8cef83780de19fc713791a30f56108b75f6</id>
<content type='text'>
</content>
</entry>
<entry>
<title>SL-16148 SL-16244 SL-16270 SL-16253 Remove most BlockTimers, remove LLMemTracked, introduce alignas, hook most/all reamining allocs, disable synchronous occlusion, and convert frequently accessed LLSingletons to LLSimpleton</title>
<updated>2021-10-28T18:06:21Z</updated>
<author>
<name>Dave Parks</name>
<email>davep@lindenlab.com</email>
</author>
<published>2021-10-28T18:06:21Z</published>
<link rel='alternate' type='text/html' href='https://www.megapahit.org/viewer.git/commit/?id=8d20480c5f77fe1fab8149d3cda79bdd61e77656'/>
<id>urn:sha1:8d20480c5f77fe1fab8149d3cda79bdd61e77656</id>
<content type='text'>
</content>
</entry>
<entry>
<title>DRTVWR-494: Defend LLInstanceTracker against multi-thread usage.</title>
<updated>2020-03-25T19:28:17Z</updated>
<author>
<name>Nat Goodspeed</name>
<email>nat@lindenlab.com</email>
</author>
<published>2019-12-02T19:39:24Z</published>
<link rel='alternate' type='text/html' href='https://www.megapahit.org/viewer.git/commit/?id=9d5b897600a8f9405ec37a141b9417f34a11c557'/>
<id>urn:sha1:9d5b897600a8f9405ec37a141b9417f34a11c557</id>
<content type='text'>
The previous implementation went to some effort to crash if anyone attempted
to create or destroy an LLInstanceTracker subclass instance during traversal.
That restriction is manageable within a single thread, but becomes unworkable
if it's possible that a given subclass might be used on more than one thread.

Remove LLInstanceTracker::instance_iter, beginInstances(), endInstances(),
also key_iter, beginKeys() and endKeys(). Instead, introduce key_snapshot()
and instance_snapshot(), the only means of iterating over LLInstanceTracker
instances. (These are intended to resemble functions, but in fact the current
implementation simply presents the classes.) Iterating over a captured
snapshot defends against container modifications during traversal. The term
'snapshot' reminds the coder that a new instance created during traversal will
not be considered. To defend against instance deletion during traversal, a
snapshot stores std::weak_ptrs which it lazily dereferences, skipping on the
fly any that have expired.

Dereferencing instance_snapshot::iterator gets you a reference rather than a
pointer. Because some use cases want to delete all existing instances, add an
instance_snapshot::deleteAll() method that extracts the pointer. Those cases
used to require explicitly copying instance pointers into a separate
container; instance_snapshot() now takes care of that. It remains the caller's
responsibility to ensure that all instances of that LLInstanceTracker subclass
were allocated on the heap.

Replace unkeyed static LLInstanceTracker::getInstance(T*) -- which returned
nullptr if that instance had been destroyed -- with new getWeak() method
returning std::weak_ptr&lt;T&gt;. Caller must detect expiration of that weak_ptr.

Adjust tests accordingly.

Use of std::weak_ptr to detect expired instances requires engaging
std::shared_ptr in the constructor. We now store shared_ptrs in the static
containers (std::map for keyed, std::set for unkeyed).

Make LLInstanceTrackerBase a template parameterized on the type of the static
data it manages. For that reason, hoist static data class declarations out of
the class definitions to an LLInstanceTrackerStuff namespace.

Remove the static atomic sIterationNestDepth and its methods incrementDepth(),
decrementDepth() and getDepth(), since they were used only to forbid creation
and destruction during traversal.

Add a std::mutex to static data. Introduce an internal LockStatic class that
locks the mutex while providing a pointer to static data, making that the only
way to access the static data.

The LLINSTANCETRACKER_DTOR_NOEXCEPT macro goes away because we no longer
expect ~LLInstanceTracker() to throw an exception in test programs.
That affects LLTrace::StatBase as well as LLInstanceTracker itself.

Adapt consumers to the new LLInstanceTracker API.
</content>
</entry>
<entry>
<title>DRTVWR-418: Fix -std=c++11 llinstancetracker_test crash.</title>
<updated>2017-05-08T13:09:22Z</updated>
<author>
<name>Nat Goodspeed</name>
<email>nat@lindenlab.com</email>
</author>
<published>2017-05-08T13:09:22Z</published>
<link rel='alternate' type='text/html' href='https://www.megapahit.org/viewer.git/commit/?id=322c4c6bec54b4968d0105cf1bb28bb62c6dfcbc'/>
<id>urn:sha1:322c4c6bec54b4968d0105cf1bb28bb62c6dfcbc</id>
<content type='text'>
LLInstanceTracker&lt;T&gt; performs validation in ~LLInstanceTracker(). Normally
validation failure logs an error and terminates the program, which is fine. In
the test executable, though, we want validation failure to throw an exception
instead so we can catch it and continue testing other failure conditions. But
since destructors in C++11 are implicitly noexcept(true), that exception never
made it out of ~LLInstanceTracker(): it crashed the test program instead.
Declaring ~LLInstanceTracker() noexcept(false) solves that, allowing the test
program to catch the exception and continue.

However, if we unconditionally declare that, then every destructor anywhere in
the inheritance hierarchy for any LLInstanceTracker subclass must also be
noexcept(false)! That's way too pervasive, especially for functionality we
only need (or want) in a specific test executable.

Instead, make the CMake macros LL_ADD_PROJECT_UNIT_TESTS() and
LL_ADD_INTEGRATION_TEST() -- with which we define all viewer build-time tests
-- define two new command-line macros: LL_TEST=testname and LL_TEST_testname.
That way, preprocessor logic in a header file can detect whether it's being
compiled for production code or for a test executable.

(While at it, encapsulate in a new GET_OPT_SOURCE_FILE_PROPERTY() CMake macro
an ugly repetitive pattern. The builtin GET_SOURCE_FILE_PROPERTY() sets the
target variable to "NOTFOUND" -- rather than an empty string -- if the
specified property wasn't set. Every call to GET_SOURCE_FILE_PROPERTY() in
LL_ADD_PROJECT_UNIT_TESTS() was followed by a test for NOTFOUND and an
assignment to "". Wrap all that in a macro whose 'unset' value is "".)

Now llinstancetracker.h can detect when we're building the LLInstanceTracker
unit test executable, and *only then* declare ~LLInstanceTracker() as
noexcept(false). We #define LLINSTANCETRACKER_DTOR_NOEXCEPT to expand either
empty or noexcept(false), also detecting clang in C++11 mode. (It all works
fine without noexcept(false) until we turn on C++11 mode.)

We also use that macro for the StatBase class in lltrace.h. Turns out some of
the infrastructure headers required for tests in general, including the
LLInstanceTracker test, use LLInstanceTracker. Fortunately that appears to be
the only other class we must annotate this way for the LLInstanceTracker tests.
</content>
</entry>
<entry>
<title>added LL_TRACE_ENABLED to allow disabling of lltrace</title>
<updated>2014-02-06T19:27:16Z</updated>
<author>
<name>Richard Linden</name>
<email>none@none</email>
</author>
<published>2014-02-06T19:27:16Z</published>
<link rel='alternate' type='text/html' href='https://www.megapahit.org/viewer.git/commit/?id=3040b429a3b136b87ddb0ae88ccfa3a7aa71e232'/>
<id>urn:sha1:3040b429a3b136b87ddb0ae88ccfa3a7aa71e232</id>
<content type='text'>
</content>
</entry>
<entry>
<title>SH-4634 FIX Interesting: Viewer crashes when receiving teleport offer</title>
<updated>2013-11-20T01:40:44Z</updated>
<author>
<name>Richard Linden</name>
<email>none@none</email>
</author>
<published>2013-11-20T01:40:44Z</published>
<link rel='alternate' type='text/html' href='https://www.megapahit.org/viewer.git/commit/?id=391ac367d6922f30bf3a186bc15e1fc38366eecf'/>
<id>urn:sha1:391ac367d6922f30bf3a186bc15e1fc38366eecf</id>
<content type='text'>
renamed fast timers to have unique names, changes instance tracker to never allow duplicates
</content>
</entry>
<entry>
<title>SH-4577 WIP Interesting: viewer crashed when clicking a offline Conversation containing a shared object</title>
<updated>2013-10-24T21:37:57Z</updated>
<author>
<name>Richard Linden</name>
<email>none@none</email>
</author>
<published>2013-10-24T21:37:57Z</published>
<link rel='alternate' type='text/html' href='https://www.megapahit.org/viewer.git/commit/?id=dc60a7564abf16cbf269e47cfc33ed00c6bb0870'/>
<id>urn:sha1:dc60a7564abf16cbf269e47cfc33ed00c6bb0870</id>
<content type='text'>
potential fix by making instance tracker allow key collisions for LLToastNotifyPanel
changed assertion macro to use original unpreprocessed source code
renamed instance tracker behavior macros to use LL prefix
added RestoreCameraPosOnLogin setting to optionally restore old camera positioning behavior
</content>
</entry>
</feed>
