diff --git a/docs/controls.md b/docs/controls.md index 94011c42..c8a53f69 100644 --- a/docs/controls.md +++ b/docs/controls.md @@ -203,7 +203,7 @@ If set to a nonzero value, flushes buffered JSON records for Chrome Tracing afte ##### `ChromeCallLogging` (bool) -If set to a nonzero value, logs function entry and exit information for every OpenCL call to a JSON file that may be used for Chrome Tracing. +If set to a nonzero value, logs function entry and exit information and host performance timing for every OpenCL call to a JSON file that may be used for Chrome Tracing. ##### `ChromeFlowEvents` (bool) diff --git a/intercept/src/controls.h b/intercept/src/controls.h index 4115d176..8a66ba03 100644 --- a/intercept/src/controls.h +++ b/intercept/src/controls.h @@ -32,7 +32,7 @@ CLI_CONTROL( bool, CallLoggingElapsedTime, false, "If s CLI_CONTROL( bool, ITTCallLogging, false, "If set to a nonzero value, logs function entry and exit information for every OpenCL call using the ITT APIs. This feature will only function if the Intercept Layer for OpenCL Applications is built with ITT support." ) CLI_CONTROL( cl_uint, ChromeTraceBufferSize, 16384, "If set to a nonzero value, buffers JSON records for Chrome Tracing in memory before writing to a file. The buffer will be flushed when it fills, upon application termination, and optionally on blocking OpenCL calls.") CLI_CONTROL( bool, ChromeTraceBufferingBlockingCallFlush, true, "If set to a nonzero value, flushes buffered JSON records for Chrome Tracing after blocking OpenCL calls.") -CLI_CONTROL( bool, ChromeCallLogging, false, "If set to a nonzero value, logs function entry and exit information for every OpenCL call to a JSON file that may be used for Chrome Tracing." ) +CLI_CONTROL( bool, ChromeCallLogging, false, "If set to a nonzero value, logs function entry and exit information and host performance timing for every OpenCL call to a JSON file that may be used for Chrome Tracing." ) CLI_CONTROL( bool, ChromeFlowEvents, false, "If set to a nonzero value, adds flow events between OpenCL calls and OpenCL commands in a JSON file that may be used for Chrome Tracing. Requires both ChromeCallLogging and ChromePerformanceTiming." ) CLI_CONTROL( bool, ErrorLogging, false, "If set to a nonzero value, logs all OpenCL errors and the function name that caused the error." ) CLI_CONTROL( bool, ErrorAssert, false, "If set to a nonzero value, breaks into the debugger when an OpenCL error occurs." ) diff --git a/intercept/src/intercept.cpp b/intercept/src/intercept.cpp index 847ef2db..2e4c098e 100644 --- a/intercept/src/intercept.cpp +++ b/intercept/src/intercept.cpp @@ -4044,8 +4044,7 @@ void CLIntercept::eventCallbackCaller( event, pIntercept->enumName().name_command_exec_status( status ).c_str(), status ); - - clock::time_point cpuStart = clock::now(); + HOST_PERFORMANCE_TIMING_START(); pIntercept->eventCallback( event, @@ -4058,8 +4057,7 @@ void CLIntercept::eventCallbackCaller( pEventCallbackInfo->pUserData ); } - clock::time_point cpuEnd = clock::now(); - + HOST_PERFORMANCE_TIMING_END(); CALL_LOGGING_EXIT( CL_SUCCESS ); delete pEventCallbackInfo; diff --git a/intercept/src/intercept.h b/intercept/src/intercept.h index 612a5708..7801cbc7 100644 --- a/intercept/src/intercept.h +++ b/intercept/src/intercept.h @@ -2144,7 +2144,7 @@ inline CObjectTracker& CLIntercept::objectTracker() NULL, \ ##__VA_ARGS__ ); \ } \ - if( pIntercept->config().ChromeCallLogging ) \ + if( pIntercept->config().ChromeCallLogging && doHostPerformanceTiming ) \ { \ pIntercept->chromeCallLoggingExit( \ __FUNCTION__, \ @@ -2166,7 +2166,7 @@ inline CObjectTracker& CLIntercept::objectTracker() NULL, \ ##__VA_ARGS__ ); \ } \ - if( pIntercept->config().ChromeCallLogging ) \ + if( pIntercept->config().ChromeCallLogging && doHostPerformanceTiming ) \ { \ pIntercept->chromeCallLoggingExit( \ __FUNCTION__, \ @@ -2188,7 +2188,7 @@ inline CObjectTracker& CLIntercept::objectTracker() NULL, \ ##__VA_ARGS__ ); \ } \ - if( pIntercept->config().ChromeCallLogging ) \ + if( pIntercept->config().ChromeCallLogging && doHostPerformanceTiming ) \ { \ pIntercept->chromeCallLoggingExit( \ __FUNCTION__, \ @@ -2210,7 +2210,7 @@ inline CObjectTracker& CLIntercept::objectTracker() sync_point, \ ##__VA_ARGS__ ); \ } \ - if( pIntercept->config().ChromeCallLogging ) \ + if( pIntercept->config().ChromeCallLogging && doHostPerformanceTiming ) \ { \ pIntercept->chromeCallLoggingExit( \ __FUNCTION__, \ @@ -3262,10 +3262,10 @@ inline bool CLIntercept::checkHostPerformanceTimingEnqueueLimits( #define HOST_PERFORMANCE_TIMING_START() \ CLIntercept::clock::time_point cpuStart, cpuEnd; \ bool doHostPerformanceTiming = \ - pIntercept->config().ChromeCallLogging || \ - ( pIntercept->config().HostPerformanceTiming && \ - pIntercept->checkHostPerformanceTimingEnqueueLimits( enqueueCounter ) &&\ - pIntercept->checkConditionalTiming() ); \ + ( pIntercept->config().ChromeCallLogging || \ + pIntercept->config().HostPerformanceTiming ) && \ + pIntercept->checkHostPerformanceTimingEnqueueLimits( enqueueCounter ) &&\ + pIntercept->checkConditionalTiming(); \ if( doHostPerformanceTiming ) \ { \ cpuStart = CLIntercept::clock::now(); \ @@ -3304,9 +3304,9 @@ inline bool CLIntercept::checkHostPerformanceTimingEnqueueLimits( bool doToolOverheadTiming = \ pIntercept->config().ToolOverheadTiming && \ ( pIntercept->config().ChromeCallLogging || \ - ( pIntercept->config().HostPerformanceTiming && \ - pIntercept->checkHostPerformanceTimingEnqueueLimits( enqueueCounter ) &&\ - pIntercept->checkConditionalTiming() ) ); \ + pIntercept->config().HostPerformanceTiming ) && \ + pIntercept->checkHostPerformanceTimingEnqueueLimits( enqueueCounter ) &&\ + pIntercept->checkConditionalTiming(); \ if( doToolOverheadTiming ) \ { \ toolStart = CLIntercept::clock::now(); \