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

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
+9 -1
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 )
{