Skip to content

Commit ab7a856

Browse files
author
Cruz Monrreal
authored
Merge pull request #6784 from deepikabhavnani/mbed_stats_fix
Add common define MBED_ALL_STATS_ENABLED to enable all statistics
2 parents 634774f + 52c33b5 commit ab7a856

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

mbed.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
#include "platform/DirHandle.h"
9393
#include "platform/CriticalSectionLock.h"
9494
#include "platform/DeepSleepLock.h"
95+
#include "platform/mbed_stats.h"
9596

9697
// mbed Non-hardware components
9798
#include "platform/Callback.h"

platform/mbed_stats.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <stdlib.h>
44
#include "mbed_assert.h"
55

6-
#if MBED_CONF_RTOS_PRESENT
6+
#ifdef MBED_CONF_RTOS_PRESENT
77
#include "cmsis_os2.h"
88
#endif
99

@@ -14,7 +14,7 @@ void mbed_stats_stack_get(mbed_stats_stack_t *stats)
1414
MBED_ASSERT(stats != NULL);
1515
memset(stats, 0, sizeof(mbed_stats_stack_t));
1616

17-
#if MBED_STACK_STATS_ENABLED && MBED_CONF_RTOS_PRESENT
17+
#if defined(MBED_STACK_STATS_ENABLED) && defined(MBED_CONF_RTOS_PRESENT)
1818
uint32_t thread_n = osThreadGetCount();
1919
unsigned i;
2020
osThreadId_t *threads;
@@ -43,7 +43,7 @@ size_t mbed_stats_stack_get_each(mbed_stats_stack_t *stats, size_t count)
4343
memset(stats, 0, count*sizeof(mbed_stats_stack_t));
4444
size_t i = 0;
4545

46-
#if MBED_STACK_STATS_ENABLED && MBED_CONF_RTOS_PRESENT
46+
#if defined(MBED_STACK_STATS_ENABLED) && defined(MBED_CONF_RTOS_PRESENT)
4747
osThreadId_t *threads;
4848

4949
threads = malloc(sizeof(osThreadId_t) * count);
@@ -67,6 +67,6 @@ size_t mbed_stats_stack_get_each(mbed_stats_stack_t *stats, size_t count)
6767
return i;
6868
}
6969

70-
#if MBED_STACK_STATS_ENABLED && !MBED_CONF_RTOS_PRESENT
70+
#if defined(MBED_STACK_STATS_ENABLED) && !defined(MBED_CONF_RTOS_PRESENT)
7171
#warning Stack statistics are currently not supported without the rtos.
7272
#endif

platform/mbed_stats.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
extern "C" {
3030
#endif
3131

32+
#ifdef MBED_ALL_STATS_ENABLED
33+
#define MBED_STACK_STATS_ENABLED 1
34+
#define MBED_HEAP_STATS_ENABLED 1
35+
#endif
36+
3237
/**
3338
* struct mbed_stats_heap_t definition
3439
*/

rtos/TARGET_CORTEX/mbed_rtx_conf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#error "OS Tickrate must be 1000 for system timing"
5555
#endif
5656

57-
#if !defined(OS_STACK_WATERMARK) && (defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED)
57+
#if !defined(OS_STACK_WATERMARK) && (defined(MBED_STACK_STATS_ENABLED) || defined(MBED_ALL_STATS_ENABLED))
5858
#define OS_STACK_WATERMARK 1
5959
#endif
6060

0 commit comments

Comments
 (0)