Display compression ratio in update utility.

This commit is contained in:
Bartosz Taudul 2020-02-08 13:18:42 +01:00
parent f58c96e4b3
commit 4c7f698946
3 changed files with 17 additions and 1 deletions

View File

@ -134,6 +134,7 @@
<ClCompile Include="..\..\..\common\tracy_lz4.cpp" />
<ClCompile Include="..\..\..\common\tracy_lz4hc.cpp" />
<ClCompile Include="..\..\..\server\TracyMemory.cpp" />
<ClCompile Include="..\..\..\server\TracyPrint.cpp" />
<ClCompile Include="..\..\..\server\TracyTaskDispatch.cpp" />
<ClCompile Include="..\..\..\server\TracyThreadCompress.cpp" />
<ClCompile Include="..\..\..\server\TracyWorker.cpp" />
@ -157,6 +158,7 @@
<ClInclude Include="..\..\..\server\TracyFileWrite.hpp" />
<ClInclude Include="..\..\..\server\TracyMemory.hpp" />
<ClInclude Include="..\..\..\server\TracyPopcnt.hpp" />
<ClInclude Include="..\..\..\server\TracyPrint.hpp" />
<ClInclude Include="..\..\..\server\TracySlab.hpp" />
<ClInclude Include="..\..\..\server\TracyTaskDispatch.hpp" />
<ClInclude Include="..\..\..\server\TracyThreadCompress.hpp" />

View File

@ -39,6 +39,9 @@
<ClCompile Include="..\..\..\server\TracyTaskDispatch.cpp">
<Filter>server</Filter>
</ClCompile>
<ClCompile Include="..\..\..\server\TracyPrint.cpp">
<Filter>server</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\common\tracy_lz4.hpp">
@ -107,5 +110,8 @@
<ClInclude Include="..\..\..\server\TracyTaskDispatch.hpp">
<Filter>server</Filter>
</ClInclude>
<ClInclude Include="..\..\..\server\TracyPrint.hpp">
<Filter>server</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -9,6 +9,7 @@
#include "../../server/TracyFileRead.hpp"
#include "../../server/TracyFileWrite.hpp"
#include "../../server/TracyPrint.hpp"
#include "../../server/TracyVersion.hpp"
#include "../../server/TracyWorker.hpp"
@ -70,6 +71,7 @@ int main( int argc, char** argv )
try
{
float ratio;
int inVer;
{
tracy::Worker worker( *f, tracy::EventType::All, false );
@ -87,6 +89,9 @@ int main( int argc, char** argv )
printf( "Saving... \r" );
fflush( stdout );
worker.Write( *w );
w->Finish();
const auto stats = w->GetCompressionStatistics();
ratio = 100.f * stats.second / stats.first;
inVer = worker.GetTraceVersion();
}
@ -100,7 +105,10 @@ int main( int argc, char** argv )
const auto outSize = ftello64( out );
fclose( out );
printf( "%s (%i.%i.%i) {%zu KB} -> %s (%i.%i.%i) {%zu KB} %.2f%% size change\n", input, inVer >> 16, ( inVer >> 8 ) & 0xFF, inVer & 0xFF, size_t( inSize / 1024 ), output, tracy::Version::Major, tracy::Version::Minor, tracy::Version::Patch, size_t( outSize / 1024 ), float( outSize ) / inSize * 100 );
printf( "%s (%i.%i.%i) {%s} -> %s (%i.%i.%i) {%s, %.2f%%} %.2f%% size change\n",
input, inVer >> 16, ( inVer >> 8 ) & 0xFF, inVer & 0xFF, tracy::MemSizeToString( inSize ),
output, tracy::Version::Major, tracy::Version::Minor, tracy::Version::Patch, tracy::MemSizeToString( outSize ), ratio,
float( outSize ) / inSize * 100 );
}
catch( const tracy::UnsupportedVersion& e )
{