summaryrefslogtreecommitdiff
path: root/indra/llcommon/lltracethreadrecorder.cpp
AgeCommit message (Collapse)Author
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.
2014-02-06added LL_TRACE_ENABLED to allow disabling of lltraceRichard Linden
2014-01-10added some defensive asserts in lltrace to make cases of misuse more obvious ↵Richard Linden
when it crashes
2013-12-10SH-4653 FIX Interesting: Viewer crashes while reading chat historyRichard Linden
fix for crash on exit resulting from 8c0e024d0c33
2013-12-03SH-4606 FIX Interesting: Small objects do not load until they are very close.Richard Linden
changed culling to use inverse distance to calculate solid angle, not distance squared
2013-10-23moved some common functionality from LLTrace::BlockTimerStatHandle to BlockTimerRichard Linden
updates appearance utility dependency
2013-10-21fixed things so that trace recordings can be read from even while activeRichard Linden
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-03fixed memory tracking of lltrace systemRichard Linden
2013-10-03added initial memory usage tracking for lltraceRichard Linden
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-18mergeRichard Linden
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-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-09second phase summer cleaningRichard Linden
replace llinfos, lldebugs, etc with new LL_INFOS(), LL_DEBUGS(), etc.
2013-07-15SH-4299Interesting: High fps shown temporarily off scale in statistics consoleRichard Linden
various fixes to lltrace start() on started recording no longer resets fixed various instances of unit forgetfullness in lltrace recording split now has gapless timing scene monitor now guarantees min sample time renamed a bunch of stats added names to debug thread view on windows
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-30fixed memory leak due to implementation of LLThreadLocalSingletonRichard Linden
removed LLThreadLocalSingleton collapsed all thread recorder classes to single type, LLTrace::ThreadRecorder moved fasttimer stack head to llthreadlocalsingletonpointer via ThreadRecorder
2013-06-28SH-4299 FIX Interesting: High fps shown temporarily off scale in statistics ↵Richard Linden
console added ability to force uniqueness of LLCopyOnWritePointer converted more variables to units added convenience function for unit constants
2013-06-27SH-4299 WIP: Interesting: High fps shown temporarily off scale in statistics ↵Richard Linden
console fixed some lltrace logic errors more consistent syncing of timestamps of sample values in recording stack selection of primary buffers was completely incorrect assignment of recordings got wrong play state due to implicit operator = defined in base class fixed asset stats only working up to the first send
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-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-02SH-3931 WIP Interesting: Add graphs to visualize scene load metricsRichard Linden
removed unnecessary templates from accumulator types...now always track data in double precision floating point, using templated accessors to convert to and from arbitrary types
2013-05-31SH-3931 WIP Interesting: Add graphs to visualize scene load metricsRichard Linden
fixed multithreading lltrace causing values to be interpolated towards 0 added Radians unit improved sceneloadmonitor restart heuristic to use accumulated camera motion
2013-05-30SH-3931 WIP Interesting: Add graphs to visualize scene load metricsRichard Linden
reverted SlaveThreadRecorder update gating moved processTimes() outside of Recording, so it is called only once per frame refined sample merge logic so that multi-threaded samples do not stomp on linear history of a stat
2013-05-30SH-3931 WIP Interesting: Add graphs to visualize scene load metricsRichard Linden
fixed LLTrace::ExtendablePeriodicRecording::extend() to include *all* frame extensions gated SlaveThreadRecorder pushing to master based on master update rate reverted changes to LLThreadLocalSingletonPointer to not use offset-from-default trick
2013-05-29SH-3931 WIP Interesting: Add graphs to visualize scene load metricsRichard Linden
fixed copy construction behavior of Recordings to not zero out data split measurement into event and sample, with sample representing a continuous function
2013-05-20SH-3931 WIP Interesting: Add graphs to visualize scene load metricsRichard Linden
removed extra dereference for copy on write pointer moved copyonwrite mechanism to RecordingBuffers from individual buffer fixed logic that was leaving scene unfrozen when camera moved during metrics gathering
2013-03-11separated RecordingBuffers from Recording to make active recording stack ↵Richard Linden
more safe (part 2)
2013-03-11renamed some variables/methods in LLTrace to make things clearerRichard Linden
2013-01-27SH-3275 WIP interesting Update viewer metrics system to be more flexibleRichard Linden
fixed memory leak fixed glitching of fast timer display
2013-01-18SH-3406 WIP convert fast timers to lltrace systemRichard Linden
fixed crash on startup
2013-01-17SH-3406 WIP convert fast timers to lltrace systemRichard Linden
fixed some uninitialized variables root timer accumulator was being initialized to NULL
2013-01-14SH-3406 WIP convert fast timers to lltrace systemRichard Linden
improved performance of fast timer stat gathering (fixed typo)
2013-01-14SH-3406 WIP convert fast timers to lltrace systemRichard Linden
improved performance of fast timer stat gathering
2013-01-06SH-3468 WIP add memory tracking base classRichard Linden
fix for unit test failures...cleanup apr without destroying pools, allowing LLProxy to clean itself up as a singleton (and avoiding spurious dependencies associated with manually destorying singletons that rely on apr pools)
2013-01-03SH-3406 WIP convert fast timers to lltrace systemRichard Linden
made fast timer stack thread local added LLThreadLocalSingleton made LLThreadLocalPointer obey pointer rules for const added LLThreadLocalSingletonPointer for fast thread local pointers
2012-12-21SH-3468 WIP add memory tracking base classRichard Linden
improvements on lifetime of lltrace core data structures tweaks to thread local pointer handling so that static constructors/destructors can safely call functions that use lltrace
2012-12-18SH-3406 WIP convert fast timers to lltrace systemRichard Linden
removed some potential data races got memory stats recording in trace system
2012-12-03SH-3406 WIP convert fast timers to lltrace systemRichard Linden
converted fast timer view over to new lltrace mechanisms
2012-11-29SH-3406 WIP convert fast timers to lltrace systemRichard Linden
moved runtime timer tree topology information to separate array instead of recording stack
2012-11-27SH-3406 WIP convert fast timers to lltrace systemRichard Linden
hunting down bad values and crashes
2012-11-16SH-3406 WIP convert fast timers to lltrace systemRichard Linden
got new fast timer code to compile and run
2012-11-14SH-3406 WIP convert fast timers to lltrace systemRichard Linden
cleaning up build moved most includes of windows.h to llwin32headers.h to disable min/max macros, etc streamlined Time class and consolidated functionality in BlockTimer class llfasttimer is no longer included via llstring.h, so had to add it manually in several places
2012-11-07SH-3499 WIP Ensure asset stats output is correctRichard Linden
fixed trace data gathering and routing from background thread simplified slave->master thread communication (eliminated redundant recording and proxy object) improved performance of fast timer data gathering (slow iterators)
2012-11-05SH-3499 WIP Ensure asset stats output is correctRichard Linden
fixed copy behavior of recordings and accumulator buffers
2012-11-01SH-3405 FIX convert existing stats to lltrace systemRichard Linden
output of floater_stats is now identical to pre-lltrace system (with some tweaks)