getStatistics(jdo: JadeDynamicObject input);
The getStatistics method of the DbFile class returns statistics relating to read and write operations on the persistent database file represented by the DbFile instance used as the method receiver.
The values are returned as
The properties returned in the JadeDynamicObject are listed in the following table.
Property | Description |
---|---|
logicalReads | The total number of read requests |
logicalWrites | The total number of write requests |
logicalReadBytes | The total accumulated size for all read requests |
logicalWriteBytes | The total accumulated size for all write requests |
physicalReads | The actual number of file read operations |
physicalWrites | The actual number of file write operations |
physicalReadBytes | The actual accumulated size for all file read operations |
physicalWriteBytes | The actual accumulated size for all file write operations |
The logical counts record the number and size of requests that can be serviced in cache, whereas the physical counts record actual disk activity.
The returned values include cumulative counters, which are not reset during the lifetime of the database server node. You need to compare values from one execution of the getStatistics method with the previous values, to work out the differences.
The cumulative values are held as 64-bit unsigned integers, which are copied to the dynamic object as Integer64 values. The maximum value before they wrap around to negative values is therefore 2^63 - 1 (approximately 8 Exabytes).
The calling process is responsible for creating and deleting the JadeDynamicObject instance. Properties are added to the object when the method is first called. The object can then be used in subsequent calls.
If the dynamic object passed to the method already contains properties that do not match the properties to be returned, the existing dynamic object properties are removed and replaced with the appropriate properties. This method is most efficient when the properties match those to be returned.
The following example shows the use of the getStatistics method.
showAllDbFileStats(); //display DB file statistics for all user files vars dbf : DbFile; jdo : JadeDynamicObject; dba : JadeDatabaseAdmin; dbfiles : DbFileArray; begin create dba transient; create dbfiles transient; create jdo transient; dba.getDbFiles(DbFile.Kind_User_Data, dbfiles); foreach dbf in dbfiles do dbf.getStatistics(jdo); write dbf.name & ":" & jdo.display; endforeach; epilog delete dbfiles; delete dba; delete jdo; end;
The output from the getStatistics method shown in the previous example is as follows.
MCustomers:---DatabaseFileStatistics(108)--- logicalReads = 1 logicalWrites = 1 logicalReadBytes = 119 logicalWriteBytes = 119 physicalReads = 1 physicalWrites = 1 physicalReadBytes = 4096 physicalWriteBytes = 8192 MVendors:---DatabaseFileStatistics(108)--- logicalReads = 1 logicalWrites = 1 logicalReadBytes = 119 logicalWriteBytes = 119 physicalReads = 1 physicalWrites = 1 physicalReadBytes = 4096 physicalWriteBytes = 8192 MProducts:---DatabaseFileStatistics(108)--- logicalReads = 1 logicalWrites = 1 logicalReadBytes = 119 logicalWriteBytes = 119 physicalReads = 1 physicalWrites = 1 physicalReadBytes = 4096 physicalWriteBytes = 8192