Expose source file scan in update utility.

This commit is contained in:
Bartosz Taudul 2022-03-30 16:08:20 +02:00
parent a335efe9e6
commit 8532c2d1e0
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -31,6 +31,7 @@ void Usage()
printf( " -s flags: strip selected data from capture:\n" ); printf( " -s flags: strip selected data from capture:\n" );
printf( " l: locks, m: messages, p: plots, M: memory, i: frame images\n" ); printf( " l: locks, m: messages, p: plots, M: memory, i: frame images\n" );
printf( " c: context switches, s: sampling data, C: symbol code, S: source cache\n" ); printf( " c: context switches, s: sampling data, C: symbol code, S: source cache\n" );
printf( " -c: scan for source files missing in cache and add if found\n" );
exit( 1 ); exit( 1 );
} }
@ -48,8 +49,9 @@ int main( int argc, char** argv )
uint32_t events = tracy::EventType::All; uint32_t events = tracy::EventType::All;
int zstdLevel = 1; int zstdLevel = 1;
bool buildDict = false; bool buildDict = false;
bool cacheSource = false;
int c; int c;
while( ( c = getopt( argc, argv, "hez:ds:" ) ) != -1 ) while( ( c = getopt( argc, argv, "hez:ds:c" ) ) != -1 )
{ {
switch( c ) switch( c )
{ {
@ -113,6 +115,9 @@ int main( int argc, char** argv )
while( *++optarg != '\0' ); while( *++optarg != '\0' );
break; break;
} }
case 'c':
cacheSource = true;
break;
default: default:
Usage(); Usage();
break; break;
@ -145,6 +150,8 @@ 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();
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 )
{ {