Measure load and save time separately in tracy-update.

This commit is contained in:
Bartosz Taudul 2024-05-31 17:43:13 +02:00
parent 0d5bd53be3
commit 07c6e12dbf
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -154,7 +154,7 @@ int main( int argc, char** argv )
try try
{ {
int64_t t; int64_t tLoad, tSave;
float ratio; float ratio;
int inVer; int inVer;
{ {
@ -167,9 +167,10 @@ 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
if( cacheSource ) worker.CacheSourceFiles(); const auto t1 = std::chrono::high_resolution_clock::now();
if ( resolveSymbols ) PatchSymbols( worker, pathSubstitutions ); if( cacheSource ) worker.CacheSourceFiles();
if( resolveSymbols ) PatchSymbols( worker, pathSubstitutions );
auto w = std::unique_ptr<tracy::FileWrite>( tracy::FileWrite::Open( output, clev, zstdLevel ) ); auto w = std::unique_ptr<tracy::FileWrite>( tracy::FileWrite::Open( output, clev, zstdLevel ) );
if( !w ) if( !w )
@ -181,11 +182,12 @@ int main( int argc, char** argv )
fflush( stdout ); fflush( stdout );
worker.Write( *w, buildDict ); worker.Write( *w, buildDict );
w->Finish(); w->Finish();
const auto t1 = std::chrono::high_resolution_clock::now(); const auto t2 = std::chrono::high_resolution_clock::now();
const auto stats = w->GetCompressionStatistics(); const auto stats = w->GetCompressionStatistics();
ratio = 100.f * stats.second / stats.first; ratio = 100.f * stats.second / stats.first;
inVer = worker.GetTraceVersion(); inVer = worker.GetTraceVersion();
t = std::chrono::duration_cast<std::chrono::nanoseconds>( t1 - t0 ).count(); tLoad = std::chrono::duration_cast<std::chrono::nanoseconds>( t1 - t0 ).count();
tSave = std::chrono::duration_cast<std::chrono::nanoseconds>( t2 - t1 ).count();
} }
FILE* in = fopen( input, "rb" ); FILE* in = fopen( input, "rb" );
@ -198,10 +200,10 @@ int main( int argc, char** argv )
const auto outSize = ftello64( out ); const auto outSize = ftello64( out );
fclose( out ); fclose( out );
printf( "%s (%i.%i.%i) {%s} -> %s (%i.%i.%i) {%s, %.2f%%} %s, %.2f%% change\n", printf( "%s (%i.%i.%i) {%s} -> %s (%i.%i.%i) {%s, %.2f%%} %s load, %s save, %.2f%% change\n",
input, inVer >> 16, ( inVer >> 8 ) & 0xFF, inVer & 0xFF, tracy::MemSizeToString( inSize ), 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, output, tracy::Version::Major, tracy::Version::Minor, tracy::Version::Patch, tracy::MemSizeToString( outSize ), ratio,
tracy::TimeToString( t ), float( outSize ) / inSize * 100 ); tracy::TimeToString( tLoad ), tracy::TimeToString( tSave ), float( outSize ) / inSize * 100 );
} }
catch( const tracy::UnsupportedVersion& e ) catch( const tracy::UnsupportedVersion& e )
{ {