Skip to content

Commit b7ef70d

Browse files
Cruz Monrreal IICruz Monrreal II
authored andcommitted
Merge branch 'update_stats_docs' of ssh://github.com/bridadan/mbed into bridadan-update_stats_docs
2 parents 0d1b2c1 + 82c4ce6 commit b7ef70d

File tree

1 file changed

+34
-32
lines changed

1 file changed

+34
-32
lines changed

platform/mbed_stats.h

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ extern "C" {
4242
* struct mbed_stats_heap_t definition
4343
*/
4444
typedef struct {
45-
uint32_t current_size; /**< Bytes allocated currently. */
46-
uint32_t max_size; /**< Max bytes allocated at a given time. */
47-
uint32_t total_size; /**< Cumulative sum of bytes ever allocated. */
48-
uint32_t reserved_size; /**< Current number of bytes allocated for the heap. */
49-
uint32_t alloc_cnt; /**< Current number of allocations. */
50-
uint32_t alloc_fail_cnt; /**< Number of failed allocations. */
51-
uint32_t overhead_size; /**< Overhead added to heap for stats. */
45+
uint32_t current_size; /**< Bytes currently allocated on the heap */
46+
uint32_t max_size; /**< Maximum bytes allocated on the heap at one time since reset */
47+
uint32_t total_size; /**< Cumulative sum of bytes allocated on the heap that have not been freed */
48+
uint32_t reserved_size; /**< Current number of bytes reserved for the heap */
49+
uint32_t alloc_cnt; /**< Current number of allocations that have not been freed since reset */
50+
uint32_t alloc_fail_cnt; /**< Number of failed allocations since reset */
51+
uint32_t overhead_size; /**< Number of bytes used to store heap statistics. This overhead takes up space on the heap, reducing the available heap space */
5252
} mbed_stats_heap_t;
5353

5454
/**
55-
* Fill the passed in heap stat structure with heap stats.
55+
* Fill the passed in heap stat structure with the heap statistics.
5656
*
5757
* @param stats A pointer to the mbed_stats_heap_t structure to fill
5858
*/
@@ -62,38 +62,39 @@ void mbed_stats_heap_get(mbed_stats_heap_t *stats);
6262
* struct mbed_stats_stack_t definition
6363
*/
6464
typedef struct {
65-
uint32_t thread_id; /**< Identifier for thread that owns the stack or 0 if multiple threads. */
66-
uint32_t max_size; /**< Maximum number of bytes used on the stack. */
67-
uint32_t reserved_size; /**< Current number of bytes allocated for the stack. */
68-
uint32_t stack_cnt; /**< Number of stacks stats accumulated in the structure. */
65+
uint32_t thread_id; /**< Identifier for the thread that owns the stack or 0 if representing accumulated statistics */
66+
uint32_t max_size; /**< Maximum number of bytes used on the stack since the thread was started */
67+
uint32_t reserved_size; /**< Current number of bytes reserved for the stack */
68+
uint32_t stack_cnt; /**< The number of stacks represented in the accumulated statistics or 1 if repesenting a single stack */
6969
} mbed_stats_stack_t;
7070

7171
/**
72-
* Fill the passed in structure with stack stats accumulated for all threads. The thread_id will be 0
72+
* Fill the passed in structure with stack statistics accumulated for all threads. The thread_id will be 0
7373
* and stack_cnt will represent number of threads.
7474
*
7575
* @param stats A pointer to the mbed_stats_stack_t structure to fill
7676
*/
7777
void mbed_stats_stack_get(mbed_stats_stack_t *stats);
7878

7979
/**
80-
* Fill the passed array of stat structures with the stack stats for each available thread.
80+
* Fill the passed array of structures with the stack statistics for each available thread.
8181
*
8282
* @param stats A pointer to an array of mbed_stats_stack_t structures to fill
8383
* @param count The number of mbed_stats_stack_t structures in the provided array
84-
* @return The number of mbed_stats_stack_t structures that have been filled,
85-
* this is equal to the number of stacks on the system.
84+
* @return The number of mbed_stats_stack_t structures that have been filled.
85+
* If the number of stacks on the system is less than or equal to count, it will equal the number of stacks on the system.
86+
* If the number of stacks on the system is greater than count, it will equal count.
8687
*/
8788
size_t mbed_stats_stack_get_each(mbed_stats_stack_t *stats, size_t count);
8889

8990
/**
9091
* struct mbed_stats_cpu_t definition
9192
*/
9293
typedef struct {
93-
us_timestamp_t uptime; /**< Time since system is up and running */
94-
us_timestamp_t idle_time; /**< Time spent in idle thread since system is up and running */
95-
us_timestamp_t sleep_time; /**< Time spent in sleep since system is up and running */
96-
us_timestamp_t deep_sleep_time; /**< Time spent in deep sleep since system is up and running */
94+
us_timestamp_t uptime; /**< Time since the system has started */
95+
us_timestamp_t idle_time; /**< Time spent in the idle thread since the system has started */
96+
us_timestamp_t sleep_time; /**< Time spent in sleep since the system has started */
97+
us_timestamp_t deep_sleep_time; /**< Time spent in deep sleep since the system has started */
9798
} mbed_stats_cpu_t;
9899

99100
/**
@@ -107,21 +108,22 @@ void mbed_stats_cpu_get(mbed_stats_cpu_t *stats);
107108
* struct mbed_stats_thread_t definition
108109
*/
109110
typedef struct {
110-
uint32_t id; /**< Thread Object Identifier */
111-
uint32_t state; /**< Thread Object State */
112-
uint32_t priority; /**< Thread Priority */
113-
uint32_t stack_size; /**< Thread Stack Size */
114-
uint32_t stack_space; /**< Thread remaining stack size */
115-
const char *name; /**< Thread Object name */
111+
uint32_t id; /**< ID of the thread */
112+
uint32_t state; /**< State of the thread */
113+
uint32_t priority; /**< Priority of the thread (higher number indicates higher priority) */
114+
uint32_t stack_size; /**< Current number of bytes reserved for the stack */
115+
uint32_t stack_space; /**< Current number of free bytes remaining on the stack */
116+
const char *name; /**< Name of the thread */
116117
} mbed_stats_thread_t;
117118

118119
/**
119-
* Fill the passed array of stat structures with the thread stats for each available thread.
120+
* Fill the passed array of stat structures with the thread statistics for each available thread.
120121
*
121122
* @param stats A pointer to an array of mbed_stats_thread_t structures to fill
122123
* @param count The number of mbed_stats_thread_t structures in the provided array
123-
* @return The number of mbed_stats_thread_t structures that have been filled,
124-
* this is equal to the number of threads on the system.
124+
* @return The number of mbed_stats_thread_t structures that have been filled.
125+
* If the number of threads on the system is less than or equal to count, it will equal the number of threads on the system.
126+
* If the number of threads on the system is greater than count, it will equal count.
125127
*/
126128
size_t mbed_stats_thread_get_each(mbed_stats_thread_t *stats, size_t count);
127129

@@ -138,14 +140,14 @@ typedef enum {
138140
* struct mbed_stats_sys_t definition
139141
*/
140142
typedef struct {
141-
uint32_t os_version; /**< Mbed OS Version (Release only) */
142-
uint32_t cpu_id; /**< CPUID Register data (Cortex-M only supported) */
143+
uint32_t os_version; /**< Mbed OS version (populated only for tagged releases) */
144+
uint32_t cpu_id; /**< CPUID register data (Cortex-M only supported) */
143145
mbed_compiler_id_t compiler_id; /**< Compiler ID \ref mbed_compiler_id_t */
144146
uint32_t compiler_version; /**< Compiler version */
145147
} mbed_stats_sys_t;
146148

147149
/**
148-
* Fill the passed in sys stat structure with system stats.
150+
* Fill the passed in system stat structure with system statistics.
149151
*
150152
* @param stats A pointer to the mbed_stats_sys_t structure to fill
151153
*/

0 commit comments

Comments
 (0)