Merge pull request #2282 from RyeMutt/tracy-update
Update tracy to 0.11 and improve developer experiencemeow-7.2.2
commit
31774e82c4
|
|
@ -2371,11 +2371,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>a901a14066daf8c8796c8d2914917129427fd80b</string>
|
||||
<string>226225ec049826c35adc5e897e0398ed64d4bedb</string>
|
||||
<key>hash_algorithm</key>
|
||||
<string>sha1</string>
|
||||
<key>url</key>
|
||||
<string>https://github.com/secondlife/3p-tracy/releases/download/v0.10.0%2Br1/tracy-v0.10.0.9845715133-darwin64-9845715133.tar.zst</string>
|
||||
<string>https://github.com/secondlife/3p-tracy/releases/download/v0.11.0%2Br1/tracy-v0.11.0.10376230034-darwin64-10376230034.tar.zst</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>darwin64</string>
|
||||
|
|
@ -2385,11 +2385,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>ca5fc66e3431278f20286261ffe85192bbd9a2ca</string>
|
||||
<string>8c5429d1a1486f40cf7e5e88a232222d1fa4f78e</string>
|
||||
<key>hash_algorithm</key>
|
||||
<string>sha1</string>
|
||||
<key>url</key>
|
||||
<string>https://github.com/secondlife/3p-tracy/releases/download/v0.10.0%2Br1/tracy-v0.10.0.9845715133-windows64-9845715133.tar.zst</string>
|
||||
<string>https://github.com/secondlife/3p-tracy/releases/download/v0.11.0%2Br1/tracy-v0.11.0.10376230034-windows64-10376230034.tar.zst</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>windows64</string>
|
||||
|
|
@ -2399,11 +2399,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>e6f53d513c238ad599b75a8b5f94b8b0d1315438</string>
|
||||
<string>ed0664a009aba1dcf1246d845839f524e857162e</string>
|
||||
<key>hash_algorithm</key>
|
||||
<string>sha1</string>
|
||||
<key>url</key>
|
||||
<string>https://github.com/secondlife/3p-tracy/releases/download/v0.10.0%2Br1/tracy-v0.10.0.9845715133-linux64-9845715133.tar.zst</string>
|
||||
<string>https://github.com/secondlife/3p-tracy/releases/download/v0.11.0%2Br1/tracy-v0.11.0.10376230034-linux64-10376230034.tar.zst</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>linux64</string>
|
||||
|
|
@ -2414,9 +2414,9 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
|
|||
<key>license_file</key>
|
||||
<string>LICENSES/tracy_license.txt</string>
|
||||
<key>copyright</key>
|
||||
<string>Copyright (c) 2017-2022, Bartosz Taudul (wolf@nereid.pl)</string>
|
||||
<string>Copyright (c) 2017-2024, Bartosz Taudul (wolf@nereid.pl)</string>
|
||||
<key>version</key>
|
||||
<string>v0.10.0.9845715133</string>
|
||||
<string>v0.11.0.10376230034</string>
|
||||
<key>name</key>
|
||||
<string>tracy</string>
|
||||
<key>canonical_repo</key>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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})
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@
|
|||
#include "llsingleton.h"
|
||||
#include "llstl.h"
|
||||
#include "lltimer.h"
|
||||
#include "llprofiler.h"
|
||||
|
||||
// On Mac, got:
|
||||
// #error "Boost.Stacktrace requires `_Unwind_Backtrace` function. Define
|
||||
|
|
@ -506,7 +507,7 @@ namespace
|
|||
LLError::TimeFunction mTimeFunction;
|
||||
|
||||
Recorders mRecorders;
|
||||
LLCoros::RMutex mRecorderMutex;
|
||||
LL_PROFILE_MUTEX_NAMED(LLCoros::RMutex, mRecorderMutex, "Log Recorders");
|
||||
|
||||
int mShouldLogCallCounter;
|
||||
|
||||
|
|
@ -529,7 +530,6 @@ namespace
|
|||
mCrashFunction(NULL),
|
||||
mTimeFunction(NULL),
|
||||
mRecorders(),
|
||||
mRecorderMutex(),
|
||||
mShouldLogCallCounter(0)
|
||||
{
|
||||
}
|
||||
|
|
@ -1044,7 +1044,7 @@ namespace LLError
|
|||
return;
|
||||
}
|
||||
SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig();
|
||||
std::unique_lock lock(s->mRecorderMutex);
|
||||
std::unique_lock lock(s->mRecorderMutex); LL_PROFILE_MUTEX_LOCK(s->mRecorderMutex);
|
||||
s->mRecorders.push_back(recorder);
|
||||
}
|
||||
|
||||
|
|
@ -1055,7 +1055,7 @@ namespace LLError
|
|||
return;
|
||||
}
|
||||
SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig();
|
||||
std::unique_lock lock(s->mRecorderMutex);
|
||||
std::unique_lock lock(s->mRecorderMutex); LL_PROFILE_MUTEX_LOCK(s->mRecorderMutex);
|
||||
s->mRecorders.erase(std::remove(s->mRecorders.begin(), s->mRecorders.end(), recorder),
|
||||
s->mRecorders.end());
|
||||
}
|
||||
|
|
@ -1104,7 +1104,7 @@ namespace LLError
|
|||
std::shared_ptr<RECORDER> findRecorder()
|
||||
{
|
||||
SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig();
|
||||
std::unique_lock lock(s->mRecorderMutex);
|
||||
std::unique_lock lock(s->mRecorderMutex); LL_PROFILE_MUTEX_LOCK(s->mRecorderMutex);
|
||||
return findRecorderPos<RECORDER>(s).first;
|
||||
}
|
||||
|
||||
|
|
@ -1115,7 +1115,7 @@ namespace LLError
|
|||
bool removeRecorder()
|
||||
{
|
||||
SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig();
|
||||
std::unique_lock lock(s->mRecorderMutex);
|
||||
std::unique_lock lock(s->mRecorderMutex); LL_PROFILE_MUTEX_LOCK(s->mRecorderMutex);
|
||||
auto found = findRecorderPos<RECORDER>(s);
|
||||
if (found.first)
|
||||
{
|
||||
|
|
@ -1221,7 +1221,7 @@ namespace
|
|||
|
||||
std::string escaped_message;
|
||||
|
||||
std::unique_lock lock(s->mRecorderMutex);
|
||||
std::unique_lock lock(s->mRecorderMutex); LL_PROFILE_MUTEX_LOCK(s->mRecorderMutex);
|
||||
for (LLError::RecorderPtr& r : s->mRecorders)
|
||||
{
|
||||
if (!r->enabled())
|
||||
|
|
@ -1280,24 +1280,21 @@ namespace
|
|||
}
|
||||
|
||||
namespace {
|
||||
// We need a couple different mutexes, but we want to use the same mechanism
|
||||
// for both. Make getMutex() a template function with different instances
|
||||
// for different MutexDiscriminator values.
|
||||
enum MutexDiscriminator
|
||||
{
|
||||
LOG_MUTEX,
|
||||
STACKS_MUTEX
|
||||
};
|
||||
// Some logging calls happen very early in processing -- so early that our
|
||||
// module-static variables aren't yet initialized. getMutex() wraps a
|
||||
// function-static LLMutex so that early calls can still have a valid
|
||||
// LLMutex instance.
|
||||
template <MutexDiscriminator MTX>
|
||||
LLMutex* getMutex()
|
||||
auto getLogMutex()
|
||||
{
|
||||
// guaranteed to be initialized the first time control reaches here
|
||||
static LLMutex sMutex;
|
||||
return &sMutex;
|
||||
static LL_PROFILE_MUTEX_NAMED(std::recursive_mutex, sLogMutex, "Log Mutex");
|
||||
return &sLogMutex;
|
||||
}
|
||||
auto getStacksMutex()
|
||||
{
|
||||
// guaranteed to be initialized the first time control reaches here
|
||||
static LL_PROFILE_MUTEX_NAMED(std::recursive_mutex, sStacksMutex, "Stacks Mutex");
|
||||
return &sStacksMutex;
|
||||
}
|
||||
|
||||
bool checkLevelMap(const LevelMap& map, const std::string& key,
|
||||
|
|
@ -1347,8 +1344,8 @@ namespace LLError
|
|||
bool Log::shouldLog(CallSite& site)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_LOGGING;
|
||||
LLMutexTrylock lock(getMutex<LOG_MUTEX>(), 5);
|
||||
if (!lock.isLocked())
|
||||
std::unique_lock lock(*getLogMutex(), std::try_to_lock); LL_PROFILE_MUTEX_LOCK(*getLogMutex());
|
||||
if (!lock)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1392,8 +1389,8 @@ namespace LLError
|
|||
void Log::flush(const std::ostringstream& out, const CallSite& site)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_LOGGING;
|
||||
LLMutexTrylock lock(getMutex<LOG_MUTEX>(),5);
|
||||
if (!lock.isLocked())
|
||||
std::unique_lock lock(*getLogMutex(), std::try_to_lock); LL_PROFILE_MUTEX_LOCK(*getLogMutex());
|
||||
if (!lock)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -1523,8 +1520,8 @@ namespace LLError
|
|||
//static
|
||||
void LLCallStacks::push(const char* function, const int line)
|
||||
{
|
||||
LLMutexTrylock lock(getMutex<STACKS_MUTEX>(), 5);
|
||||
if (!lock.isLocked())
|
||||
std::unique_lock lock(*getStacksMutex(), std::try_to_lock); LL_PROFILE_MUTEX_LOCK(*getStacksMutex());
|
||||
if (!lock)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -1548,8 +1545,8 @@ namespace LLError
|
|||
//static
|
||||
void LLCallStacks::end(const std::ostringstream& out)
|
||||
{
|
||||
LLMutexTrylock lock(getMutex<STACKS_MUTEX>(), 5);
|
||||
if (!lock.isLocked())
|
||||
std::unique_lock lock(*getStacksMutex(), std::try_to_lock); LL_PROFILE_MUTEX_LOCK(*getStacksMutex());
|
||||
if (!lock)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -1565,8 +1562,8 @@ namespace LLError
|
|||
//static
|
||||
void LLCallStacks::print()
|
||||
{
|
||||
LLMutexTrylock lock(getMutex<STACKS_MUTEX>(), 5);
|
||||
if (!lock.isLocked())
|
||||
std::unique_lock lock(*getStacksMutex(), std::try_to_lock); LL_PROFILE_MUTEX_LOCK(*getStacksMutex());
|
||||
if (!lock)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace LLInstanceTrackerPrivate
|
|||
struct StaticBase
|
||||
{
|
||||
// We need to be able to lock static data while manipulating it.
|
||||
std::mutex mMutex;
|
||||
LL_PROFILE_MUTEX_NAMED(std::mutex, mMutex, "InstanceTracker Data");
|
||||
};
|
||||
|
||||
void logerrs(const char* cls, const std::string&, const std::string&, const std::string&);
|
||||
|
|
@ -101,7 +101,8 @@ public:
|
|||
|
||||
static size_t instanceCount()
|
||||
{
|
||||
return LockStatic()->mMap.size();
|
||||
LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex);
|
||||
return lock->mMap.size();
|
||||
}
|
||||
|
||||
// snapshot of std::pair<const KEY, std::shared_ptr<SUBCLASS>> pairs, for
|
||||
|
|
@ -236,7 +237,7 @@ public:
|
|||
|
||||
static ptr_t getInstance(const KEY& k)
|
||||
{
|
||||
LockStatic lock;
|
||||
LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex);
|
||||
const InstanceMap& map(lock->mMap);
|
||||
typename InstanceMap::const_iterator found = map.find(k);
|
||||
return (found == map.end()) ? NULL : found->second;
|
||||
|
|
@ -252,19 +253,19 @@ protected:
|
|||
ptr_t ptr(static_cast<T*>(this), [](T*){});
|
||||
// save corresponding weak_ptr for future reference
|
||||
mSelf = ptr;
|
||||
LockStatic lock;
|
||||
LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex);
|
||||
add_(lock, key, ptr);
|
||||
}
|
||||
public:
|
||||
virtual ~LLInstanceTracker()
|
||||
{
|
||||
LockStatic lock;
|
||||
LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex);
|
||||
remove_(lock);
|
||||
}
|
||||
protected:
|
||||
virtual void setKey(KEY key)
|
||||
{
|
||||
LockStatic lock;
|
||||
LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex);
|
||||
// Even though the shared_ptr we store in our map has a no-op deleter
|
||||
// for T itself, letting the use count decrement to 0 will still
|
||||
// delete the use-count object. Capture the shared_ptr we just removed
|
||||
|
|
@ -376,7 +377,8 @@ public:
|
|||
|
||||
static size_t instanceCount()
|
||||
{
|
||||
return LockStatic()->mSet.size();
|
||||
LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex);
|
||||
return lock->mSet.size();
|
||||
}
|
||||
|
||||
// snapshot of std::shared_ptr<SUBCLASS> pointers
|
||||
|
|
@ -488,14 +490,16 @@ protected:
|
|||
// save corresponding weak_ptr for future reference
|
||||
mSelf = ptr;
|
||||
// Also store it in our class-static set to track this instance.
|
||||
LockStatic()->mSet.emplace(ptr);
|
||||
LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex);
|
||||
lock->mSet.emplace(ptr);
|
||||
}
|
||||
public:
|
||||
virtual ~LLInstanceTracker()
|
||||
{
|
||||
// convert weak_ptr to shared_ptr because that's what we store in our
|
||||
// InstanceSet
|
||||
LockStatic()->mSet.erase(mSelf.lock());
|
||||
LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex);
|
||||
lock->mSet.erase(mSelf.lock());
|
||||
}
|
||||
protected:
|
||||
LLInstanceTracker(const LLInstanceTracker& other):
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -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
|
||||
|
|
@ -108,6 +102,12 @@ 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_MUTEX(type, varname) TracyLockable(type, varname)
|
||||
#define LL_PROFILE_MUTEX_NAMED(type, varname, desc) TracyLockableN(type, varname, desc)
|
||||
#define LL_PROFILE_MUTEX_SHARED(type, varname) TracySharedLockable(type, varname)
|
||||
#define LL_PROFILE_MUTEX_SHARED_NAMED(type, varname, desc) TracySharedLockableN(type, varname, desc)
|
||||
#define LL_PROFILE_MUTEX_LOCK(varname) { auto& mutex = varname; LockMark(mutex); }
|
||||
#endif
|
||||
#if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_FAST_TIMER
|
||||
#define LL_PROFILER_FRAME_END
|
||||
|
|
@ -124,6 +124,12 @@ 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_MUTEX(type, varname) type varname
|
||||
#define LL_PROFILE_MUTEX_NAMED(type, varname, desc) type varname
|
||||
#define LL_PROFILE_MUTEX_SHARED(type, varname) type varname
|
||||
#define LL_PROFILE_MUTEX_SHARED_NAMED(type, varname, desc) type varname
|
||||
#define LL_PROFILE_MUTEX_LOCK(varname) // LL_PROFILE_MUTEX_LOCK 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
|
||||
|
|
@ -139,6 +145,12 @@ 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_MUTEX(type, varname) TracyLockable(type, varname)
|
||||
#define LL_PROFILE_MUTEX_NAMED(type, varname, desc) TracyLockableN(type, varname, desc)
|
||||
#define LL_PROFILE_MUTEX_SHARED(type, varname) TracySharedLockable(type, varname)
|
||||
#define LL_PROFILE_MUTEX_SHARED_NAMED(type, varname, desc) TracySharedLockableN(type, varname, desc)
|
||||
#define LL_PROFILE_MUTEX_LOCK(varname) { auto& mutex = varname; LockMark(mutex); } // see https://github.com/wolfpld/tracy/issues/575
|
||||
#endif
|
||||
#else
|
||||
#define LL_PROFILER_FRAME_END
|
||||
|
|
|
|||
|
|
@ -59,9 +59,8 @@ private:
|
|||
// it's safe to log -- which involves querying a different LLSingleton --
|
||||
// which requires accessing the master list.
|
||||
typedef std::recursive_mutex mutex_t;
|
||||
typedef std::unique_lock<mutex_t> lock_t;
|
||||
|
||||
mutex_t mMutex;
|
||||
LL_PROFILE_MUTEX_NAMED(mutex_t, mMutex, "Singleton MasterList");
|
||||
typedef std::unique_lock<decltype(mMutex)> lock_t;
|
||||
|
||||
public:
|
||||
// Instantiate this to both obtain a reference to MasterList::instance()
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@
|
|||
#include "lockstatic.h"
|
||||
#include "llthread.h" // on_main_thread()
|
||||
#include "llmainthreadtask.h"
|
||||
#include "llprofiler.h"
|
||||
#include "llerror.h"
|
||||
|
||||
#ifdef LL_WINDOWS
|
||||
#pragma warning(push)
|
||||
|
|
@ -298,7 +300,7 @@ private:
|
|||
// Use a recursive_mutex in case of constructor circularity. With a
|
||||
// non-recursive mutex, that would result in deadlock.
|
||||
typedef std::recursive_mutex mutex_t;
|
||||
mutex_t mMutex; // LockStatic looks for mMutex
|
||||
LL_PROFILE_MUTEX_NAMED(mutex_t, mMutex, "Singleton Data"); // LockStatic looks for mMutex
|
||||
|
||||
EInitState mInitState{UNINITIALIZED};
|
||||
DERIVED_TYPE* mInstance{nullptr};
|
||||
|
|
@ -420,7 +422,7 @@ protected:
|
|||
// deleteSingleton() to defend against manual deletion. When we moved
|
||||
// cleanup to deleteSingleton(), we hit crashes due to dangling
|
||||
// pointers in the MasterList.
|
||||
LockStatic lk;
|
||||
LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex);
|
||||
lk->mInstance = nullptr;
|
||||
lk->mInitState = DELETED;
|
||||
|
||||
|
|
@ -448,7 +450,7 @@ public:
|
|||
// Hold the lock while we call cleanupSingleton() and the destructor.
|
||||
// Our destructor also instantiates LockStatic, requiring a recursive
|
||||
// mutex.
|
||||
LockStatic lk;
|
||||
LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex);
|
||||
// of course, only cleanup and delete if there's something there
|
||||
if (lk->mInstance)
|
||||
{
|
||||
|
|
@ -505,7 +507,7 @@ public:
|
|||
{ // nested scope for 'lk'
|
||||
// In case racing threads call getInstance() at the same moment,
|
||||
// serialize the calls.
|
||||
LockStatic lk;
|
||||
LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex);
|
||||
|
||||
switch (lk->mInitState)
|
||||
{
|
||||
|
|
@ -595,7 +597,7 @@ public:
|
|||
static bool instanceExists()
|
||||
{
|
||||
// defend any access to sData from racing threads
|
||||
LockStatic lk;
|
||||
LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex);
|
||||
return lk->mInitState == INITIALIZED;
|
||||
}
|
||||
|
||||
|
|
@ -605,7 +607,7 @@ public:
|
|||
static bool wasDeleted()
|
||||
{
|
||||
// defend any access to sData from racing threads
|
||||
LockStatic lk;
|
||||
LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex);
|
||||
return lk->mInitState == DELETED;
|
||||
}
|
||||
};
|
||||
|
|
@ -644,7 +646,7 @@ private:
|
|||
// In case racing threads both call initParamSingleton() at the same
|
||||
// time, serialize them. One should initialize; the other should see
|
||||
// mInitState already set.
|
||||
LockStatic lk;
|
||||
LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex);
|
||||
// For organizational purposes this function shouldn't be called twice
|
||||
if (lk->mInitState != super::UNINITIALIZED)
|
||||
{
|
||||
|
|
@ -708,7 +710,7 @@ public:
|
|||
{
|
||||
// In case racing threads call getInstance() at the same moment as
|
||||
// initParamSingleton(), serialize the calls.
|
||||
LockStatic lk;
|
||||
LockStatic lk; LL_PROFILE_MUTEX_LOCK(lk->mMutex);
|
||||
|
||||
switch (lk->mInitState)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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}"
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue