Commit Graph

100 Commits (e48376d29bd688d23efe2392d79d0d764d7b7e15)

Author SHA1 Message Date
Ansariel 2bbf8c4fc6 Merge branch 'master' of https://vcs.firestormviewer.org/phoenix-firestorm 2021-03-25 18:54:17 +01:00
Beq bd20cfad1d Ensure clean compile when 3p-Tracy not installed 2021-03-21 14:29:03 +00:00
Beq d640123781 Incorporate Tracy profiler as 3p 2021-03-21 14:29:03 +00:00
Ansariel 93f1998a47 Merge branch 'DRTVWR-525' of https://bitbucket.org/lindenlab/viewer 2021-01-08 23:06:41 +01:00
Dave Houlton 7cd076c796 DRTVWR-510 remove all LL_SOLARIS conditionals 2020-10-08 17:16:22 -06:00
Nat Goodspeed 9d5b897600 DRTVWR-494: Defend LLInstanceTracker against multi-thread usage.
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.
2020-03-25 15:28:17 -04:00
Nicky Dasmijn a135b5b428 Merge remote-tracking branch 'origin/ll-vs2017' into fs-vs2017 2019-12-21 13:14:51 +01:00
Nat Goodspeed b2913b7cf1 DRTVWR-494: Defend LLInstanceTracker against multi-thread usage.
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.
2019-12-02 14:39:24 -05:00
Ansariel 536a3f6c8e Merge viewer-neko 2019-01-18 23:41:21 +01:00
Ansariel 3192fe832f Merge viewer-quickgraphics 2016-03-08 01:41:31 +01:00
Oz Linden c8726aba30 remove execute permission from many files that should not have it 2015-11-10 09:48:56 -05:00
Tank_Master 6babf8abd2 Merge LL 3.7.7 2014-06-09 11:29:57 -07:00
Richard Linden 5b846ed2a6 merge with release 2014-03-12 12:48:43 -07:00
simon 2ccebebece More memory cleanup of containers after DeletePairedPointer() usage. 2014-02-14 14:57:08 -08:00
Richard Linden 3040b429a3 added LL_TRACE_ENABLED to allow disabling of lltrace 2014-02-06 11:27:16 -08:00
simon 38915f119c More memory cleanup of containers after DeletePairedPointer() usage. 2014-02-14 14:57:08 -08:00
Richard Linden ab43be5ddb moved some common functionality from LLTrace::BlockTimerStatHandle to BlockTimer
updates appearance utility dependency
2013-10-23 13:24:47 -07:00
Richard Linden 99e29b8340 crash fix - bad handling of instancetracker iterators 2013-10-18 13:10:40 -07:00
Richard Linden 1beaedacad moved root timer to global variable
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-17 14:23:56 -07:00
Richard Linden 1c26d42656 moved tree iterators into llfasttimer.h 2013-10-16 16:42:27 -07:00
Richard Linden 697d2e720b renamed TimeBlock to BlockTimerStatHandle 2013-10-15 20:24:42 -07:00
Richard Linden 17df8988fe renamed TraceType to StatType
added more MemTrackable types
optimized memory usage of LLTrace some more
2013-10-07 13:38:03 -07:00
Richard Linden 053d97db1b better memory usage for LLTrace (tighter packing of recording arrays)
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-25 19:12:35 -07:00
Richard Linden c6b6ae7a45 merge 2013-09-07 21:54:03 -07:00
Richard Linden 3fd68662f2 added memory usage and occlusion events to traces
renamed "current" to "primary" when referring to accumulators
2013-09-07 21:16:39 -07:00
Richard Linden cbe397ad13 changed fast timer over to using macro
another attempt to move mem stat into base class
2013-09-05 14:04:13 -07:00
Richard Linden a7aed07a5b broke out llunit.h into llunittype.h and llunits.h for unit declarations
changed unit declarations macros to make a lot more sense
2013-08-27 13:41:19 -07:00
Richard Linden 2c6bc5afa5 SH-4433 WIP Interesting: Statistics > Ping Sim is always 0 ms
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-21 14:06:57 -07:00
Richard Linden 3e31cb112d BUILDFIX: fixed some units errors 2013-08-19 11:50:30 -07:00
Richard Linden 9f7bfa1c37 moved unit types out of LLUnits namespace, since they are prefixed 2013-08-15 00:02:23 -07:00
Richard Linden 26581404e4 BUILDFIX: added header for numeric_limits support on gcc
added convenience types for units F32Seconds, etc.
2013-08-14 11:51:49 -07:00
Richard Linden e340009fc5 second phase summer cleaning
replace llinfos, lldebugs, etc with new LL_INFOS(), LL_DEBUGS(), etc.
2013-08-09 17:11:19 -07:00
Richard Linden 8d3daa141e SH-4374 FIX Interesting: Statistics Object cache hit rate is always 100%
moved object cache sampling code so that it actually gets executed
default values for stats are NaN instead of 0 in many cases
2013-08-09 16:14:19 -07:00
Richard Linden bd5808765f cleanup - renamed valueAs to valueInUnits and made it a symmetrical getter/setter 2013-07-31 19:32:50 -07:00
Richard Linden e40065f82c BUILDFIX: #include and dependency cleanup 2013-07-19 15:03:05 -07:00
Richard Linden 862cdf3061 SH-4297 WIP interesting: viewer-interesting starts loading cached scene late
fixed ostream precision munging in llsys
2013-07-18 15:08:46 -07:00
Richard Linden 04bdc8ba83 SH-4294 FIX Interesting: Statistics Texture cache hit rate is always 0%
also, removed LLTrace::init and cleanup
removed derived class implementation of memory stat for LLMemTrackable
is automatic now
2013-07-01 17:04:01 -07:00
Richard Linden 2fc422f39d fixed memory leak due to implementation of LLThreadLocalSingleton
removed LLThreadLocalSingleton
collapsed all thread recorder classes to single type, LLTrace::ThreadRecorder
moved fasttimer stack head to llthreadlocalsingletonpointer via ThreadRecorder
2013-06-30 13:32:34 -07:00
Richard Linden ffa7123bb5 SH-4299 FIX Interesting: High fps shown temporarily off scale in statistics console
added ability to force uniqueness of LLCopyOnWritePointer
converted more variables to units
added convenience function for unit constants
2013-06-28 20:45:20 -07:00
Dave Parks 79029149a4 Automated merge with file:///F:%5Cviewer-bear 2013-06-21 12:51:29 -05:00
Richard Linden a2a6bf20d7 merge with release 2013-06-20 16:46:23 -07:00
Richard Linden c5fc8f9006 SH-4246 FIX interesting: fast timers significantly decreases framerate
moved collapsed flag to fast timer tree node
2013-06-19 08:23:53 -07:00
Richard Linden d136c4c296 SH-4246 FIX interesting: fast timers significantly decreases framerate
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-18 23:41:53 -07:00
Richard Linden 3f2de87340 SH-3931 WIP Interesting: Add graphs to visualize scene load metrics
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-17 01:18:21 -07:00
Richard Linden 9fd3af3c38 SH-3931 WIP Interesting: Add graphs to visualize scene load metrics
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-13 15:29:15 -07:00
Richard Linden 0a96b47663 merge with viewer-release 2013-06-05 19:05:43 -07:00
Richard Linden e50e600408 SH-3931 WIP Interesting: Add graphs to visualize scene load metrics
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-30 20:15:48 -07:00
simon ee2fce8790 Merge downstream code and viewer-beta 2013-05-09 14:10:45 -07:00
Graham Madarasz 025c890958 Merge vwr-dev-mat 2013-05-01 08:11:15 -07:00
Graham Madarasz 806d09b114 Merge 3.5.1 into Materials 2013-04-30 19:50:05 -07:00