From 14b1b0b2bb6bac5bc688cc4d14c33f1b680dd3b4 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 1 Oct 2012 19:39:04 -0700 Subject: SH-3275 WIP Run viewer metrics for object update messages cleaned up API samplers are now value types with copy-on-write buffers under the hood removed coupling with LLThread --- indra/llcommon/llpointer.h | 83 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 62 insertions(+), 21 deletions(-) (limited to 'indra/llcommon/llpointer.h') diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index 88c09c8dca..0fee4f0990 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -97,24 +97,13 @@ public: LLPointer& operator =(Type* ptr) { - if( mPointer != ptr ) - { - unref(); - mPointer = ptr; - ref(); - } - + assign(ptr); return *this; } LLPointer& operator =(const LLPointer& ptr) { - if( mPointer != ptr.mPointer ) - { - unref(); - mPointer = ptr.mPointer; - ref(); - } + assign(ptr); return *this; } @@ -122,12 +111,7 @@ public: template LLPointer& operator =(const LLPointer& ptr) { - if( mPointer != ptr.get() ) - { - unref(); - mPointer = ptr.get(); - ref(); - } + assign(ptr.get()); return *this; } @@ -144,6 +128,16 @@ protected: void ref(); void unref(); #else + + void assign(const LLPointer& ptr) + { + if( mPointer != ptr.mPointer ) + { + unref(); + mPointer = ptr.mPointer; + ref(); + } + } void ref() { if (mPointer) @@ -156,9 +150,9 @@ protected: { if (mPointer) { - Type *tempp = mPointer; + Type *temp = mPointer; mPointer = NULL; - tempp->unref(); + temp->unref(); if (mPointer != NULL) { llwarns << "Unreference did assignment to non-NULL because of destructor" << llendl; @@ -171,4 +165,51 @@ protected: Type* mPointer; }; +template +class LLCopyOnWritePointer : public LLPointer +{ +public: + typedef LLPointer ref_pointer_t; + typedef LLCopyOnWritePointer self_t; + + LLCopyOnWritePointer() + { + } + + LLCopyOnWritePointer(Type* ptr) + : LLPointer(ptr) + { + } + + Type* write() + { + makeUnique(); + return mPointer; + } + + void makeUnique() + { + if (mPointer && mPointer->getNumRefs() > 1) + { + ref_pointer_t::assign(new Type(*mPointer)); + } + } + + using ref_pointer_t::operator BOOL; + using ref_pointer_t::operator bool; + using ref_pointer_t::operator!; + + using ref_pointer_t::operator !=; + using ref_pointer_t::operator ==; + using LLPointer::operator =; + + using LLPointer::operator <; + using LLPointer::operator >; + + + operator const Type*() const { return mPointer; } + const Type* operator->() const { return mPointer; } + +}; + #endif -- cgit v1.2.3 From 041dfccd1ea5b59c1b3c4e37e9a5495cad342c8f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 12 Oct 2012 20:17:52 -0700 Subject: SH-3405 WIP convert existing stats to lltrace system default to double precision now fixed unit conversion logic for LLUnit renamed LLTrace::Rate to LLTrace::Count and got rid of the old count as it was confusing some const correctness changes --- indra/llcommon/llpointer.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llcommon/llpointer.h') diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index 0fee4f0990..6a3bbeb768 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -207,7 +207,9 @@ public: using LLPointer::operator >; + operator Type*() { return mPointer; } operator const Type*() const { return mPointer; } + Type* operator->() { return mPointer; } const Type* operator->() const { return mPointer; } }; -- cgit v1.2.3 From 60800dacdd7e9b66ed654af471f2b9e9680cd981 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 6 Dec 2012 00:37:15 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system fixed gcc compile error made LLCopyOnWritePointer contain an LLPointer, not derive from it added type trait to control periodicrecording mean value type --- indra/llcommon/llpointer.h | 50 +++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'indra/llcommon/llpointer.h') diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index 6a3bbeb768..f03551045e 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -166,52 +166,52 @@ protected: }; template -class LLCopyOnWritePointer : public LLPointer +class LLCopyOnWritePointer { public: - typedef LLPointer ref_pointer_t; typedef LLCopyOnWritePointer self_t; LLCopyOnWritePointer() - { - } + {} LLCopyOnWritePointer(Type* ptr) - : LLPointer(ptr) - { - } + : mPointer(ptr) + {} + + LLCopyOnWritePointer(LLPointer& ptr) + : mPointer(ptr) + {} Type* write() { makeUnique(); - return mPointer; + return mPointer.get(); } void makeUnique() { - if (mPointer && mPointer->getNumRefs() > 1) + if (mPointer.notNull() && mPointer.get()->getNumRefs() > 1) { - ref_pointer_t::assign(new Type(*mPointer)); + mPointer = new Type(*mPointer.get()); } } - using ref_pointer_t::operator BOOL; - using ref_pointer_t::operator bool; - using ref_pointer_t::operator!; - - using ref_pointer_t::operator !=; - using ref_pointer_t::operator ==; - using LLPointer::operator =; + operator BOOL() const { return (BOOL)mPointer; } + operator bool() const { return (bool)mPointer; } + bool operator!() const { return !mPointer; } + bool isNull() const { return mPointer.isNull(); } + bool notNull() const { return mPointer.notNull(); } - using LLPointer::operator <; - using LLPointer::operator >; - - - operator Type*() { return mPointer; } - operator const Type*() const { return mPointer; } - Type* operator->() { return mPointer; } - const Type* operator->() const { return mPointer; } + bool operator !=(Type* ptr) const { return (mPointer.get() != ptr); } + bool operator ==(Type* ptr) const { return (mPointer.get() == ptr); } + bool operator ==(const LLCopyOnWritePointer& ptr) const { return (mPointer == ptr.mPointer); } + bool operator < (const LLCopyOnWritePointer& ptr) const { return (mPointer < ptr.mPointer); } + bool operator > (const LLCopyOnWritePointer& ptr) const { return (mPointer > ptr.mPointer); } + operator const Type*() const { return mPointer.get(); } + const Type* operator->() const { return mPointer.get(); } +protected: + LLPointer mPointer; }; #endif -- cgit v1.2.3 From ab5106535758393e02b075d1e404e4e1fcf81abf Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 20 May 2013 19:27:50 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics 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 --- indra/llcommon/llpointer.h | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'indra/llcommon/llpointer.h') diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index f03551045e..b9a9bf1ef0 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -166,7 +166,7 @@ protected: }; template -class LLCopyOnWritePointer +class LLCopyOnWritePointer : public LLPointer { public: typedef LLCopyOnWritePointer self_t; @@ -175,43 +175,40 @@ public: {} LLCopyOnWritePointer(Type* ptr) - : mPointer(ptr) + : LLPointer(ptr) {} LLCopyOnWritePointer(LLPointer& ptr) - : mPointer(ptr) + : LLPointer(ptr) {} Type* write() { makeUnique(); - return mPointer.get(); + return mPointer; } void makeUnique() { - if (mPointer.notNull() && mPointer.get()->getNumRefs() > 1) + if (notNull() && mPointer->getNumRefs() > 1) { - mPointer = new Type(*mPointer.get()); + *(LLPointer*)(this) = new Type(*mPointer); } } + /*operator BOOL() const { return (mPointer != NULL); } + operator bool() const { return (mPointer != NULL); } + bool operator!() const { return (mPointer == NULL); } + bool isNull() const { return (mPointer == NULL); } + bool notNull() const { return (mPointer != NULL); } - operator BOOL() const { return (BOOL)mPointer; } - operator bool() const { return (bool)mPointer; } - bool operator!() const { return !mPointer; } - bool isNull() const { return mPointer.isNull(); } - bool notNull() const { return mPointer.notNull(); } - - bool operator !=(Type* ptr) const { return (mPointer.get() != ptr); } - bool operator ==(Type* ptr) const { return (mPointer.get() == ptr); } + bool operator !=(Type* ptr) const { return (mPointer != ptr); } + bool operator ==(Type* ptr) const { return (mPointer == ptr); } bool operator ==(const LLCopyOnWritePointer& ptr) const { return (mPointer == ptr.mPointer); } bool operator < (const LLCopyOnWritePointer& ptr) const { return (mPointer < ptr.mPointer); } bool operator > (const LLCopyOnWritePointer& ptr) const { return (mPointer > ptr.mPointer); } - operator const Type*() const { return mPointer.get(); } - const Type* operator->() const { return mPointer.get(); } -protected: - LLPointer mPointer; + operator const Type*() const { return mPointer; } + const Type* operator->() const { return mPointer; }*/ }; #endif -- cgit v1.2.3 From 7aeac00e444ebf3fdc73bdc4be3c47bb9ae65e43 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 21 May 2013 10:20:30 -0700 Subject: BUIDLFIX: trying to make gcc happy --- indra/llcommon/llpointer.h | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'indra/llcommon/llpointer.h') diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index b9a9bf1ef0..3273a85af1 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -175,11 +175,11 @@ public: {} LLCopyOnWritePointer(Type* ptr) - : LLPointer(ptr) + : LLPointer(ptr) {} LLCopyOnWritePointer(LLPointer& ptr) - : LLPointer(ptr) + : LLPointer(ptr) {} Type* write() @@ -190,25 +190,11 @@ public: void makeUnique() { - if (notNull() && mPointer->getNumRefs() > 1) + if (LLPointer::notNull() && mPointer->getNumRefs() > 1) { - *(LLPointer*)(this) = new Type(*mPointer); + *(LLPointer*)(this) = new Type(*mPointer); } } - /*operator BOOL() const { return (mPointer != NULL); } - operator bool() const { return (mPointer != NULL); } - bool operator!() const { return (mPointer == NULL); } - bool isNull() const { return (mPointer == NULL); } - bool notNull() const { return (mPointer != NULL); } - - bool operator !=(Type* ptr) const { return (mPointer != ptr); } - bool operator ==(Type* ptr) const { return (mPointer == ptr); } - bool operator ==(const LLCopyOnWritePointer& ptr) const { return (mPointer == ptr.mPointer); } - bool operator < (const LLCopyOnWritePointer& ptr) const { return (mPointer < ptr.mPointer); } - bool operator > (const LLCopyOnWritePointer& ptr) const { return (mPointer > ptr.mPointer); } - - operator const Type*() const { return mPointer; } - const Type* operator->() const { return mPointer; }*/ }; #endif -- cgit v1.2.3 From 269fb97eba380baf5674178294bf86fb01cd712c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 21 May 2013 10:28:21 -0700 Subject: BUILDFIX: gcc fixes --- indra/llcommon/llpointer.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'indra/llcommon/llpointer.h') diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index 3273a85af1..c83e55577d 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -170,7 +170,8 @@ class LLCopyOnWritePointer : public LLPointer { public: typedef LLCopyOnWritePointer self_t; - + typedef LLPointer pointer_t; + LLCopyOnWritePointer() {} @@ -185,14 +186,14 @@ public: Type* write() { makeUnique(); - return mPointer; + return pointer_t::mPointer; } void makeUnique() { - if (LLPointer::notNull() && mPointer->getNumRefs() > 1) + if (pointer_t::notNull() && pointer_t::mPointer->getNumRefs() > 1) { - *(LLPointer*)(this) = new Type(*mPointer); + *(pointer_t*)(this) = new Type(*pointer_t::mPointer); } } }; -- cgit v1.2.3 From 074c1f1de45f60059c97cf9cfd0bbb9fddbb52c4 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 29 May 2013 17:02:27 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics made LLCopyOnWritePointer enforce write access through write() again disabled some error checking on release for download builds --- indra/llcommon/llpointer.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llcommon/llpointer.h') diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index c83e55577d..e640ffd595 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -196,6 +196,9 @@ public: *(pointer_t*)(this) = new Type(*pointer_t::mPointer); } } + + const Type* operator->() const { return pointer_t::mPointer; } + const Type& operator*() const { return *pointer_t::mPointer; } }; #endif -- cgit v1.2.3 From 60b625588faec2472597dae50331b2ce95ce40a2 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 5 Jun 2013 19:57:07 -0700 Subject: BUILDFIX: build fixes for mac --- indra/llcommon/llpointer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon/llpointer.h') diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index e640ffd595..6a0a8fcb0d 100755 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -193,7 +193,7 @@ public: { if (pointer_t::notNull() && pointer_t::mPointer->getNumRefs() > 1) { - *(pointer_t*)(this) = new Type(*pointer_t::mPointer); + *(pointer_t* )(this) = new Type(*pointer_t::mPointer); } } -- cgit v1.2.3