Skip to content

Commit 1013936

Browse files
authored
apply host performance timing limits to chrome call logging (#457)
* apply host performance timing limits to chrome call logging * fix a few more places where host performance timing limits should apply * clarify that ChromeCallLogging also includes host performance timing
1 parent 9be8363 commit 1013936

4 files changed

Lines changed: 15 additions & 17 deletions

File tree

docs/controls.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ If set to a nonzero value, flushes buffered JSON records for Chrome Tracing afte
203203

204204
##### `ChromeCallLogging` (bool)
205205

206-
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.
206+
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.
207207

208208
##### `ChromeFlowEvents` (bool)
209209

intercept/src/controls.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ CLI_CONTROL( bool, CallLoggingElapsedTime, false, "If s
3232
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." )
3333
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.")
3434
CLI_CONTROL( bool, ChromeTraceBufferingBlockingCallFlush, true, "If set to a nonzero value, flushes buffered JSON records for Chrome Tracing after blocking OpenCL calls.")
35-
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." )
35+
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." )
3636
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." )
3737
CLI_CONTROL( bool, ErrorLogging, false, "If set to a nonzero value, logs all OpenCL errors and the function name that caused the error." )
3838
CLI_CONTROL( bool, ErrorAssert, false, "If set to a nonzero value, breaks into the debugger when an OpenCL error occurs." )

intercept/src/intercept.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4050,8 +4050,7 @@ void CLIntercept::eventCallbackCaller(
40504050
event,
40514051
pIntercept->enumName().name_command_exec_status( status ).c_str(),
40524052
status );
4053-
4054-
clock::time_point cpuStart = clock::now();
4053+
HOST_PERFORMANCE_TIMING_START();
40554054

40564055
pIntercept->eventCallback(
40574056
event,
@@ -4064,8 +4063,7 @@ void CLIntercept::eventCallbackCaller(
40644063
pEventCallbackInfo->pUserData );
40654064
}
40664065

4067-
clock::time_point cpuEnd = clock::now();
4068-
4066+
HOST_PERFORMANCE_TIMING_END();
40694067
CALL_LOGGING_EXIT( CL_SUCCESS );
40704068

40714069
delete pEventCallbackInfo;

intercept/src/intercept.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,7 +2151,7 @@ inline CObjectTracker& CLIntercept::objectTracker()
21512151
NULL, \
21522152
##__VA_ARGS__ ); \
21532153
} \
2154-
if( pIntercept->config().ChromeCallLogging ) \
2154+
if( pIntercept->config().ChromeCallLogging && doHostPerformanceTiming ) \
21552155
{ \
21562156
pIntercept->chromeCallLoggingExit( \
21572157
__FUNCTION__, \
@@ -2173,7 +2173,7 @@ inline CObjectTracker& CLIntercept::objectTracker()
21732173
NULL, \
21742174
##__VA_ARGS__ ); \
21752175
} \
2176-
if( pIntercept->config().ChromeCallLogging ) \
2176+
if( pIntercept->config().ChromeCallLogging && doHostPerformanceTiming ) \
21772177
{ \
21782178
pIntercept->chromeCallLoggingExit( \
21792179
__FUNCTION__, \
@@ -2195,7 +2195,7 @@ inline CObjectTracker& CLIntercept::objectTracker()
21952195
NULL, \
21962196
##__VA_ARGS__ ); \
21972197
} \
2198-
if( pIntercept->config().ChromeCallLogging ) \
2198+
if( pIntercept->config().ChromeCallLogging && doHostPerformanceTiming ) \
21992199
{ \
22002200
pIntercept->chromeCallLoggingExit( \
22012201
__FUNCTION__, \
@@ -2217,7 +2217,7 @@ inline CObjectTracker& CLIntercept::objectTracker()
22172217
sync_point, \
22182218
##__VA_ARGS__ ); \
22192219
} \
2220-
if( pIntercept->config().ChromeCallLogging ) \
2220+
if( pIntercept->config().ChromeCallLogging && doHostPerformanceTiming ) \
22212221
{ \
22222222
pIntercept->chromeCallLoggingExit( \
22232223
__FUNCTION__, \
@@ -3269,10 +3269,10 @@ inline bool CLIntercept::checkHostPerformanceTimingEnqueueLimits(
32693269
#define HOST_PERFORMANCE_TIMING_START() \
32703270
CLIntercept::clock::time_point cpuStart, cpuEnd; \
32713271
bool doHostPerformanceTiming = \
3272-
pIntercept->config().ChromeCallLogging || \
3273-
( pIntercept->config().HostPerformanceTiming && \
3274-
pIntercept->checkHostPerformanceTimingEnqueueLimits( enqueueCounter ) &&\
3275-
pIntercept->checkConditionalTiming() ); \
3272+
( pIntercept->config().ChromeCallLogging || \
3273+
pIntercept->config().HostPerformanceTiming ) && \
3274+
pIntercept->checkHostPerformanceTimingEnqueueLimits( enqueueCounter ) &&\
3275+
pIntercept->checkConditionalTiming(); \
32763276
if( doHostPerformanceTiming ) \
32773277
{ \
32783278
cpuStart = CLIntercept::clock::now(); \
@@ -3311,9 +3311,9 @@ inline bool CLIntercept::checkHostPerformanceTimingEnqueueLimits(
33113311
bool doToolOverheadTiming = \
33123312
pIntercept->config().ToolOverheadTiming && \
33133313
( pIntercept->config().ChromeCallLogging || \
3314-
( pIntercept->config().HostPerformanceTiming && \
3315-
pIntercept->checkHostPerformanceTimingEnqueueLimits( enqueueCounter ) &&\
3316-
pIntercept->checkConditionalTiming() ) ); \
3314+
pIntercept->config().HostPerformanceTiming ) && \
3315+
pIntercept->checkHostPerformanceTimingEnqueueLimits( enqueueCounter ) &&\
3316+
pIntercept->checkConditionalTiming(); \
33173317
if( doToolOverheadTiming ) \
33183318
{ \
33193319
toolStart = CLIntercept::clock::now(); \

0 commit comments

Comments
 (0)