mirror of
https://github.com/wolfpld/tracy.git
synced 2026-09-02 08:28:30 +00:00
Compare commits
1 Commits
master
...
slomp/quer
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99105143df |
@@ -10,6 +10,9 @@
|
|||||||
#include "../common/TracyAlloc.hpp"
|
#include "../common/TracyAlloc.hpp"
|
||||||
#include "../common/TracySystem.hpp"
|
#include "../common/TracySystem.hpp"
|
||||||
|
|
||||||
|
#include <shared_mutex>
|
||||||
|
#include <string>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
#ifdef TRACY_HAS_CALLSTACK
|
#ifdef TRACY_HAS_CALLSTACK
|
||||||
|
|
||||||
@@ -1952,6 +1955,33 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
TRACY_API const char* QuerySymbolName(void* ptr)
|
||||||
|
{
|
||||||
|
#ifndef TRACY_HAS_CALLSTACK
|
||||||
|
return "[unavailable]";
|
||||||
|
#else
|
||||||
|
uint64_t address = uint64_t(ptr);
|
||||||
|
|
||||||
|
static std::unordered_map<uint64_t, std::string> s_cache;
|
||||||
|
static std::shared_mutex s_mutex;
|
||||||
|
|
||||||
|
{
|
||||||
|
std::shared_lock lock(s_mutex);
|
||||||
|
auto it = s_cache.find(address);
|
||||||
|
if (it != s_cache.end()) return it->second.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_lock lock(s_mutex);
|
||||||
|
auto [it, inserted] = s_cache.try_emplace(address);
|
||||||
|
if (inserted)
|
||||||
|
{
|
||||||
|
const char* symbol = DecodeCallstackPtrFast(address);
|
||||||
|
it->second = symbol;
|
||||||
|
}
|
||||||
|
return it->second.c_str();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ namespace tracy
|
|||||||
{
|
{
|
||||||
static constexpr bool has_callstack() { return false; }
|
static constexpr bool has_callstack() { return false; }
|
||||||
static tracy_force_inline void* Callstack( int32_t /*depth*/ ) { return nullptr; }
|
static tracy_force_inline void* Callstack( int32_t /*depth*/ ) { return nullptr; }
|
||||||
|
TRACY_API const char* QuerySymbolName(void* address);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -87,6 +88,7 @@ void InitCallstack();
|
|||||||
void InitCallstackCritical();
|
void InitCallstackCritical();
|
||||||
void EndCallstack();
|
void EndCallstack();
|
||||||
const char* GetKernelModulePath( uint64_t addr );
|
const char* GetKernelModulePath( uint64_t addr );
|
||||||
|
TRACY_API const char* QuerySymbolName(void* address);
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
void InitExternalImageCache( pid_t pid );
|
void InitExternalImageCache( pid_t pid );
|
||||||
|
|||||||
Reference in New Issue
Block a user