blockpool__get_stats.c 1.2 KB

12345678910111213141516171819202122232425
  1. /*
  2. * blockpool__get_stats->c
  3. */
  4. #include "private.h"
  5. /*--------------------------------------------------------- */
  6. void
  7. lub_blockpool__get_stats(lub_blockpool_t *this,
  8. lub_blockpool_stats_t *stats)
  9. {
  10. stats->block_size = this->m_block_size;
  11. stats->num_blocks = this->m_num_blocks;
  12. stats->alloc_blocks = this->m_alloc_blocks;
  13. stats->alloc_bytes = stats->alloc_blocks * stats->block_size;
  14. stats->free_blocks = stats->num_blocks - stats->alloc_blocks;
  15. stats->free_bytes = stats->free_blocks * stats->block_size;
  16. stats->alloc_total_blocks = this->m_alloc_total_blocks;
  17. stats->alloc_total_bytes = stats->alloc_total_blocks * stats->block_size;
  18. stats->alloc_hightide_blocks = this->m_alloc_hightide_blocks;
  19. stats->alloc_hightide_bytes = stats->alloc_hightide_blocks * stats->block_size;
  20. stats->free_hightide_blocks = stats->num_blocks - stats->alloc_hightide_blocks;
  21. stats->free_hightide_bytes = stats->free_hightide_blocks * stats->block_size;
  22. stats->alloc_failures = this->m_alloc_failures;
  23. }
  24. /*--------------------------------------------------------- */