summaryrefslogtreecommitdiff
path: root/indra/llcommon/lltrace.h
AgeCommit message (Collapse)Author
2022-11-03DRTVWR-575: Fix llcommon assumptions that size_t fits in 4 bytes.Nat Goodspeed
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.
2022-01-14SL-16606: Add profiler category STATSPtolemy
2021-10-28SL-16148 SL-16244 SL-16270 SL-16253 Remove most BlockTimers, remove ↵Dave Parks
LLMemTracked, introduce alignas, hook most/all reamining allocs, disable synchronous occlusion, and convert frequently accessed LLSingletons to LLSimpleton
2020-03-25DRTVWR-494: Defend LLInstanceTracker against multi-thread usage.Nat Goodspeed
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<T>. 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.
2017-05-08DRTVWR-418: Fix -std=c++11 llinstancetracker_test crash.Nat Goodspeed
LLInstanceTracker<T> 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.
2014-02-06added LL_TRACE_ENABLED to allow disabling of lltraceRichard Linden
2013-11-19SH-4634 FIX Interesting: Viewer crashes when receiving teleport offerRichard Linden
renamed fast timers to have unique names, changes instance tracker to never allow duplicates
2013-10-24SH-4577 WIP Interesting: viewer crashed when clicking a offline Conversation ↵Richard Linden
containing a shared object 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
2013-10-17moved root timer to global variableRichard Linden
added flag to LLInstanceTracker to allow multiple values per key made StatType allow multiple values per key to eliminate block timer related crash
2013-10-15renamed TimeBlock to BlockTimerStatHandleRichard Linden
2013-10-14changed ll_aligned_(malloc|free) to take alignment size as a template argumentRichard Linden
2013-10-07renamed TraceType to StatTypeRichard Linden
added more MemTrackable types optimized memory usage of LLTrace some more
2013-10-03more memory optimizations of lltraceRichard Linden
2013-10-03added initial memory usage tracking for lltraceRichard Linden
2013-10-01changed over to manual naming of MemTrackable statsRichard Linden
changed claimMem and disclaimMem behavior to not pass through argument added more mem tracking stats to floater_stats
2013-09-27BUILDFIX: too many argumentsRichard Linden
2013-09-27fixed lltrace memory trackingRichard Linden
image memory utilization now always non-negative
2013-09-25better memory usage for LLTrace (tighter packing of recording arrays)Richard Linden
removed complicated and unnecessary fast timer gapless handoff logic (it should be gapless anyway) improved MemTrackable API, better separation of shadow and footprint added memory usage stats to floater_stats.xml
2013-09-24converted memory tracking units to KB from BRichard Linden
added more memory tracking to LLFolderView and kin
2013-09-23refactored lltrace mem tracking to store allocation and deallocation sizesRichard Linden
at the same time and work better with threads
2013-09-19BUILDFIX: forgot forward declarationRichard Linden
better overrides for memclaim and memdisclaim of sizes added occlusion stats to stats floater stats now render range instead of mean
2013-09-19BUILDFIX: bad calls to claim_shadow_mem and disclaim_shadow_memRichard Linden
2013-09-19BUILDFIX: more bad merge stuffRichard Linden
also added ability for statbar to show memtrackable info
2013-09-18BUILDFIX: bad mergeRichard Linden
2013-09-18BUILDFIX: bad mergeRichard Linden
2013-09-18mergeRichard Linden
2013-09-08forgot to update instancetracker key when lazily generating nameRichard Linden
for memstat trace
2013-09-07memory stat for MemTrackable has name lazily initialized in an attemptRichard Linden
to get around link time error for unit tests on gcc
2013-09-07mergeRichard Linden
2013-09-07added memory usage and occlusion events to tracesRichard Linden
renamed "current" to "primary" when referring to accumulators
2013-09-05BUILDFIX: type typoRichard Linden
2013-09-05changed fast timer over to using macroRichard Linden
another attempt to move mem stat into base class
2013-08-21SH-4433 WIP Interesting: Statistics > Ping Sim is always 0 msRichard Linden
made getPrimaryAccumulator return a reference since it was an always non-null pointer changed unit conversion to perform lazy division in order to avoid truncation of timer values
2013-08-12SH-4399 FIX: Interesting: Texture console MB Bound 0/384 and texture queue ↵Richard Linden
bounces once per second SH-4346 FIX: Interesting: some integer Statistics are displayed as floating point after crossing region boundary made llerrs/infos/etc properly variadic wrt tags LL_INFOS("A", "B", "C") works, for example fixed unit tests remove llsimplestat
2013-07-18SH-4297 WIP interesting: viewer-interesting starts loading cached scene lateRichard Linden
dependency cleanup - removed a lot of unecessary includes
2013-07-08SH-4299 WIP: Interesting: High fps shown temporarily off scale in statistics ↵Richard Linden
console added percentage/ratio units added auto-range and auto tick calculation to stat bar to automate display stats
2013-07-01BUILDFIX: missed a couple of scope qualifiersRichard Linden
2013-07-01BUILDFIX: reverted changes that attempted to automate mem trackRichard Linden
stat definition as they don't work on gcc/clang
2013-07-01SH-4294 FIX Interesting: Statistics Texture cache hit rate is always 0%Richard Linden
also, removed LLTrace::init and cleanup removed derived class implementation of memory stat for LLMemTrackable is automatic now
2013-06-27Automated merge with http://bitbucket.org/lindenlab/viewer-interestingRichard Linden
2013-06-22fixed scene load monitor resetting to eagerly due to spurious camer amotionRichard Linden
pulled swap() out of ui time block cleaned up internal lltrace dependencies, factored out common accumulator definitions
2013-06-22SH-3931 WIP Interesting: Add graphs to visualize scene load metricsRichard Linden
removed LLTrace unit typedefs
2013-06-19SH-4246 FIX interesting: fast timers significantly decreases framerateRichard Linden
moved collapsed flag to fast timer tree node
2013-06-18SH-4246 FIX interesting: fast timers significantly decreases framerateRichard Linden
removed implicit flushes on reads from recorders for better performance made sure stack timers were updated on recorder deactivate faster rendering and better ui for fast timer view
2013-06-17SH-3931 WIP Interesting: Add graphs to visualize scene load metricsRichard Linden
added getAs and setAs to LLUnit to make it clearer how you specify units removed accidental 0-based indexing of periodicRecording history... should now be consistently 1-based, with 0 accessing current active recording removed per frame timer updates of all historical timer bars in fast timer display added missing assignment operator to recordings
2013-06-13SH-3931 WIP Interesting: Add graphs to visualize scene load metricsRichard Linden
changed Units macros and argument order to make it more clear optimized units for integer types fixed merging of periodicrecordings...should eliminate duplicate entries in sceneloadmonitor history
2013-06-06SH-4232 FIX: Interesting: Viewer Crash on LoginRichard Linden
2013-06-05BUILDFIX: build fixes for macRichard Linden
2013-06-05merge with viewer-releaseRichard Linden
2013-06-04SH-3931 WIP Interesting: Add graphs to visualize scene load metricsRichard Linden
fixed mem stat tracking...now properly tracks memory footprint with floating point precision cleaned up macros for unit declaration renamed units to SI standard for 1024 multiples (kibibytes, etc) fixed units output for scene monitor dump