1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Add interface for frame images dict building.

This commit is contained in:
Bartosz Taudul
2021-05-15 15:50:20 +02:00
parent 859b8e4193
commit 3d75bf653a
7 changed files with 22 additions and 11 deletions
+10 -4
View File
@@ -657,10 +657,16 @@ bool View::Draw()
ImGui::SliderInt( "##zstd", &zlvl, 1, 22, "%d", ImGuiSliderFlags_AlwaysClamp );
ImGui::Unindent();
ImGui::Separator();
static bool buildDict = false;
ImGui::Checkbox( "Build frame images dictionary", &buildDict );
ImGui::SameLine();
TextDisabledUnformatted( "Decreases run-time memory requirements" );
ImGui::Separator();
if( ImGui::Button( ICON_FA_SAVE " Save trace" ) )
{
saveFailed = !s_instance->Save( fn, comp, zlvl );
saveFailed = !s_instance->Save( fn, comp, zlvl, buildDict );
s_instance->m_filenameStaging.clear();
ImGui::CloseCurrentPopup();
}
@@ -18036,16 +18042,16 @@ void View::DrawSourceTooltip( const char* filename, uint32_t srcline, int before
if( separateTooltip ) ImGui::EndTooltip();
}
bool View::Save( const char* fn, FileWrite::Compression comp, int zlevel )
bool View::Save( const char* fn, FileWrite::Compression comp, int zlevel, bool buildDict )
{
std::unique_ptr<FileWrite> f( FileWrite::Open( fn, comp, zlevel ) );
if( !f ) return false;
m_userData.StateShouldBePreserved();
m_saveThreadState.store( SaveThreadState::Saving, std::memory_order_relaxed );
m_saveThread = std::thread( [this, f{std::move( f )}] {
m_saveThread = std::thread( [this, f{std::move( f )}, buildDict] {
std::lock_guard<std::mutex> lock( m_worker.GetDataLock() );
m_worker.Write( *f );
m_worker.Write( *f, buildDict );
f->Finish();
const auto stats = f->GetCompressionStatistics();
m_srcFileBytes.store( stats.first, std::memory_order_relaxed );
+1 -1
View File
@@ -283,7 +283,7 @@ private:
void CalcZoneTimeDataImpl( const V& children, const ContextSwitch* ctx, unordered_flat_map<int16_t, ZoneTimeData>& data, int64_t& ztime, const ZoneEvent& zone );
void SetPlaybackFrame( uint32_t idx );
bool Save( const char* fn, FileWrite::Compression comp, int zlevel );
bool Save( const char* fn, FileWrite::Compression comp, int zlevel, bool buildDict );
unordered_flat_map<const void*, VisData> m_visData;
unordered_flat_map<uint64_t, bool> m_visibleMsgThread;
+1 -1
View File
@@ -6898,7 +6898,7 @@ void Worker::Disconnect()
m_disconnect = true;
}
void Worker::Write( FileWrite& f )
void Worker::Write( FileWrite& f, bool fiDict )
{
DoPostponedWork();
+1 -1
View File
@@ -579,7 +579,7 @@ public:
void Disconnect();
bool WasDisconnectIssued() const { return m_disconnect; }
void Write( FileWrite& f );
void Write( FileWrite& f, bool fiDict );
int GetTraceVersion() const { return m_traceVersion; }
uint8_t GetHandshakeStatus() const { return m_handshake.load( std::memory_order_relaxed ); }
int64_t GetSamplingPeriod() const { return m_samplingPeriod; }