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

Expose streams in tracy-update.

This commit is contained in:
Bartosz Taudul 2024-06-02 12:28:02 +02:00
parent 3bf4a674bc
commit 095df5f416
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -36,6 +36,7 @@ void Usage()
printf( " -c: scan for source files missing in cache and add if found\n" ); printf( " -c: scan for source files missing in cache and add if found\n" );
printf( " -r: resolve symbols and patch callstack frames\n"); printf( " -r: resolve symbols and patch callstack frames\n");
printf( " -p: substitute symbol resolution path with an alternative: \"REGEX_MATCH;REPLACEMENT\"\n"); printf( " -p: substitute symbol resolution path with an alternative: \"REGEX_MATCH;REPLACEMENT\"\n");
printf( " -j: number of threads to use for compression (-1 to use all cores)\n" );
exit( 1 ); exit( 1 );
} }
@ -53,13 +54,14 @@ int main( int argc, char** argv )
tracy::FileCompression clev = tracy::FileCompression::Fast; tracy::FileCompression clev = tracy::FileCompression::Fast;
uint32_t events = tracy::EventType::All; uint32_t events = tracy::EventType::All;
int zstdLevel = 1; int zstdLevel = 1;
int streams = 1;
bool buildDict = false; bool buildDict = false;
bool cacheSource = false; bool cacheSource = false;
bool resolveSymbols = false; bool resolveSymbols = false;
std::vector<std::string> pathSubstitutions; std::vector<std::string> pathSubstitutions;
int c; int c;
while( ( c = getopt( argc, argv, "hez:ds:crp:" ) ) != -1 ) while( ( c = getopt( argc, argv, "hez:ds:crp:j:" ) ) != -1 )
{ {
switch( c ) switch( c )
{ {
@ -132,6 +134,9 @@ int main( int argc, char** argv )
case 'p': case 'p':
pathSubstitutions.push_back(optarg); pathSubstitutions.push_back(optarg);
break; break;
case 'j':
streams = atoi( optarg );
break;
default: default:
Usage(); Usage();
break; break;
@ -161,7 +166,7 @@ int main( int argc, char** argv )
const auto t0 = std::chrono::high_resolution_clock::now(); const auto t0 = std::chrono::high_resolution_clock::now();
const bool allowBgThreads = false; const bool allowBgThreads = false;
const bool allowStringModification = resolveSymbols; const bool allowStringModification = resolveSymbols;
tracy::Worker worker( *f, (tracy::EventType::Type)events, allowBgThreads, allowStringModification); tracy::Worker worker( *f, (tracy::EventType::Type)events, allowBgThreads, allowStringModification );
#ifndef TRACY_NO_STATISTICS #ifndef TRACY_NO_STATISTICS
while( !worker.AreSourceLocationZonesReady() ) std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) ); while( !worker.AreSourceLocationZonesReady() ) std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
@ -172,7 +177,7 @@ int main( int argc, char** argv )
if( cacheSource ) worker.CacheSourceFiles(); if( cacheSource ) worker.CacheSourceFiles();
if( resolveSymbols ) PatchSymbols( worker, pathSubstitutions ); 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, streams ) );
if( !w ) if( !w )
{ {
fprintf( stderr, "Cannot open output file!\n" ); fprintf( stderr, "Cannot open output file!\n" );