diff --git a/capture/src/capture.cpp b/capture/src/capture.cpp index f11bc863..8a7dd40a 100644 --- a/capture/src/capture.cpp +++ b/capture/src/capture.cpp @@ -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();