unsigned long hp_shm_get_free(struct hp_block *hpb) { if (stats_are_expired(hpb)) update_shm_stats(hpb); return hpb->size - hpb->real_used; }
unsigned long hp_shm_get_frags(struct hp_block *hpb) { if (stats_are_expired(hpb)) update_shm_stats(hpb); return hpb->total_fragments; }
unsigned long hp_shm_get_max_real_used(struct hp_block *hpb) { if (stats_are_expired(hpb)) update_shm_stats(hpb); return hpb->max_real_used; }
/* fills a malloc info structure with info about the memory block */ void hp_info(struct hp_block *hpb, struct mem_info *info) { memset(info, 0, sizeof *info); info->total_size = hpb->size; info->min_frag = MIN_FRAG_SIZE; #ifdef HP_MALLOC_FAST_STATS if (stats_are_expired(hpb)) update_shm_stats(hpb); #endif info->used = hpb->used; info->real_used = hpb->real_used; info->free = hpb->size - hpb->real_used; info->total_frags = hpb->total_fragments; LM_DBG("mem_info: (sz: %ld | us: %ld | rus: %ld | free: %ld | frags: %ld)\n", info->total_size, info->used, info->real_used, info->free, info->total_frags); }