Interpreting timing information in CLI traces
There are a few ways to gather timing information from a CLI trace. By default, a CLI trace captures the time spent in the application since the last CLI API call was made on a particular thread.
As well as the time spent in Db2®, it includes the network time between the client and server. For example:
SQLAllocStmt( hDbc=0:1, phStmt=&0012ee48 ) ---> Time elapsed - +3.964187E+000 seconds
(This time value indicates the time spent in the application since last CLI API was called)
SQLAllocStmt( phStmt=1:1 ) <--- SQL_SUCCESS Time elapsed - +4.444000E-003 seconds
(Since the function has completed, this time value indicates the time spent in Db2, including the network time)
The other way to capture timing information is using the CLI keyword: TraceTimeStamp. This keyword will generate a timestamp for every invocation and result of a CLI API call. The keyword has 4 display options: no timestamp information, processor ticks and ISO timestamp, processor ticks, or ISO timestamp.
This can be very useful when working with timing related problems such as CLI0125E - function sequence errors. It can also be helpful when attempting to determine which event happened first when working with multithreaded applications.