Skip to content

Add overhead info for memory trace / stats #694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 31, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/reference/api/platform/MbedStats.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ You can use memory statistics functions to capture heap usage, cumulative stack
- `MBED_HEAP_STATS_ENABLED`.
- `MBED_STACK_STATS_ENABLED`.

@Note: Overhead of 8 bytes is added with each memory allocation call `malloc` or `calloc` when heap memory statistics are enabled.

### Thread statistics

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.
Expand Down
2 changes: 2 additions & 0 deletions docs/reference/api/platform/MemTrace.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ You must enable the `memory-tracing-enabled` setting in the Mbed OS platform con

You can use the `mbed_mem_trace_set_callback` API to set the callback for memory tracing. The callback is invoked every time you call standard allocation functions, such as `malloc`, `realloc`, `calloc` and `free`.

@Note: Overhead of 8 bytes is added with each memory allocation call `malloc` or `calloc` when memory tracing is enabled.

For a step-by-step guide about how to use optimize memory using runtime memory tracing, please see our [runtime memory tracing tutorial](/docs/development/tutorials/optimizing.html#runtime-memory-tracing).

### Memory tracing functions reference
Expand Down
1 change: 1 addition & 0 deletions docs/tutorials/optimize/memory/runtime_mem_trace.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ It outputs the following trace:

- The tracer doesn't handle nested calls of the memory functions. For example, if you call `realloc` and the implementation of `realloc` calls `malloc` internally, the call to `malloc` is not traced.
- The **caller** argument of the callback function isn't always reliable. It doesn't work at all on some toolchains, and it might output erroneous data on others.
- Overhead of 8 bytes is added to every dynamic memory allocation when memory tracing is enabled.