Allow stripping data from captures.

This commit is contained in:
Bartosz Taudul 2020-07-17 22:06:15 +02:00
parent 08c70cd6fe
commit cc63b6492f

View File

@ -29,6 +29,9 @@ void Usage()
printf( " -h: enable LZ4HC compression\n" ); printf( " -h: enable LZ4HC compression\n" );
printf( " -e: enable extreme LZ4HC compression (very slow)\n" ); printf( " -e: enable extreme LZ4HC compression (very slow)\n" );
printf( " -z level: use Zstd compression with given compression level\n" ); printf( " -z level: use Zstd compression with given compression level\n" );
printf( " -s flags: strip selected data from capture:\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" );
exit( 1 ); exit( 1 );
} }
@ -43,10 +46,10 @@ int main( int argc, char** argv )
#endif #endif
tracy::FileWrite::Compression clev = tracy::FileWrite::Compression::Fast; tracy::FileWrite::Compression clev = tracy::FileWrite::Compression::Fast;
uint32_t events = tracy::EventType::All;
int zstdLevel = 1; int zstdLevel = 1;
int c; int c;
while( ( c = getopt( argc, argv, "hez:" ) ) != -1 ) while( ( c = getopt( argc, argv, "hez:s:" ) ) != -1 )
{ {
switch( c ) switch( c )
{ {
@ -65,6 +68,48 @@ int main( int argc, char** argv )
exit( 1 ); exit( 1 );
} }
break; break;
case 's':
{
auto ptr = optarg;
do
{
switch( *optarg )
{
case 'l':
events &= ~tracy::EventType::Locks;
break;
case 'm':
events &= ~tracy::EventType::Messages;
break;
case 'p':
events &= ~tracy::EventType::Plots;
break;
case 'M':
events &= ~tracy::EventType::Memory;
break;
case 'i':
events &= ~tracy::EventType::FrameImages;
break;
case 'c':
events &= ~tracy::EventType::ContextSwitches;
break;
case 's':
events &= ~tracy::EventType::Samples;
break;
case 'C':
events &= ~tracy::EventType::SymbolCode;
break;
case 'S':
events &= ~tracy::EventType::SourceCache;
break;
default:
Usage();
break;
}
}
while( *++optarg != '\0' );
break;
}
default: default:
Usage(); Usage();
break; break;
@ -91,7 +136,7 @@ int main( int argc, char** argv )
int inVer; int inVer;
{ {
const auto t0 = std::chrono::high_resolution_clock::now(); const auto t0 = std::chrono::high_resolution_clock::now();
tracy::Worker worker( *f, tracy::EventType::All, false ); tracy::Worker worker( *f, (tracy::EventType::Type)events, false );
#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 ) );