Skip to content

Commit b34148e

Browse files
author
Amanda Butler
authored
Merge pull request #837 from ARMmbed/kegilbert-patch-1
Move stats API docs to config format
2 parents f6e8840 + fb2e031 commit b34148e

File tree

1 file changed

+57
-7
lines changed

1 file changed

+57
-7
lines changed

docs/api/platform/MbedStats.md

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,77 @@
11
## Mbed statistics
22

3-
Mbed OS provides a set of functions that you can use to capture the memory and thread statistics at runtime. `mbed_stats.h` declares these functions. To enable all Mbed OS statistics, you must build code with the `MBED_ALL_STATS_ENABLED` macro.
3+
Mbed OS provides a set of functions that you can use to capture the memory and thread statistics at runtime. `mbed_stats.h` declares these functions. To enable all Mbed OS platform statistics, you must enable the following Mbed OS configuration option:
4+
5+
```json
6+
{
7+
"target_overrides": {
8+
"*": {
9+
"platform.all-stats-enabled": true
10+
}
11+
}
12+
}
13+
```
14+
15+
<span class="tips">**Tip:** See the documentation of the [Arm Mbed configuration system](../reference/configuration.html) for more details about `mbed_app.json`. </span>
416

517
### Memory statistics
618

7-
You can use memory statistics functions to capture heap usage, cumulative stack usage or stack usage per thread at runtime. To enable memory usage monitoring, you must build Mbed OS with the following macros:
19+
You can use memory statistics functions to capture heap use, cumulative stack use or stack use for each thread at runtime. To enable memory use monitoring, you must enable the following Mbed OS configuration options:
820

9-
- `MBED_HEAP_STATS_ENABLED`.
10-
- `MBED_STACK_STATS_ENABLED`.
21+
```json
22+
{
23+
"target_overrides": {
24+
"*": {
25+
"platform.heap-stats-enabled": true,
26+
"platform.stack-stats-enabled": true
27+
}
28+
}
29+
}
30+
```
1131

1232
<span class="notes">**Note:** Each `malloc` or `calloc` memory allocation call adds an overhead of 8 bytes when heap memory statistics are enabled.</span>
1333

1434
### Thread statistics
1535

16-
You can use the thread statistics function `mbed_stats_thread_get_each` to capture the thread ID, state, priority, name and stack information for all active threads at runtime. To enable thread monitoring, you must build Mbed OS with the `MBED_THREAD_STATS_ENABLED` macro.
36+
You can use the thread statistics function `mbed_stats_thread_get_each` to capture the thread ID, state, priority, name and stack information for all active threads at runtime. To enable thread monitoring, you must enable the following Mbed OS configuration options:
37+
38+
```json
39+
{
40+
"target_overrides": {
41+
"*": {
42+
"platform.thread-stats-enabled": true
43+
}
44+
}
45+
}
46+
```
1747

1848
### System information
1949

20-
You can use the `mbed_stats_sys_get` function to get the CPU ID, compiler information and RAM and ROM memories on the target device. You must build Mbed OS with the `MBED_SYS_STATS_ENABLED` macro to enable fetching of system information.
50+
You can use the `mbed_stats_sys_get` function to get the CPU ID, compiler information and RAM and ROM memories on the target device. To enable system information fetching, you must enable the following Mbed OS configuration option:
51+
52+
```json
53+
{
54+
"target_overrides": {
55+
"*": {
56+
"platform.sys-stats-enabled": true
57+
}
58+
}
59+
}
60+
```
2161

2262
### CPU statistics
2363

24-
You can use the `mbed_stats_cpu_get` function to get the uptime, idle time and sleep time information. Timing information available is cumulative since the system is on. You must build Mbed OS with the `MBED_CPU_STATS_ENABLED` macro to enable fetching of CPU information. Please note CPU statistics depend on the availability of the low power timer in the hardware.
64+
You can use the `mbed_stats_cpu_get` function to get the uptime, idle time and sleep time information. Timing information available is cumulative because the system is on. Please note CPU statistics depend on the availability of the low power timer in the hardware. To enable fetching of CPU information, you must enable the following Mbed OS configuration option:
65+
66+
```json
67+
{
68+
"target_overrides": {
69+
"*": {
70+
"platform.cpu-stats-enabled": true
71+
}
72+
}
73+
}
74+
```
2575

2676
### Mbed statistics function reference
2777

0 commit comments

Comments
 (0)