Accounting trace

The accounting trace records transaction-level data that is written when the processing for a transaction is completed. It provides data that enables you to conduct DB2® capacity planning and to tune application programs.

Begin program-specific programming interface information.
The DB2 accounting trace provides the following types of information:

  • Start and stop times
  • Number of commits and aborts
  • The number of times certain SQL statements are issued
  • Number of buffer pool requests
  • Counts of certain locking events
  • Processor resources consumed
  • Thread wait times for various events
  • RID pool processing
  • Distributed processing
  • Resource limit facility statistics

DB2 trace begins collecting these items when a thread is successfully allocated to DB2. DB2 trace writes a completed record when the thread terminates or when the authorization ID changes.

If you specified YES for SMF ACCOUNTING on installation panel DSNTIPN, the accounting trace starts automatically when you start DB2, and sends IFCIDs that are of SMF type 101 to SMF. The accounting record IFCID 0003 is of SMF type 101.

End program-specific programming interface information.

Start of changeThe value of the ACCUMACC subsystem parameter controls the accumulation of accounting data by user for DDF and RRSAF threads. You can use this value to consolidate multiple accounting records.End of change

Accounting trace classes

The following table shows the IFCIDs that are activated for each accounting trace class.

Table 1. Classes for DB2 accounting trace
Class Description of class Activated IFCIDs
Start of change1End of change Start of changeStandard accounting data. This default class is also activated when you omit the CLASS keyword from the START TRACE command when you start the accounting trace.End of change Start of change0003, 0106, 0200, 0239End of change
2 Entry or exit from DB2 event signaling. 0232
3 Elapsed wait time in DB2. 0006-0009, 0032, 0033, 0044, 0045, 0117, 0118, 0127, 0128, 0170, 0171, 0174, 0175, 0213-0216, 0226, 0227, 0242, 0243, 0321, 0322, 0329, 0378, 0379
4 Installation-defined accounting record. 0151
5 Time spent processing IFI requests. 0187
6 Reserved.  
Start of change7End of change Start of changePackage-level accounting in-DB2 time.End of change Start of changeStart of change0200, 0232, 0239, 0240End of changeEnd of change
8 Package-level accounting wait time in DB2. Start of change0006-0009, 0032, 0033, 0044, 0045, 0117, 0118, 0127, 0128, 0170, 0171, 0174, 0175, 0213-0216, 0226, 0227, 0239, 0241-0243, 0321, 0322, 0378, 0379End of change
10 Package detail.

Start of changeOne of the following traces must also be activated before the IFCID 0239 records are written:End of change

Start of change
  • Accounting class 7
  • Accounting class 8
  • Monitor class 7
  • Monitor class 8
End of change
Start of change0239End of change
11-29 Reserved.  
30 - 32 Available for local use.  

Several DB2 components accumulate accounting data for class 1 components during normal execution. The data is collected at the end of the accounting period, but does not involve as much overhead as individual event tracing.

When you start class 2, 3, 7, 8, or 10 many additional trace points are activated. Every occurrence of these events is traced internally by DB2 trace, but these traces are not written to any external destination. When class 2 or class 3 is activated, the accounting facility uses these traces to compute the additional total statistics that appear in the accounting record IFCID 003. Accounting class 1 must be active to externalize the information.

Classes 7 and 8 control whether IFCID 239 is externalized. One or the other must be started for IFCID 239 to be externalized.

Accounting for packages

Before you can turn on accounting for packages, accounting trace class 7 or 8 must be active. You can activate class 7 while a plan is being executed, but accounting trace information is only gathered for packages executed after class 7 is activated. Activate accounting trace class 8 to collect information about the amount of time an agent was suspended in DB2 for each executed package. Accounting class 1 determines the destination for packages accounting (IFCID239). If accounting trace classes 2 and 3 are activated, activating accounting trace classes 7 and 8 incurs minimal additional performance cost.

Classes 2 and 3

If you want information from either or both accounting class 2 and 3, be sure to activate class 2, class 3, or both classes before your application starts. If these classes are activated while the application is running, the times gathered by DB2 trace are only from the time the class was activated.

IFI class 5

Accounting trace class 5 provides information about time spent in DB2 processing instrumentation facility interface (IFI) requests. Start of change
  • Class 5 elapsed time indicates the amount of elapsed time spent in DB2 processing instrumentation facility interface (IFI) requests. This time is included as part of the value for class 2 elapsed time.
  • Class 5 CPU time indicates the amount of time consumed on the central processor for processing instrumentation facility interface (IFI) requests during the accounting interval. This time is a subset of and included in the values for class 2 CPU time.
End of change If no agent issued any IFI requests, these fields are not included in the accounting record.