-
Notifications
You must be signed in to change notification settings - Fork 3k
Thread stats API #6795
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
Thread stats API #6795
Conversation
t2.terminate(); | ||
|
||
count = mbed_stats_thread_get_each(stats, MAX_THREAD_STATS); | ||
TEST_ASSERT_EQUAL(3, count); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deepikabhavnani - You may want to check for the difference in the number of threads and not the absolute count. Because if we start running more threads as part of test infrastructure or for any other reason this test may break.
platform/mbed_stats.c
Outdated
#warning Stack statistics are currently not supported without the rtos. | ||
size_t mbed_stats_thread_get_each(mbed_stats_thread_t *stats, size_t count) | ||
{ | ||
MBED_ASSERT(stats != NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also assert for if count == 0, for debug builds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of count 0, we will not fill up anything. But in case of NULL pointer, next operation in the code is memset
which should not be performed on NULL pointer.
platform/mbed_stats.h
Outdated
uint32_t thread_stack_size; /**< Thread Stack Size */ | ||
uint32_t thread_stack_space; /**< Thread remaining stack size */ | ||
const char *thread_name; /**< Thread Object name */ | ||
} mbed_stats_thread_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to repeat thread_ prefix ?
mbed_stats_thread_t
says this contains tread stats. all members are related to the thread (if not they would be a separate object?). Thus would be thread_stats.id/state/priority oppose to thread_stats.thread_id ?
platform/mbed_stats.h
Outdated
* @param stats A pointer to an array of mbed_stats_thread_t structures to fill | ||
* @param count The number of mbed_stats_thread_t structures in the provided array | ||
* @return The number of mbed_stats_thread_t structures that have been filled, | ||
* this is equal to the number of stacks on the system. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is equal to the number of stacks on the system
- I do not understand stacks in this context? how many stacks we have? not threads here?
@0xc0170 @SenRamakri - Pushed commits addressing review comments. |
/morph build |
Build : SUCCESSBuild number : 1947 Triggering tests/morph test |
Test : FAILUREBuild number : 1768 |
Build : SUCCESSBuild number : 1965 Triggering tests/morph test |
Test : FAILUREBuild number : 1779 |
/morph test |
@cmonr - As per the build log, MBED_ALL_STATS_ENABLED was not enabled. Can kill test. |
27ca65c
to
c651d82
Compare
Exporter Build : FAILUREBuild number : 1616 |
API to get all system threads information and states.
1. Removed prefix thread_ from all elements of mbed_stats_thread_t 2. #if conditions aligned to rest of the file
c651d82
to
97c8818
Compare
Rebased to resolve conflict |
@SenRamakri @0xc0170 - Please review |
/morph build |
Build : SUCCESSBuild number : 1997 Triggering tests/morph test |
@0xc0170 - Command used in build does not contain ALL flags enabled. Will have to re-run once @studavekar does that change. |
re-triggering /morph build |
Build : SUCCESSBuild number : 2005 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 1657 |
Test : SUCCESSBuild number : 1815 |
Description
Addition of API to get information of all active threads in Mbed OS.
Pull request type
CC @SenRamakri
Dependent on #6784