Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
Diff: features/frameworks/greentea-client/source/greentea_metrics.cpp
- Revision:
- 1:9db0e321a9f4
- Parent:
- 0:5b88d5760320
--- a/features/frameworks/greentea-client/source/greentea_metrics.cpp Tue Dec 17 23:23:45 2019 +0000
+++ b/features/frameworks/greentea-client/source/greentea_metrics.cpp Tue Dec 31 06:02:27 2019 +0000
@@ -20,19 +20,7 @@
#include "platform/mbed_stats.h"
#include <stdint.h>
-#define THREAD_BUF_COUNT 16
-
-typedef struct {
- uint32_t entry;
- uint32_t stack_size;
- uint32_t max_stack;
-} thread_info_t;
-
-#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
-
-#if !defined(MBED_CONF_RTOS_PRESENT) || !(MBED_CONF_RTOS_PRESENT)
-#error "RTOS required for Stack stats"
-#endif
+#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED && defined(MBED_CONF_RTOS_PRESENT)
#include "rtos/Mutex.h"
#include "rtos/Thread.h"
@@ -44,6 +32,14 @@
using namespace mbed;
using namespace rtos;
+#define THREAD_BUF_COUNT 16
+
+typedef struct {
+ uint32_t entry;
+ uint32_t stack_size;
+ uint32_t max_stack;
+} thread_info_t;
+
// Mutex to protect "buf"
static SingletonPtr<Mutex> mutex;
static char buf[128];
@@ -57,7 +53,7 @@
#if defined(MBED_HEAP_STATS_ENABLED ) && MBED_HEAP_STATS_ENABLED
static void send_heap_info(void);
#endif
-#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
+#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED && defined(MBED_CONF_RTOS_PRESENT)
static void send_stack_info(void);
static void on_thread_terminate(osThreadId_t id);
static void enqeue_thread_info(osThreadId_t id);
@@ -70,7 +66,7 @@
void greentea_metrics_setup()
{
-#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
+#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED && defined(MBED_CONF_RTOS_PRESENT)
Kernel::attach_thread_terminate_hook(on_thread_terminate);
#endif
}
@@ -80,7 +76,7 @@
#if defined(MBED_HEAP_STATS_ENABLED ) && MBED_HEAP_STATS_ENABLED
send_heap_info();
#endif
-#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
+#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED && defined(MBED_CONF_RTOS_PRESENT)
send_stack_info();
Kernel::attach_thread_terminate_hook(NULL);
#endif
@@ -112,7 +108,7 @@
}
#endif
-#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
+#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED && defined(MBED_CONF_RTOS_PRESENT)
MBED_UNUSED static void send_stack_info()
{
mutex->lock();