Allow setting memory limit in capture utility.

This commit is contained in:
Bartosz Taudul 2024-05-05 21:16:02 +02:00
parent 6748d11a2f
commit ee56e1fcd5
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -21,6 +21,7 @@
#include "../../server/TracyFileWrite.hpp"
#include "../../server/TracyMemory.hpp"
#include "../../server/TracyPrint.hpp"
#include "../../server/TracySysUtil.hpp"
#include "../../server/TracyWorker.hpp"
#ifdef _WIN32
@ -90,7 +91,7 @@ void AnsiPrintf( const char* ansiEscape, const char* format, ... ) {
[[noreturn]] void Usage()
{
printf( "Usage: capture -o output.tracy [-a address] [-p port] [-f] [-s seconds]\n" );
printf( "Usage: capture -o output.tracy [-a address] [-p port] [-f] [-s seconds] [-m memlimit]\n" );
exit( 1 );
}
@ -114,7 +115,7 @@ int main( int argc, char** argv )
int64_t memoryLimit = -1;
int c;
while( ( c = getopt( argc, argv, "a:o:p:fs:" ) ) != -1 )
while( ( c = getopt( argc, argv, "a:o:p:fs:m:" ) ) != -1 )
{
switch( c )
{
@ -131,7 +132,10 @@ int main( int argc, char** argv )
overwrite = true;
break;
case 's':
seconds = atoi (optarg);
seconds = atoi(optarg);
break;
case 'm':
memoryLimit = std::clamp( atoll( optarg ), 1ll, 999ll ) * tracy::GetPhysicalMemorySize() / 100;
break;
default:
Usage();