Snapshot monitor self-describing data stream
After you capture a snapshot with the db2GetSnapshot API, the API returns the snapshot output as a self-describing data stream. Self-describing data includes data attributes such as element names and sizes.
Figure 1 shows the structure
of the data stream and Table 1 provides
some examples of the logical data groups and monitor elements that
might be returned.
Note: Descriptive names are used for the identifiers
in the examples and tables. These names are prefixed by SQLM_ELM_ in
the actual data stream. For example, collected would appear as SQLM_ELM_COLLECTED
in the snapshot monitor output. Types are prefixed with SQLM_TYPE_ in
the actual data stream. For example, headers appear as SQLM_TYPE_HEADER
in the data stream.

- Each logical data group begins with a header that indicates its size and name. This size does not include the volume of data taken up by the header itself.
- Size in the collected header returns the total size of the snapshot.
- The size element in other headers indicates the size of all the data in that logical data group, including any subordinate groupings.
- Monitor element information follows its logical data group header and is also self-describing.
Logical Data Group | Data Stream | Description |
---|---|---|
collected | 1000
header collected |
Size of snapshot data (in bytes).
Indicates the start of a logical data group. Name of the logical data group. |
4
u32bit server_db2_type sqlf_nt_server |
Size of the data stored in this monitor element.
Monitor element type - unsigned 32 bit numeric. The name of the monitor element collected. The collected value for this element. |
|
2
u16bit node_number 3 |
Size of the data stored in this monitor element.
Monitor element type - unsigned 16 bit numeric. The name of the monitor element collected. The collected value for this element. |
|
db2 | 200
header db2 |
Size of the level portion of data in the snapshot.
Indicates the start of a logical data group. Name of the logical data group. |
4
u32bit sort_heap_allocated 16 |
Size of the data stored in this monitor element.
Monitor element type - unsigned 32 bit numeric. The name of the monitor element collected. The collected value for this element. |
|
4
u32bit local_cons 3 |
Size of the data stored in this monitor element.
Monitor element type - unsigned 32 bit numeric. The name of the monitor element collected. The collected value for this element. |
|
. . .
|
. . .
|
|
appl | 100
header appl |
Size of the appl element data in the snapshot.
Indicates the start of a logical data group. Name of the logical data group. |
4
u32bit locks_held 3 |
Size of the data stored in this monitor element.
Monitor element type - unsigned 32 bit numeric. The name of the monitor element collected. The collected value for this element. |
|
. . .
|
. . .
|
|
agent | 50
header agent |
Size of the agent portion of the appl structure.
Indicates the start of a logical data group. Name of the logical data group. |
4
u32bit agent_pid 12 |
Size of the data stored in this monitor element.
Monitor element type - 32 bit numeric. The name of the monitor element collected. The collected value for this element. |
|
. . .
|
. . .
|
The db2GetSnapshot() routine returns the self-describing snapshot data in the user-supplied buffer. Data is returned in the logical data groupings associated with the type of snapshot being captured.
Each item returned by a snapshot request contains fields that specify
its size and type. The size can be used to parse through the returned
data. A field's size can also be used to skip over a logical data
group. For example, to skip over the database record
you need to determine the number of bytes in the data stream. Use
the following formula to calculate the number of bytes to skip:
size of the db2 logical data grouping + sizeof(sqlm_header_info)