Skip to content

Commit a228fd0

Browse files
author
deepikabhavnani
committed
Add common define to enable all statistics
As part of Device Health requirement, all mbed OS statistics should be enabled with single macro `MBED_ALL_STATS_ENABLED`
1 parent d08c819 commit a228fd0

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

platform/mbed_stats.c

+4-4
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

@@ -13,7 +13,7 @@ void mbed_stats_stack_get(mbed_stats_stack_t *stats)
1313
{
1414
memset(stats, 0, sizeof(mbed_stats_stack_t));
1515

16-
#if MBED_STACK_STATS_ENABLED && MBED_CONF_RTOS_PRESENT
16+
#if defined(MBED_STACK_STATS_ENABLED) && defined(MBED_CONF_RTOS_PRESENT)
1717
uint32_t thread_n = osThreadGetCount();
1818
unsigned i;
1919
osThreadId_t *threads;
@@ -41,7 +41,7 @@ size_t mbed_stats_stack_get_each(mbed_stats_stack_t *stats, size_t count)
4141
memset(stats, 0, count*sizeof(mbed_stats_stack_t));
4242
size_t i = 0;
4343

44-
#if MBED_STACK_STATS_ENABLED && MBED_CONF_RTOS_PRESENT
44+
#if defined(MBED_STACK_STATS_ENABLED) && defined(MBED_CONF_RTOS_PRESENT)
4545
osThreadId_t *threads;
4646

4747
threads = malloc(sizeof(osThreadId_t) * count);
@@ -65,6 +65,6 @@ size_t mbed_stats_stack_get_each(mbed_stats_stack_t *stats, size_t count)
6565
return i;
6666
}
6767

68-
#if MBED_STACK_STATS_ENABLED && !MBED_CONF_RTOS_PRESENT
68+
#if defined(MBED_STACK_STATS_ENABLED) && !defined(MBED_CONF_RTOS_PRESENT)
6969
#warning Stack statistics are currently not supported without the rtos.
7070
#endif

platform/mbed_stats.h

+5
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

+5-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@
4545
#error "OS Tickrate must be 1000 for system timing"
4646
#endif
4747

48-
#if !defined(OS_STACK_WATERMARK) && (defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED)
48+
#if !defined(OS_STACK_WATERMARK) && defined(MBED_STACK_STATS_ENABLED)
49+
#define OS_STACK_WATERMARK 1
50+
#endif
51+
52+
#if !defined(OS_STACK_WATERMARK) && defined(MBED_ALL_STATS_ENABLED)
4953
#define OS_STACK_WATERMARK 1
5054
#endif
5155

0 commit comments

Comments
 (0)