mco_disk_cache_usage

Estimate the amount of disk cache memory used by persistent objects of each class.

Prototype

        MCO_RET mco_disk_cache_usage(
            /*IN*/  mco_db_h db,
            /*OUT*/ mco_size_t *classes
        );

Arguments

db
Database connection handle.
classes
Pointer to an array of mco_size_t values, where each element corresponds to a class in the database dictionary. The function writes the estimated cached size (in bytes) for each class into this array. The array must be large enough to hold n_class_codes elements (typically MCO_MAX_CLASSES).

Description

This function scans all pages of persistent storage that are currently loaded in the disk cache and estimates the total memory footprint of cached objects for each class.

It uses the PAGE_PROBE flag during page iteration, which means it only considers pages that are already present in the cache — pages not loaded into memory are skipped.

The function is primarily intended for diagnostic and monitoring purposes.

Important limitations:

Return Codes

MCO_S_OK
Cache usage statistics successfully gathered.
Other error codes
May include I/O errors or internal system errors during page iteration.

Files

Header file:
mco.h
Source file:
mcodisk.c
Library:
libmcolib.a