mco_calc_get_class_info

Collects memory statistics for the specified class.

Prototype

 
    MCO_RET mco_calc_get_class_info(	/*IN*/ mco_calc_t * calc,
                       /*IN*/ mco_cc_t class,
                       /*OUT*/ mco_cc_info_t * info);
 

Arguments

calc A handle to the initialized calculator object

class

A class struct identifying the class for which information is requested

info

The address of a class info struct to receive the class information

Description

This function collects memory information for a single class registered in the database calculator passed in calc.

Return Codes

MCO_S_OK The class information waqs collected successfully

MCO_E_INVALID_HANDLE

An invalid handle was passed in calc or class

Example

 
    Application snippet:
        
     
    const char * dbname = "calc_db";
     
    static mco_cc_t my_classes[] = 
    {
           MCO_CALC_DEFINE_CLASS("class1", 10000),
           MCO_CALC_DEFINE_CLASS("class2", 20000),
           MCO_CALC_CLASSES_END,
     };
 
    int main(int argc, char* argv[])
    {
        MCO_RET            rc;
        mco_device_t       dev;
        mco_db_params_t    db_params;
        mco_calc_t calc;
        mco_cc_info_t info;
         
        mco_runtime_start();
        ...
        mco_calc_init(&calc, calc_db_get_dictionary());
        ...
        rc = mco_db_open_dev( dbname, simple_get_dictionary(), &dev, 1, &db_params );
        if ( MCO_S_OK != rc )
        {
            rc = mco_db_connect(  dbname, &calc.db );
            ...
            rc = mco_calc_class_add(&calc, my_classes[0]);
            rc = mco_calc_class_add(&calc, my_classes[1]);
            ...
            rc = mco_calc_fill_db(&calc);
            ...
            rc = mco_calc_get_class_info(&calc, my_classes[0], &info);
        
            ...
             
            /* NOTE: calculator *must* be deinitialized before you disconnect from the database */
            mco_calc_deinit(&calc);
         
            mco_db_disconnect(calc.db);
        }
    }
         

For further implementation details see SDK sample "samples/native/core/17-statistics/dbcalc".

Related Topics Link IconRelated Topics

Files

Header file:
mcodbcalc.h
Source file:
mcodbcalc.c
Library:
libmcodbcalc.a