mco_disk_get_cache_info

Get runtime disk manager cache statistics.

Prototype

 
    mco_disk_cache_info_t*	mco_disk_get_cache_info(	/*IN*/ mco_db_h db );
 

Arguments

db The database handle that was established by mco_db_connect()

Description

This function allows applications to obtain runtime disk manager cache statistics in structure mco_disk_cache_info_t, including cache hits and cache misses. A cache hit occurs when the address or data required by the database runtime is found in the cache and does not require retrieval from the storage media. This information could, for example, be used to fine-tune the application’s caching policies.

Return Codes

mco_disk_cache_info_t The current runtime disk manager cache statistics in structure mco_disk_cache_info_t

Example

 
    Application snippet:
        
     
    const char * dbname = "SimpleDb";
     
    int main(int argc, char* argv[])
    {
        mco_db_h db;
        MCO_RET rc;
        mco_device_t       dev[4];
        mco_db_params_t    db_params;
        mco_disk_cache_info_t    info;
                 
        ...
        rc = mco_db_open_dev( dbname, simple_get_dictionary(), dev, 4, &db_params );
             
        if ( MCO_S_OK != rc )
        {
            rc = mco_db_connect(  dbname, &db );
            ...
            info = mco_disk_get_cache_info( db );
        
            printf("\n\tCache info:\n"
            "\t\tConnection hits:\t%d\n"
            "\t\tCache hits:\t%d\n"
            "\t\tCache misses:\t%d\n"
            "\t\tAllocated pages:\t%d\n"
            "\t\tUsed pages:\t%d\n"
            "\t\tPinned pages:\t%d\n"
            "\t\tModified pages:\t%d\n"
            "\t\tDirty pages:\t%d\n"
            "\t\tCopied pages:\t%d\n",
            info->connection_cache_hits,
            info->cache_hits,
            info->cache_misses,
            info->allocated_pages,
            info->used_pages,
            info->pinned_pages,
            info->modified_pages,
            info->dirty_pages,
            info->copied_pages );
            rc = mco_disk_flush( db );
        
            ...
        }
    }
 

Files

Header file:
mco.h
Source file:
mcodisk.c
Library:
libmcovtdsk.a
Header file:
mco.h
Source file:
mcovtmem.c
Library:
libmcovtmem.a