Skip to content

add pool alloc counter ctl #1361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2025
Merged

add pool alloc counter ctl #1361

merged 1 commit into from
Jun 11, 2025

Conversation

lplewa
Copy link
Contributor

@lplewa lplewa commented Jun 9, 2025

Description

Checklist

  • Code compiles without errors locally
  • All tests pass locally
  • CI workflows execute properly
  • CI workflows, not executed per PR (e.g. Nightly), execute properly
  • New tests added, especially if they will fail without my changes
  • Added/extended example(s) to cover this functionality
  • Extended the README/documentation
  • All newly added source files have a license
  • All newly added source files are referenced in CMake files
  • Logger (with debug/info/... messages) is used
  • All API changes are reflected in docs and def/map files, and are tested

@lplewa lplewa force-pushed the piwo branch 3 times, most recently from f5cd152 to 9ddd0d6 Compare June 9, 2025 11:04
@bratpiorka
Copy link
Contributor

LGTM but formatting could be improved (empty lines, comments)

@lplewa lplewa force-pushed the piwo branch 2 times, most recently from 7373f2f to 2c34692 Compare June 9, 2025 14:29
@lplewa lplewa force-pushed the piwo branch 5 times, most recently from 10b7d79 to 27bef2a Compare June 10, 2025 08:47
@KFilipek KFilipek marked this pull request as ready for review June 10, 2025 09:33
@KFilipek KFilipek requested a review from a team as a code owner June 10, 2025 09:33
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a new allocation counter control (alloc_count) to the UMF memory pool API and tests.

  • Introduce stats.alloc_count to track active allocations in each pool
  • Register a new CTL subtree under umf.pool.by_handle.stats.alloc_count
  • Update all alloc/free/realloc APIs to atomically increment/decrement the counter, and add a parameterized test

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
test/poolFixtures.hpp New ctl_stat_alloc_count test to verify allocation counts
test/common/pool.hpp Ignore aligned‐alloc support on Windows via #ifdef _WIN32
src/memory_pool_internal.h Add umf_pool_stats_t and stats field to umf_memory_pool_t
src/memory_pool.c Implement CTL handler, wire up alloc_count, update alloc/free/realloc
Comments suppressed due to low confidence (1)

src/memory_pool_internal.h:41

  • [nitpick] Consider using a struct default initializer for stats (e.g. umf_pool_stats_t stats = {0};) to avoid the explicit memset in the create path.
    memset(&pool->stats, 0, sizeof(pool->stats));

Copy link
Contributor

@KFilipek KFilipek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job well done

@bratpiorka bratpiorka merged commit cfc78d2 into oneapi-src:main Jun 11, 2025
155 of 160 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants