Skip to main content

Name

ec_mem_get_stats — Return usage statistics for all memtypes

Synopsis

#include "ec_malloc.h"

| int **ec_mem_get_stats** ( | sysstats, |   | |   | usage_by_type, |   | |   | nelems); |   |

struct ec_mem_stats * <var class="pdparam">sysstats</var>; struct ec_mem_type_usage * <var class="pdparam">usage_by_type</var>; unsigned int <var class="pdparam">nelems</var>;

Description

**Configuration Change. ** This feature is available starting from Momentum 3.0.18.

Return usage statistics for all memtypes. For more information about memory types see Memory Types. It fills out the ec_mem_stats structures with a snapshot of the memory utilization.

It is possible, even likely, that the individual numbers are not 100% consistent with each other, as the allocator layer deliberately avoids a global lock across memory types. Since allocations are being made asynchronously, it is possible that the numbers will change before this routine completes.

The caller is responsible for providing a big enough array of ec_mem_type_usage structures. If the provided array is too small, this function will stop short of overflowing it, and will return the number of registered memtypes. The constant MEMTYPE_MAX defines the maximum number of memtypes supported by the allocator; it is easiest to declare a stack variable with MEMTYPE_MAX elements and pass that to this function.

Parameters

sysstats

A buffer to hold system level information. For a description of this data type see “ec_mem_stats”.

usage_by_type

An array to hold per-memtype information.

nelems

The number of elements that can be written to in usage_by_type.

Return Value

This function returns the number of defined memtypes.

Threading

It is legal to call this function in any thread.

See Also

Was this page helpful?