1
0

blockpool__get_stats.c 1.1 KB

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