From e43a2cac32cb773994b11a3d964ec4acc372d273 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 26 Jul 2023 21:33:36 -0700 Subject: Added a profiler and investageted Server. --- src/stable/client.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/stable/client.cpp') diff --git a/src/stable/client.cpp b/src/stable/client.cpp index f6feb7c..56c5094 100644 --- a/src/stable/client.cpp +++ b/src/stable/client.cpp @@ -16,6 +16,13 @@ /** Read buffer size. */ #define RBS (2000) // 1500 is the nominal MTU for ethernet, it's a good guess +#ifdef PROFILE_BU_SERVER +#define BU_PROFILE_START( x ) Bu::Profiler::getInstance().startEvent( x ) +#define BU_PROFILE_END( x ) Bu::Profiler::getInstance().endEvent( x ) +#else +#define BU_PROFILE_START( x ) (void)0 +#define BU_PROFILE_END( x ) (void)0 +#endif Bu::Client::Client( Bu::TcpSocket *pSocket, class Bu::ClientLinkFactory *pfLink ) : @@ -47,6 +54,7 @@ void Bu::Client::processInput() char buf[RBS]; Bu::size nRead, nTotal=0; + BU_PROFILE_START("client.read"); for(;;) { try @@ -72,6 +80,7 @@ void Bu::Client::processInput() break; } } + BU_PROFILE_END("client.read"); mRead.unlock(); if( nTotal == 0 ) @@ -82,7 +91,9 @@ void Bu::Client::processInput() if( pProto && nTotal ) { + BU_PROFILE_START("client.process"); pProto->onNewData( this ); + BU_PROFILE_END("client.process"); } } -- cgit v1.2.3