Skip to content

Commit 9bdf6d7

Browse files
author
Amanda Butler
authored
Merge pull request #508 from deepikabhavnani/thread_api
Update Statistics document - Thread/System/CPU API addition
2 parents e83191f + 2324689 commit 9bdf6d7

File tree

2 files changed

+46
-14
lines changed

2 files changed

+46
-14
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
## Mbed statistics
2+
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.
4+
5+
### Memory statistics
6+
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:
8+
9+
- `MBED_HEAP_STATS_ENABLED`.
10+
- `MBED_STACK_STATS_ENABLED`.
11+
12+
### Thread statistics
13+
14+
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.
15+
16+
### System information
17+
18+
You can use the `mbed_stats_sys_get` function to get the CPU ID and compiler information. You must build Mbed OS with the `MBED_SYS_STATS_ENABLED` macro to enable fetching of system information.
19+
20+
### CPU statistics
21+
22+
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.
23+
24+
### Mbed statistics functions reference
25+
26+
[![View code](https://www.mbed.com/embed/?type=library)](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/mbed__stats_8h_source.html)
27+
28+
### Memory statistics example
29+
30+
[![View code](https://www.mbed.com/embed/?url=https://os.mbed.com/teams/mbed_example/code/mbed-os-example-platform-utils/)](https://os.mbed.com/teams/mbed_example/code/mbed-os-example-platform-utils/file/92b97ba04fd3/main.cpp)
31+
32+
### Thread statistics example
33+
34+
[![View code](https://www.mbed.com/embed/?url=https://os.mbed.com/teams/mbed_example/code/thread_statistics/)](https://os.mbed.com/teams/mbed_example/code/thread_statistics/file/8cfc3eff0d78/main.cpp/)
35+
36+
### System information example
37+
38+
[![View code](https://www.mbed.com/embed/?url=https://os.mbed.com/teams/mbed_example/code/system_information/)](https://os.mbed.com/teams/mbed_example/code/system_information/file/8189a62cbb4e/main.cpp/)
39+
40+
### CPU statistics example
41+
42+
[![View code](https://www.mbed.com/embed/?url=https://os.mbed.com/teams/mbed_example/code/cpu_stats/)](https://os.mbed.com/teams/mbed_example/code/cpu_stats/file/de30f5166672/main.cpp/)
43+
44+
### CPU usage example
45+
46+
[![View code](https://www.mbed.com/embed/?url=https://os.mbed.com/teams/mbed_example/code/cpu_usage_calculation/)](https://os.mbed.com/teams/mbed_example/code/cpu_usage_calculation/file/358f7cf7196d/main.cpp/)

docs/reference/api/platform/MemoryStats.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)