-
Notifications
You must be signed in to change notification settings - Fork 252
Add resource stats API #1522
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
base: main
Are you sure you want to change the base?
Add resource stats API #1522
Conversation
| } | ||
| } | ||
|
|
||
| static uint32 OS_CountActiveForObjectType(osal_objtype_t idtype) |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| } | ||
| } | ||
|
|
||
| int32 OS_GetResourceStats(OS_resource_stats_t *stats) |
Check notice
Code scanning / CodeQL
Long function without assertion Note
Details: - add OS_resource_stats_t and OS_GetResourceStats for totals/used counts - count active objects via ID map iteration - add unit and coverage tests for stats and null handling
9b14cf8 to
47174e7
Compare
|
Let me know if this is desirable and I should work it more. |
|
Feel free to close this, I am now going to use the RTEMS api for getting resources. However you could modify this to use the rtems/vx works implementations, and fall back to this osal methods for OS systems that do not have resource snapshots. https://docs.rtems.org/doxygen/main/group__libcsupport.html#ga89d650cbacc4217c00298014c7bfb723 |
In case it helps someone, that family of APIs is used in the RTEMS tests to take a resource snapshot before a series of operations and check that at the end, no resources were leaked. These could be used by user unit tests for the same purpose. I know most RTEMS applications run until the hardware is shutdown or reset but sometimes you have a more dynamic application and avoiding leaks is important. |
Details:
add OS_resource_stats_t and OS_GetResourceStats for totals/used counts
count active objects via ID map iteration
add unit and coverage tests for stats and null handling
Checklist (Please check before submitting)
Describe the contribution
Adds an API to retrieve the OS usage counts.
I plan to stop and restart apps and monitor the OS resource usages to detect resource leaks.
Testing performed
Steps taken to test the contribution:
Tests added, full coverage / branch coverage.
2. Execution steps '...'
Expected behavior changes
A clear and concise description of how this contribution will change behavior and level of impact.
System(s) tested on
Linux
Additional context
Add any other context about the contribution here.
Third party code
This code was developed with the codex ai
Contributor Info - All information REQUIRED for consideration of pull request
Full name and company/organization/center of all contributors ("Personal" if individual work)