Expose extreme compression level in update utility.

This commit is contained in:
Bartosz Taudul 2019-09-29 21:03:08 +02:00
parent 6e7e8eff87
commit 599fa17e4f

View File

@ -14,8 +14,9 @@
void Usage() void Usage()
{ {
printf( "Usage: update [--hc] input.tracy output.tracy\n\n" ); printf( "Usage: update [--hc|--extreme] input.tracy output.tracy\n\n" );
printf( " --hc: enable LZ4HC compression\n" ); printf( " --hc: enable LZ4HC compression\n" );
printf( " --extreme: enable extreme LZ4HC compression (very slow)\n" );
exit( 1 ); exit( 1 );
} }
@ -29,13 +30,23 @@ int main( int argc, char** argv )
} }
#endif #endif
bool hc = false; tracy::FileWrite::Compression clev = tracy::FileWrite::Compression::Fast;
if( argc != 3 && argc != 4 ) Usage(); if( argc != 3 && argc != 4 ) Usage();
if( argc == 4 ) if( argc == 4 )
{ {
if( strcmp( argv[1], "--hc" ) != 0 ) Usage(); if( strcmp( argv[1], "--hc" ) == 0 )
hc = true; {
clev = tracy::FileWrite::Compression::Slow;
}
else if( strcmp( argv[1], "--extreme" ) == 0 )
{
clev = tracy::FileWrite::Compression::Extreme;
}
else
{
Usage();
}
argv++; argv++;
} }
@ -61,7 +72,7 @@ int main( int argc, char** argv )
while( !worker.AreSourceLocationZonesReady() ) std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) ); while( !worker.AreSourceLocationZonesReady() ) std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
#endif #endif
auto w = std::unique_ptr<tracy::FileWrite>( tracy::FileWrite::Open( output, hc ? tracy::FileWrite::Compression::Slow : tracy::FileWrite::Compression::Fast ) ); auto w = std::unique_ptr<tracy::FileWrite>( tracy::FileWrite::Open( output, clev ) );
if( !w ) if( !w )
{ {
fprintf( stderr, "Cannot open output file!\n" ); fprintf( stderr, "Cannot open output file!\n" );