File tree Expand file tree Collapse file tree 2 files changed +52
-3
lines changed Expand file tree Collapse file tree 2 files changed +52
-3
lines changed Original file line number Diff line number Diff line change
1
+ #include "mbed_assert.h"
1
2
#include "mbed_stats.h"
2
3
#include <string.h>
3
4
#include <stdlib.h>
4
- #include "mbed_assert.h"
5
5
6
+ #include "device.h"
6
7
#ifdef MBED_CONF_RTOS_PRESENT
7
8
#include "cmsis_os2.h"
8
9
#elif defined(MBED_STACK_STATS_ENABLED ) || defined(MBED_THREAD_STATS_ENABLED )
@@ -96,6 +97,29 @@ size_t mbed_stats_thread_get_each(mbed_stats_thread_t *stats, size_t count)
96
97
osKernelUnlock ();
97
98
free (threads );
98
99
#endif
99
-
100
100
return i ;
101
101
}
102
+
103
+ void mbed_stats_sys_get (mbed_stats_sys_t * stats )
104
+ {
105
+ MBED_ASSERT (stats != NULL );
106
+ memset (stats , 0 , sizeof (mbed_stats_sys_t ));
107
+
108
+ #if defined(MBED_SYS_STATS_ENABLED )
109
+
110
+ stats -> cpu_id = SCB -> CPUID ;
111
+
112
+ #if defined(__IAR_SYSTEMS_ICC__ )
113
+ stats -> compiler_id = IAR ;
114
+ stats -> compiler_version = __VER__ ;
115
+ #elif defined(__CC_ARM )
116
+ stats -> compiler_id = ARM ;
117
+ stats -> compiler_version = __ARMCC_VERSION ;
118
+ #elif defined(__GNUC__ )
119
+ stats -> compiler_id = GCC_ARM ;
120
+ stats -> compiler_version = (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 );
121
+ #endif
122
+
123
+ #endif
124
+ return ;
125
+ }
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ extern "C" {
30
30
#endif
31
31
32
32
#ifdef MBED_ALL_STATS_ENABLED
33
+ #define MBED_SYS_STATS_ENABLED 1
33
34
#define MBED_STACK_STATS_ENABLED 1
34
35
#define MBED_HEAP_STATS_ENABLED 1
35
36
#define MBED_THREAD_STATS_ENABLED 1
@@ -85,7 +86,6 @@ size_t mbed_stats_stack_get_each(mbed_stats_stack_t *stats, size_t count);
85
86
/**
86
87
* struct mbed_stats_thread_t definition
87
88
*/
88
-
89
89
typedef struct {
90
90
uint32_t id ; /**< Thread Object Identifier */
91
91
uint32_t state ; /**< Thread Object State */
@@ -105,6 +105,31 @@ typedef struct {
105
105
*/
106
106
size_t mbed_stats_thread_get_each (mbed_stats_thread_t * stats , size_t count );
107
107
108
+ /**
109
+ * enum mbed_compiler_id_t definition
110
+ */
111
+ typedef enum {
112
+ ARM = 1 , /**< ARM */
113
+ GCC_ARM , /**< GNU ARM */
114
+ IAR /**< IAR */
115
+ } mbed_compiler_id_t ;
116
+
117
+ /**
118
+ * struct mbed_stats_sys_t definition
119
+ */
120
+ typedef struct {
121
+ uint32_t cpu_id ; /**< CPUID Register data */
122
+ mbed_compiler_id_t compiler_id ; /**< Compiler ID \ref mbed_compiler_id_t */
123
+ uint32_t compiler_version ; /**< Compiler version */
124
+ } mbed_stats_sys_t ;
125
+
126
+ /**
127
+ * Fill the passed in sys stat structure with system stats.
128
+ *
129
+ * @param stats A pointer to the mbed_stats_sys_t structure to fill
130
+ */
131
+ void mbed_stats_sys_get (mbed_stats_sys_t * stats );
132
+
108
133
#ifdef __cplusplus
109
134
}
110
135
#endif
You can’t perform that action at this time.
0 commit comments