mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Handle ^C in capture utility on windows.
This commit is contained in:
parent
a11b52d94f
commit
3f236b7e91
@ -17,16 +17,13 @@
|
|||||||
#include "../../server/TracyWorker.hpp"
|
#include "../../server/TracyWorker.hpp"
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
|
||||||
struct sigaction oldsigint;
|
|
||||||
bool disconnect = false;
|
bool disconnect = false;
|
||||||
|
|
||||||
void SigInt( int )
|
void SigInt( int )
|
||||||
{
|
{
|
||||||
disconnect = true;
|
disconnect = true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void Usage()
|
void Usage()
|
||||||
{
|
{
|
||||||
@ -95,8 +92,10 @@ int main( int argc, char** argv )
|
|||||||
while( !worker.HasData() ) std::this_thread::sleep_for( std::chrono::milliseconds( 100 ) );
|
while( !worker.HasData() ) std::this_thread::sleep_for( std::chrono::milliseconds( 100 ) );
|
||||||
printf( "\nQueue delay: %s\nTimer resolution: %s\n", tracy::TimeToString( worker.GetDelay() ), tracy::TimeToString( worker.GetResolution() ) );
|
printf( "\nQueue delay: %s\nTimer resolution: %s\n", tracy::TimeToString( worker.GetDelay() ), tracy::TimeToString( worker.GetResolution() ) );
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifdef _WIN32
|
||||||
struct sigaction sigint;
|
signal( SIGINT, SigInt );
|
||||||
|
#else
|
||||||
|
struct sigaction sigint, oldsigint;
|
||||||
memset( &sigint, 0, sizeof( sigint ) );
|
memset( &sigint, 0, sizeof( sigint ) );
|
||||||
sigint.sa_handler = SigInt;
|
sigint.sa_handler = SigInt;
|
||||||
sigaction( SIGINT, &sigint, &oldsigint );
|
sigaction( SIGINT, &sigint, &oldsigint );
|
||||||
@ -107,13 +106,11 @@ int main( int argc, char** argv )
|
|||||||
const auto t0 = std::chrono::high_resolution_clock::now();
|
const auto t0 = std::chrono::high_resolution_clock::now();
|
||||||
while( worker.IsConnected() )
|
while( worker.IsConnected() )
|
||||||
{
|
{
|
||||||
#ifndef _MSC_VER
|
|
||||||
if( disconnect )
|
if( disconnect )
|
||||||
{
|
{
|
||||||
worker.Disconnect();
|
worker.Disconnect();
|
||||||
disconnect = false;
|
disconnect = false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
lock.lock();
|
lock.lock();
|
||||||
const auto mbps = worker.GetMbpsData().back();
|
const auto mbps = worker.GetMbpsData().back();
|
||||||
|
Loading…
Reference in New Issue
Block a user