mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Add dependency info for accessing memstats from API (#2979)
The documentation of `jerry_get_memory_stats` method was missing the requirements on what build option or feature is required. JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
This commit is contained in:
parent
ec11a7b4e9
commit
f53dba1a3a
@ -8,8 +8,8 @@ Enum that contains the following elements:
|
|||||||
- JERRY_INIT_SHOW_OPCODES - dump byte-code to log after parse
|
- JERRY_INIT_SHOW_OPCODES - dump byte-code to log after parse
|
||||||
- JERRY_INIT_SHOW_REGEXP_OPCODES - dump regexp byte-code to log after compilation
|
- JERRY_INIT_SHOW_REGEXP_OPCODES - dump regexp byte-code to log after compilation
|
||||||
- JERRY_INIT_MEM_STATS - dump memory statistics
|
- JERRY_INIT_MEM_STATS - dump memory statistics
|
||||||
- JERRY_INIT_MEM_STATS_SEPARATE - dump memory statistics and reset peak values after parse
|
- JERRY_INIT_MEM_STATS_SEPARATE - **deprecated**, dump memory statistics and reset peak values after parse
|
||||||
- JERRY_INIT_DEBUGGER - deprecated, an unused placeholder now
|
- JERRY_INIT_DEBUGGER - **deprecated**, an unused placeholder now
|
||||||
|
|
||||||
## jerry_type_t
|
## jerry_type_t
|
||||||
|
|
||||||
@ -790,6 +790,14 @@ main (void)
|
|||||||
|
|
||||||
Get heap memory stats.
|
Get heap memory stats.
|
||||||
|
|
||||||
|
**Notes**:
|
||||||
|
- The engine must be initialized with the `JERRY_INIT_MEM_STATS` option to allow
|
||||||
|
heap statistic collections. See [jerry_init](#jerry_init)
|
||||||
|
- This API depends on a build option (`JERRY_MEM_STATS`) and can be checked
|
||||||
|
in runtime with the `JERRY_FEATURE_MEM_STATS` feature enum value,
|
||||||
|
see: [jerry_is_feature_enabled](#jerry_is_feature_enabled).
|
||||||
|
|
||||||
|
|
||||||
**Prototype**
|
**Prototype**
|
||||||
|
|
||||||
```c
|
```c
|
||||||
@ -799,12 +807,15 @@ jerry_get_memory_stats (jerry_heap_stats_t *out_stats_p);
|
|||||||
|
|
||||||
- `out_stats_p` - out parameter, that provides the heap statistics.
|
- `out_stats_p` - out parameter, that provides the heap statistics.
|
||||||
- return value
|
- return value
|
||||||
- true, if run was successful
|
- true, if stats were written into the `out_stats_p` pointer.
|
||||||
- false, otherwise. Usually it is because the MEM_STATS feature is not enabled.
|
- false, otherwise. Usually it is because the `JERRY_FEATURE_MEM_STATS` feature is not enabled.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
```c
|
```c
|
||||||
|
jerry_init (JERRY_INIT_MEM_STATS);
|
||||||
|
// ...
|
||||||
|
|
||||||
jerry_heap_stats_t stats = {0};
|
jerry_heap_stats_t stats = {0};
|
||||||
bool get_stats_ret = jerry_get_memory_stats (&stats);
|
bool get_stats_ret = jerry_get_memory_stats (&stats);
|
||||||
```
|
```
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user