Pass memory limit to worker.

This commit is contained in:
Bartosz Taudul 2024-05-05 20:50:03 +02:00
parent 2663ce1a4a
commit 5f0cac546b
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
3 changed files with 9 additions and 5 deletions

View File

@ -36,7 +36,7 @@ namespace tracy
double s_time = 0;
View::View( void(*cbMainThread)(const std::function<void()>&, bool), const char* addr, uint16_t port, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, SetScaleCallback sscb, AttentionCallback acb, const Config& config )
: m_worker( addr, port )
: m_worker( addr, port, config.memoryLimit == 0 ? -1 : ( config.memoryLimitPercent * tracy::GetPhysicalMemorySize() / 100 ) )
, m_staticView( false )
, m_viewMode( ViewMode::LastFrames )
, m_viewModeHeuristicTry( true )

View File

@ -260,7 +260,7 @@ static bool IsQueryPrio( ServerQuery type )
LoadProgress Worker::s_loadProgress;
Worker::Worker( const char* addr, uint16_t port )
Worker::Worker( const char* addr, uint16_t port, int64_t memoryLimit )
: m_addr( addr )
, m_port( port )
, m_hasData( false )
@ -276,6 +276,7 @@ Worker::Worker( const char* addr, uint16_t port )
, m_pendingCallstackFrames( 0 )
, m_pendingCallstackSubframes( 0 )
, m_pendingSymbolCode( 0 )
, m_memoryLimit( memoryLimit )
, m_callstackFrameStaging( nullptr )
, m_traceVersion( CurrentVersion )
, m_loadTime( 0 )
@ -317,6 +318,7 @@ Worker::Worker( const char* name, const char* program, const std::vector<ImportE
, m_buffer( nullptr )
, m_onDemand( false )
, m_inconsistentSamples( false )
, m_memoryLimit( -1 )
, m_traceVersion( CurrentVersion )
{
m_data.sourceLocationExpand.push_back( 0 );
@ -559,6 +561,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks, bool allow
, m_stream( nullptr )
, m_buffer( nullptr )
, m_inconsistentSamples( false )
, m_memoryLimit( -1 )
, m_allowStringModification( allowStringModification )
{
auto loadStart = std::chrono::high_resolution_clock::now();

View File

@ -452,7 +452,7 @@ public:
NUM_FAILURES
};
Worker( const char* addr, uint16_t port );
Worker( const char* addr, uint16_t port, int64_t memoryLimit );
Worker( const char* name, const char* program, const std::vector<ImportEventTimeline>& timeline, const std::vector<ImportEventMessages>& messages, const std::vector<ImportEventPlots>& plots, const std::unordered_map<uint64_t, std::string>& threadNames );
Worker( FileRead& f, EventType::Type eventMask = EventType::All, bool bgTasks = true, bool allowStringModification = false);
~Worker();
@ -1031,6 +1031,7 @@ private:
uint64_t m_memNamePayload = 0;
Slab<64*1024*1024> m_slab;
int64_t m_memoryLimit;
DataBlock m_data;
MbpsBlock m_mbpsData;