diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/cmake/Tracy.cmake | 16 | ||||
-rw-r--r-- | indra/llcommon/CMakeLists.txt | 4 | ||||
-rw-r--r-- | indra/llcommon/llprofiler.cpp | 30 | ||||
-rw-r--r-- | indra/llcommon/llprofiler.h | 6 | ||||
-rw-r--r-- | indra/newview/CMakeLists.txt | 6 | ||||
-rwxr-xr-x | indra/newview/viewer_manifest.py | 5 |
6 files changed, 59 insertions, 8 deletions
diff --git a/indra/cmake/Tracy.cmake b/indra/cmake/Tracy.cmake index 32c02edb93..bd3c13b06a 100644 --- a/indra/cmake/Tracy.cmake +++ b/indra/cmake/Tracy.cmake @@ -4,14 +4,26 @@ include(Prebuilt) include_guard() add_library( ll::tracy INTERFACE IMPORTED ) -set(USE_TRACY OFF CACHE BOOL "Use Tracy profiler.") +option(USE_TRACY "Use Tracy profiler." OFF) if (USE_TRACY) + option(USE_TRACY_ON_DEMAND "Use Tracy profiler." ON) + option(USE_TRACY_LOCAL_ONLY "Use Tracy profiler." OFF) + use_system_binary(tracy) use_prebuilt_binary(tracy) target_include_directories( ll::tracy SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/tracy) - target_link_libraries( ll::tracy INTERFACE TracyClient ) + + target_compile_definitions(ll::tracy INTERFACE -DTRACY_ENABLE=1 -DTRACY_ONLY_IPV4=1) + + if (USE_TRACY_ON_DEMAND) + target_compile_definitions(ll::tracy INTERFACE -DTRACY_ON_DEMAND=1) + endif () + + if (USE_TRACY_LOCAL_ONLY) + target_compile_definitions(ll::tracy INTERFACE -DTRACY_NO_BROADCAST=1 -DTRACY_ONLY_LOCALHOST=1) + endif () # See: indra/llcommon/llprofiler.h add_compile_definitions(LL_PROFILER_CONFIGURATION=3) diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 8e43627a5f..165bfd52d5 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -267,6 +267,10 @@ if (DARWIN) list(APPEND llcommon_SOURCE_FILES llsys_objc.mm) endif (DARWIN) +if (USE_TRACY) + list(APPEND llcommon_SOURCE_FILES llprofiler.cpp) +endif () + list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES}) add_library (llcommon ${llcommon_SOURCE_FILES}) diff --git a/indra/llcommon/llprofiler.cpp b/indra/llcommon/llprofiler.cpp new file mode 100644 index 0000000000..bdddabf977 --- /dev/null +++ b/indra/llcommon/llprofiler.cpp @@ -0,0 +1,30 @@ +/** +* @file llprofiler.cpp +* @brief Implementation of llprofiler +* @author Rye Cogtail +* +* $LicenseInfo:firstyear=2024&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2024, 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$ +*/ + +#include "linden_common.h" + +#include "TracyClient.cpp" diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index 732436cc4f..b7d0522336 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -78,12 +78,6 @@ 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 -// 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/Tracy.hpp" // Enable OpenGL profiling diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index fbaf4e559f..7a9f3a46b5 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1776,6 +1776,7 @@ if (WINDOWS) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=$<CONFIG> "--channel=${VIEWER_CHANNEL}" @@ -1836,6 +1837,7 @@ if (WINDOWS) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=$<CONFIG> "--channel=${VIEWER_CHANNEL}" @@ -1985,6 +1987,7 @@ if (LINUX) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" @@ -2012,6 +2015,7 @@ if (LINUX) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" @@ -2087,6 +2091,7 @@ if (DARWIN) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=$<CONFIG> --bundleid=${MACOSX_BUNDLE_GUI_IDENTIFIER} @@ -2121,6 +2126,7 @@ if (DARWIN) --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" "--openal=${USE_OPENAL}" + "--tracy=${USE_TRACY}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=$<CONFIG> "--channel=${VIEWER_CHANNEL}" diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 91a9347449..b2f9654eb3 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -586,6 +586,10 @@ class Windows_x86_64_Manifest(ViewerManifest): self.path("BugSplat64.dll") self.path("BugSplatRc64.dll") + if self.args['tracy'] == 'ON': + with self.prefix(src=os.path.join(pkgdir, 'bin')): + self.path("tracy-profiler.exe") + self.path(src="licenses-win32.txt", dst="licenses.txt") self.path("featuretable.txt") self.path("cube.dae") @@ -1372,6 +1376,7 @@ if __name__ == "__main__": dict(name='bugsplat', description="""BugSplat database to which to post crashes, if BugSplat crash reporting is desired""", default=''), dict(name='openal', description="""Indication openal libraries are needed""", default='OFF'), + dict(name='tracy', description="""Indication tracy profiler is enabled""", default='OFF'), ] try: main(extra=extra_arguments) |