From 7d5cd52498e3da2b2438ad82fe450c923541e798 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 27 Jul 2021 15:31:15 -0700 Subject: SL-15709: Add Tracy support to viewer --- indra/llcommon/llprofiler.h | 64 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 indra/llcommon/llprofiler.h (limited to 'indra/llcommon/llprofiler.h') diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h new file mode 100644 index 0000000000..75954b9a79 --- /dev/null +++ b/indra/llcommon/llprofiler.h @@ -0,0 +1,64 @@ +/** + * @file llprofiler.h + * @brief Wrapper for Tracy and/or other profilers + * + * $LicenseInfo:firstyear=2021&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2021, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_PROFILER_H +#define LL_PROFILER_H + +#define LL_PROFILER_CONFIG_NONE 0 // No profiling +#define LL_PROFILER_CONFIG_FAST_TIMER 1 // Profiling on: Only Fast Timers +#define LL_PROFILER_CONFIG_TRACY 2 // Profiling on: Only Tracy +#define LL_PROFILER_CONFIG_TRACY_FAST_TIMER 3 // Profiling on: Fast Timers + Tracy + +#if defined(LL_PROFILER_CONFIGURATION) && (LL_PROFILER_CONFIGURATION > LL_PROFILER_CONFIG_NONE) + #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY || LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER + #define TRACY_ENABLE 1 + #define TRACY_NO_BROADCAST 1 + #define TRACY_ONLY_LOCALHOST 1 + #define TRACY_ONLY_IPV4 1 + #include "Tracy.hpp" + #endif + + #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY + #define LL_PROFILER_FRAME_END FrameMark + #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name ) + #define LL_RECORD_BLOCK_TIME(name) ZoneNamedN( ___tracy_scoped_zone, #name, true ); + #endif + #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_FAST_TIMER + #define LL_PROFILER_FRAME_END + #define LL_PROFILER_SET_THREAD_NAME( name ) (void)(name) + #define LL_RECORD_BLOCK_TIME(name) const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__); + #endif + #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER + #define LL_PROFILER_FRAME_END FrameMark + #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name ) + #define LL_RECORD_BLOCK_TIME(name) ZoneNamedN( ___tracy_scoped_zone, #timer_stat, true ) const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__); + #endif +#else + #define LL_PROFILER_FRAME_END + #define LL_PROFILER_SET_THREAD_NAME( name ) (void)(name) +#endif // LL_PROFILER + +#endif // LL_PROFILER_H -- cgit v1.2.3 From 908ce721792c7b549227e1ee23ae8b7b064ad439 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 30 Jul 2021 09:36:38 -0700 Subject: SL-15709: Default to old fast timers --- indra/llcommon/llprofiler.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llcommon/llprofiler.h') diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index 75954b9a79..29331d35bf 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -32,6 +32,8 @@ #define LL_PROFILER_CONFIG_TRACY 2 // Profiling on: Only Tracy #define LL_PROFILER_CONFIG_TRACY_FAST_TIMER 3 // Profiling on: Fast Timers + Tracy +#define LL_PROFILER_CONFIGURATION LL_PROFILER_CONFIG_FAST_TIMER + #if defined(LL_PROFILER_CONFIGURATION) && (LL_PROFILER_CONFIGURATION > LL_PROFILER_CONFIG_NONE) #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY || LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER #define TRACY_ENABLE 1 -- cgit v1.2.3 From cdf2bdafd394a97b917cc0a71b2bc8531cce40c7 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 26 Aug 2021 23:58:45 -0700 Subject: SL-15709: Add Darwin support --- indra/llcommon/llprofiler.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llcommon/llprofiler.h') diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index 29331d35bf..4674985e06 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -32,7 +32,9 @@ #define LL_PROFILER_CONFIG_TRACY 2 // Profiling on: Only Tracy #define LL_PROFILER_CONFIG_TRACY_FAST_TIMER 3 // Profiling on: Fast Timers + Tracy +#ifndef LL_PROFILER_CONFIGURATION #define LL_PROFILER_CONFIGURATION LL_PROFILER_CONFIG_FAST_TIMER +#endif #if defined(LL_PROFILER_CONFIGURATION) && (LL_PROFILER_CONFIGURATION > LL_PROFILER_CONFIG_NONE) #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY || LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER -- cgit v1.2.3 From c37cc7c3a4888fdca132613d627d7ad90517332a Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 3 Sep 2021 17:20:22 -0700 Subject: SL-15709: Windows: Include Tracy source directly; don't use a library --- indra/llcommon/llprofiler.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/llprofiler.h') diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index 4674985e06..062c9360dd 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -39,8 +39,10 @@ #if defined(LL_PROFILER_CONFIGURATION) && (LL_PROFILER_CONFIGURATION > LL_PROFILER_CONFIG_NONE) #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY || LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER #define TRACY_ENABLE 1 - #define TRACY_NO_BROADCAST 1 - #define TRACY_ONLY_LOCALHOST 1 +// Normally these would be enabled but we want to be able to build any viewer with Tracy enabled and run the Tracy server on another machine +// They must be undefined in order to work across multiple machines +// #define TRACY_NO_BROADCAST 1 +// #define TRACY_ONLY_LOCALHOST 1 #define TRACY_ONLY_IPV4 1 #include "Tracy.hpp" #endif -- cgit v1.2.3 From 7fe2856516d9e0de0fda6ff389ad3cc977b2d309 Mon Sep 17 00:00:00 2001 From: Runitai Linden Date: Mon, 13 Sep 2021 12:41:57 -0500 Subject: SL-15975 Add Tracy-only profile macros that are no-ops when Tracy is disabled. --- indra/llcommon/llprofiler.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/llcommon/llprofiler.h') diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index 062c9360dd..62e649913b 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -51,16 +51,22 @@ #define LL_PROFILER_FRAME_END FrameMark #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name ) #define LL_RECORD_BLOCK_TIME(name) ZoneNamedN( ___tracy_scoped_zone, #name, true ); + #define LL_PROFILE_ZONE_NAMED(name) ZoneNamedN( ___tracy_scoped_zone, name, true ); + #define LL_PROFILE_ZONE_SCOPED ZoneScoped #endif #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_FAST_TIMER #define LL_PROFILER_FRAME_END #define LL_PROFILER_SET_THREAD_NAME( name ) (void)(name) #define LL_RECORD_BLOCK_TIME(name) const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__); + #define LL_PROFILE_ZONE_NAMED(name) // LL_PROFILE_ZONE_NAMED is a no-op when Tracy is disabled + #define LL_PROFILE_ZONE_SCOPED // LL_PROFILE_ZONE_SCOPED is a no-op when Tracy is disabled #endif #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER #define LL_PROFILER_FRAME_END FrameMark #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name ) #define LL_RECORD_BLOCK_TIME(name) ZoneNamedN( ___tracy_scoped_zone, #timer_stat, true ) const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__); + #define LL_PROFILE_ZONE_NAMED(name) ZoneNamedN( ___tracy_scoped_zone, #name, true ); + #define LL_PROFILE_ZONE_SCOPED ZoneScoped #endif #else #define LL_PROFILER_FRAME_END -- cgit v1.2.3 From a35544c701b223ba08f0607c872d8afbb08114f5 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 21 Sep 2021 15:56:18 -0700 Subject: SL-16027: Add Tracy OpenGL support --- indra/llcommon/llprofiler.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llcommon/llprofiler.h') diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index 62e649913b..62ec20fa44 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -45,6 +45,9 @@ // #define TRACY_ONLY_LOCALHOST 1 #define TRACY_ONLY_IPV4 1 #include "Tracy.hpp" + + // Mutually exclusive with detailed memory tracing + #define LL_PROFILER_ENABLE_TRACY_OPENGL 0 #endif #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY -- cgit v1.2.3 From b9ad51981eb992ebe77b8ffbde48b2797ff55cef Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Mon, 20 Sep 2021 08:33:41 -0700 Subject: SL-16014: Add macros for better markup in Tracy --- indra/llcommon/llprofiler.h | 50 +++++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 13 deletions(-) (limited to 'indra/llcommon/llprofiler.h') diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index 62ec20fa44..59e7dc02c6 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -51,25 +51,49 @@ #endif #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY - #define LL_PROFILER_FRAME_END FrameMark - #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name ) - #define LL_RECORD_BLOCK_TIME(name) ZoneNamedN( ___tracy_scoped_zone, #name, true ); - #define LL_PROFILE_ZONE_NAMED(name) ZoneNamedN( ___tracy_scoped_zone, name, true ); - #define LL_PROFILE_ZONE_SCOPED ZoneScoped + #define LL_PROFILER_FRAME_END FrameMark + #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name ) + #define LL_RECORD_BLOCK_TIME(name) ZoneScoped // Want descriptive names; was: ZoneNamedN( ___tracy_scoped_zone, #name, true ); + #define LL_PROFILE_ZONE_NAMED(name) ZoneNamedN( ___tracy_scoped_zone, name, true ); + #define LL_PROFILE_ZONE_NAMED_COLOR(name,color) ZoneNamedNC( ___tracy_scopped_zone, name, color, true ) // RGB + #define LL_PROFILE_ZONE_SCOPED ZoneScoped + + #define LL_PROFILE_ZONE_NUM( val ) ZoneValue( val ) + #define LL_PROFILE_ZONE_TEXT( text, size ) ZoneText( text, size ) + + #define LL_PROFILE_ZONE_ERR(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0XFF0000 ) // RGB yellow + #define LL_PROFILE_ZONE_INFO(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0X00FFFF ) // RGB cyan + #define LL_PROFILE_ZONE_WARN(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0x0FFFF00 ) // RGB red #endif #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_FAST_TIMER #define LL_PROFILER_FRAME_END - #define LL_PROFILER_SET_THREAD_NAME( name ) (void)(name) + #define LL_PROFILER_SET_THREAD_NAME( name ) (void)(name) #define LL_RECORD_BLOCK_TIME(name) const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__); - #define LL_PROFILE_ZONE_NAMED(name) // LL_PROFILE_ZONE_NAMED is a no-op when Tracy is disabled - #define LL_PROFILE_ZONE_SCOPED // LL_PROFILE_ZONE_SCOPED is a no-op when Tracy is disabled + #define LL_PROFILE_ZONE_NAMED(name) // LL_PROFILE_ZONE_NAMED is a no-op when Tracy is disabled + #define LL_PROFILE_ZONE_SCOPED // LL_PROFILE_ZONE_SCOPED is a no-op when Tracy is disabled + #define LL_PRPFILE_ZONE_COLOR(name,color) // LL_RECORD_BLOCK_TIME(name) + + #define LL_PROFILE_ZONE_NUM( val ) (void)( val ); // Not supported + #define LL_PROFILE_ZONE_TEXT( text, size ) (void)( text ); void( size ); // Not supported + + #define LL_PROFILE_ZONE_ERR(name) (void)(name); // Not supported + #define LL_PROFILE_ZONE_INFO(name) (void)(name); // Not supported + #define LL_PROFILE_ZONE_WARN(name) (void)(name); // Not supported #endif #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER - #define LL_PROFILER_FRAME_END FrameMark - #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name ) - #define LL_RECORD_BLOCK_TIME(name) ZoneNamedN( ___tracy_scoped_zone, #timer_stat, true ) const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__); - #define LL_PROFILE_ZONE_NAMED(name) ZoneNamedN( ___tracy_scoped_zone, #name, true ); - #define LL_PROFILE_ZONE_SCOPED ZoneScoped + #define LL_PROFILER_FRAME_END FrameMark + #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name ) + #define LL_RECORD_BLOCK_TIME(name) ZoneScoped const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__); + #define LL_PROFILE_ZONE_NAMED(name) ZoneNamedN( ___tracy_scoped_zone, #name, true ); + #define LL_PROFILE_ZONE_NAMED_COLOR(name,color) ZoneNamedNC( ___tracy_scopped_zone, name, color, true ) // RGB + #define LL_PROFILE_ZONE_SCOPED ZoneScoped + + #define LL_PROFILE_ZONE_NUM( val ) ZoneValue( val ) + #define LL_PROFILE_ZONE_TEXT( text, size ) ZoneText( text, size ) + + #define LL_PROFILE_ZONE_ERR(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0XFF0000 ) // RGB yellow + #define LL_PROFILE_ZONE_INFO(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0X00FFFF ) // RGB cyan + #define LL_PROFILE_ZONE_WARN(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0x0FFFF00 ) // RGB red #endif #else #define LL_PROFILER_FRAME_END -- cgit v1.2.3 From 43bca9e85d7fb1e6907fbe17f527e5bc8f543411 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Wed, 22 Sep 2021 14:58:36 -0700 Subject: SL-16014: Fix typo --- indra/llcommon/llprofiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon/llprofiler.h') diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index 59e7dc02c6..49510df913 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -71,7 +71,7 @@ #define LL_RECORD_BLOCK_TIME(name) const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__); #define LL_PROFILE_ZONE_NAMED(name) // LL_PROFILE_ZONE_NAMED is a no-op when Tracy is disabled #define LL_PROFILE_ZONE_SCOPED // LL_PROFILE_ZONE_SCOPED is a no-op when Tracy is disabled - #define LL_PRPFILE_ZONE_COLOR(name,color) // LL_RECORD_BLOCK_TIME(name) + #define LL_PROFILE_ZONE_COLOR(name,color) // LL_RECORD_BLOCK_TIME(name) #define LL_PROFILE_ZONE_NUM( val ) (void)( val ); // Not supported #define LL_PROFILE_ZONE_TEXT( text, size ) (void)( text ); void( size ); // Not supported -- cgit v1.2.3 From 647d0224d321c706ba5936905db4265becde9d8e Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 25 Oct 2021 21:11:03 +0000 Subject: SL-16243 Add Tracy timers to global new/delete overrides. --- indra/llcommon/llprofiler.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/llprofiler.h') diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index 49510df913..e36f693dd3 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -36,6 +36,8 @@ #define LL_PROFILER_CONFIGURATION LL_PROFILER_CONFIG_FAST_TIMER #endif +extern thread_local bool gProfilerEnabled; + #if defined(LL_PROFILER_CONFIGURATION) && (LL_PROFILER_CONFIGURATION > LL_PROFILER_CONFIG_NONE) #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY || LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER #define TRACY_ENABLE 1 @@ -52,7 +54,7 @@ #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY #define LL_PROFILER_FRAME_END FrameMark - #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name ) + #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name ); gProfilerEnabled = true; #define LL_RECORD_BLOCK_TIME(name) ZoneScoped // Want descriptive names; was: ZoneNamedN( ___tracy_scoped_zone, #name, true ); #define LL_PROFILE_ZONE_NAMED(name) ZoneNamedN( ___tracy_scoped_zone, name, true ); #define LL_PROFILE_ZONE_NAMED_COLOR(name,color) ZoneNamedNC( ___tracy_scopped_zone, name, color, true ) // RGB @@ -82,7 +84,7 @@ #endif #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER #define LL_PROFILER_FRAME_END FrameMark - #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name ) + #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name ); gProfilerEnabled = true; #define LL_RECORD_BLOCK_TIME(name) ZoneScoped const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__); #define LL_PROFILE_ZONE_NAMED(name) ZoneNamedN( ___tracy_scoped_zone, #name, true ); #define LL_PROFILE_ZONE_NAMED_COLOR(name,color) ZoneNamedNC( ___tracy_scopped_zone, name, color, true ) // RGB -- cgit v1.2.3 From 8d20480c5f77fe1fab8149d3cda79bdd61e77656 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 28 Oct 2021 18:06:21 +0000 Subject: 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 --- indra/llcommon/llprofiler.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/llcommon/llprofiler.h') diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index e36f693dd3..ca60d23248 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -66,6 +66,8 @@ extern thread_local bool gProfilerEnabled; #define LL_PROFILE_ZONE_ERR(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0XFF0000 ) // RGB yellow #define LL_PROFILE_ZONE_INFO(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0X00FFFF ) // RGB cyan #define LL_PROFILE_ZONE_WARN(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0x0FFFF00 ) // RGB red + #define LL_PROFILE_ALLOC(ptr, size) TracyAlloc(ptr, size) + #define LL_PROFILE_FREE(ptr) TracyFree(ptr) #endif #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_FAST_TIMER #define LL_PROFILER_FRAME_END @@ -81,11 +83,13 @@ extern thread_local bool gProfilerEnabled; #define LL_PROFILE_ZONE_ERR(name) (void)(name); // Not supported #define LL_PROFILE_ZONE_INFO(name) (void)(name); // Not supported #define LL_PROFILE_ZONE_WARN(name) (void)(name); // Not supported + #define LL_PROFILE_ALLOC(ptr, size) (void)(ptr); (void)(size); + #define LL_PROFILE_FREE(ptr) (void)(ptr); #endif #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER #define LL_PROFILER_FRAME_END FrameMark #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name ); gProfilerEnabled = true; - #define LL_RECORD_BLOCK_TIME(name) ZoneScoped const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__); + #define LL_RECORD_BLOCK_TIME(name) ZoneNamedN(___tracy_scoped_zone, #name, true); const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__); #define LL_PROFILE_ZONE_NAMED(name) ZoneNamedN( ___tracy_scoped_zone, #name, true ); #define LL_PROFILE_ZONE_NAMED_COLOR(name,color) ZoneNamedNC( ___tracy_scopped_zone, name, color, true ) // RGB #define LL_PROFILE_ZONE_SCOPED ZoneScoped @@ -96,6 +100,8 @@ extern thread_local bool gProfilerEnabled; #define LL_PROFILE_ZONE_ERR(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0XFF0000 ) // RGB yellow #define LL_PROFILE_ZONE_INFO(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0X00FFFF ) // RGB cyan #define LL_PROFILE_ZONE_WARN(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0x0FFFF00 ) // RGB red + #define LL_PROFILE_ALLOC(ptr, size) TracyAlloc(ptr, size) + #define LL_PROFILE_FREE(ptr) TracyFree(ptr) #endif #else #define LL_PROFILER_FRAME_END -- cgit v1.2.3 From f9031ee02d19afe01023936eacc867dcdef01861 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 13 Jan 2022 11:22:56 -0800 Subject: SL-16606: Include profiler categories automatically --- indra/llcommon/llprofiler.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'indra/llcommon/llprofiler.h') diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index ca60d23248..f9d7ae7ce4 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -27,6 +27,44 @@ #ifndef LL_PROFILER_H #define LL_PROFILER_H +// If you use the default macros LL_PROFILE_ZONE_SCOPED and LL_PROFILE_ZONE_NAMED to profile code ... +// +// void foo() +// { +// LL_PROFILE_ZONE_SCOPED; +// : +// +// { +// LL_PROFILE_ZONE_NAMED("widget bar"); +// : +// } +// { +// LL_PROFILE_ZONE_NAMED("widget qux"); +// : +// } +// } +// +// ... please be aware that ALL these will show up in a Tracy capture which can quickly exhaust memory. +// Instead, use LL_PROFILE_ZONE_SCOPED_CATEGORY_* and LL_PROFILE_ZONE_NAMED_CATEGORY_* to profile code ... +// +// void foo() +// { +// LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; +// : +// +// { +// LL_PROFILE_ZONE_NAMED_CATEGORY_UI("widget bar"); +// : +// } +// { +// LL_PROFILE_ZONE_NAMED_CATEGORY_UI("widget qux"); +// : +// } +// } +// +// ... as these can be selectively turned on/off. This will minimize memory usage and visual clutter in a Tracy capture. +// See llprofiler_categories.h for more details on profiling categories. + #define LL_PROFILER_CONFIG_NONE 0 // No profiling #define LL_PROFILER_CONFIG_FAST_TIMER 1 // Profiling on: Only Fast Timers #define LL_PROFILER_CONFIG_TRACY 2 // Profiling on: Only Tracy @@ -108,4 +146,6 @@ extern thread_local bool gProfilerEnabled; #define LL_PROFILER_SET_THREAD_NAME( name ) (void)(name) #endif // LL_PROFILER +#include "llprofilercategories.h" + #endif // LL_PROFILER_H -- cgit v1.2.3