This function collects information about the size of allocated and used pages in the database file.
MCO_RET mco_disk_get_allocated_space(
/* IN */ mco_db_h con,
/* OUT */ mco_offs_t* allocated,
/* OUT */ mco_offs_t* used);
con
allocated
used
This function collects information about the size and distribution of allocated and used pages in the database file. It provides a summary view of physical space usage without exposing fine-grained fragmentation details.
The function is similar to
mco_disk_get_alloc_info, but it does not return a histogram of hole counters. As a result, it has lower overhead and is intended for lightweight monitoring and diagnostics rather than detailed fragmentation analysis.
MCO_S_OKThe function completed successfully.MCO_E_UNSUPPORTEDUnsupported call.
...
#define CHECK(func) { MCO_RET rc_ = func; if (rc_ != MCO_S_OK) { \
printf("\nCall \"" #func "\" at %s:%d failed , code = %d\n\t(%s)\n", __FILE__, __LINE__, rc_, mco_ret_string(rc_, 0)); \
dbg_exit(rc_); }}
...
mco_disk_alloc_info_t unaligned, aligned;
mco_offs_t allocated, used, total_allocated, total_used;
...
CHECK(mco_disk_get_alloc_info(db, &unaligned, &aligned));
CHECK(mco_disk_get_allocated_space(db, &allocated, &used));
total_allocated = unaligned.allocated + aligned.allocated;
total_used = unaligned.used + aligned.used;
...
printf("alloc_info: alloc %lld(bytes), used %lld(bytes)\n",
(mco_int8)total_allocated, (mco_int8)total_used);
printf("allocated_space: alloc %lld(bytes), used %lld(bytes)\n\n",
(mco_int8)allocated, (mco_int8)used);
...