Print out allocation statistics. More...
Data Structures | |
| struct | mi_stats_t |
| Statistics. See include/mimalloc-stats.h for the full definition. More... | |
Macros | |
| #define | MI_STAT_VERSION |
| Statistics version. Increased on each backward incompatible change. | |
| #define | mi_stats_t_decl(name) |
| Helper to declare a properly initialized mi_stats_t() local variable as name where the size and version fields are properly initialized. | |
Functions | |
| void | mi_stats_header_init (mi_stats_t *stats) |
| Initialize only the size and version fields of stats, leaving counters unchanged. | |
| void | mi_stats_init (mi_stats_t *stats) |
| Zero all counters and initialize the size and version fields of stats. | |
| void | mi_process_info_print (void) |
| Print out all process info. | |
| void | mi_process_info_print_out (mi_output_fun *out, void *arg) |
| Print out all process info. | |
| void | mi_process_info (size_t *elapsed_msecs, size_t *user_msecs, size_t *system_msecs, size_t *current_rss, size_t *peak_rss, size_t *current_commit, size_t *peak_commit, size_t *page_faults) |
| Return process information (time and memory usage). | |
| void | mi_stats_print (void *out) |
| void | mi_stats_print_out (mi_output_fun *out, void *arg) |
| Print statistics of the current subprocess aggregated over all its heaps. | |
| void | mi_thread_stats_print_out (mi_output_fun *out, void *arg) |
| bool | mi_stats_get (mi_stats_t *stats) |
| Get the statistics for the current subprocess aggregated over all its heaps. | |
| char * | mi_stats_get_json (size_t buf_size, char *buf) |
| Get the statistics for the current subprocess aggregated over all its heaps as JSON. | |
| size_t | mi_stats_get_bin_size (size_t bin) |
| v3: Return the block size for the given bin. | |
| bool | mi_heap_stats_get (mi_heap_t *heap, mi_stats_t *stats) |
| v3: Return statistics for a given heap. | |
| char * | mi_heap_stats_get_json (mi_heap_t *heap, size_t buf_size, char *buf) |
| v3: Get the statistics for a heap as JSON. | |
| void | mi_heap_stats_print_out (mi_heap_t *heap, mi_output_fun *out, void *arg) |
| v3: Show the heap statistics as JSON. | |
| void | mi_heap_stats_merge_to_subproc (mi_heap_t *heap) |
| v3: xplicitly merge the statistics of the current heap with the subprocess. | |
| bool | mi_subproc_stats_get (mi_subproc_id_t subproc_id, mi_stats_t *stats) |
| v3: Get statistics for a given subprocess aggregated over all its heaps. | |
| bool | mi_subproc_stats_get_exclusive (mi_subproc_id_t subproc_id, mi_stats_t *stats) |
| v3: Get subprocess statistics without aggregating its heaps. | |
| bool | mi_theap_stats_get (mi_theap_t *theap, mi_stats_t *stats) |
| v3: Get statistics for a theap belonging to the calling thread. | |
| void | mi_theap_stats_merge_to_heap (mi_theap_t *theap) |
| v3: Merge a theap's statistics into its parent heap and clear the theap counters. | |
| char * | mi_subproc_stats_get_json (mi_subproc_id_t subproc_id, size_t buf_size, char *buf) |
| v3: Show the subproc statistics aggregated over all its heaps as JSON. | |
| void | mi_subproc_stats_print_out (mi_subproc_id_t subproc_id, mi_output_fun *out, void *arg) |
| v3: Print the subproc statistics aggregated over all its heaps. | |
| void | mi_subproc_heap_stats_print_out (mi_subproc_id_t subproc_id, mi_output_fun *out, void *arg) |
| v3: Print statistics for a given subprocess with each heap separately printed. | |
| char * | mi_stats_as_json (mi_stats_t *stats, size_t buf_size, char *buf) |
| v3: Show the given statistics as JSON. | |
| void | mi_stats_reset (void) |
| v1,v2: Reset statistics. | |
| void | mi_stats_merge (void) |
| v1,v2: Merge thread local statistics with the main statistics and reset. | |
Print out allocation statistics.
| struct mi_stats_s |
Statistics. See include/mimalloc-stats.h for the full definition.
| #define MI_STAT_VERSION |
Statistics version. Increased on each backward incompatible change.
| #define mi_stats_t_decl | ( | name | ) |
Helper to declare a properly initialized mi_stats_t() local variable as name where the size and version fields are properly initialized.
For example:
| bool mi_heap_stats_get | ( | mi_heap_t * | heap, |
| mi_stats_t * | stats ) |
v3: Return statistics for a given heap.
| heap | The heap. |
| stats | Pointer to a mi_stats_t() structure (declared as mi_stats_t_decl(name)). |
| char * mi_heap_stats_get_json | ( | mi_heap_t * | heap, |
| size_t | buf_size, | ||
| char * | buf ) |
v3: Get the statistics for a heap as JSON.
| heap | The heap. |
| buf_size | Byte size of the buffer buf (or 0 if buf is NULL). |
| buf | The buffer. Pass NULL to allocate a fresh buffer. |
| void mi_heap_stats_merge_to_subproc | ( | mi_heap_t * | heap | ) |
v3: xplicitly merge the statistics of the current heap with the subprocess.
| heap | The heap. After this call, the heap statistics are reset. |
| void mi_heap_stats_print_out | ( | mi_heap_t * | heap, |
| mi_output_fun * | out, | ||
| void * | arg ) |
v3: Show the heap statistics as JSON.
| heap | The heap. |
| out | An output function or NULL for the default. |
| arg | Optional argument passed to out (if not NULL) |
| void mi_process_info | ( | size_t * | elapsed_msecs, |
| size_t * | user_msecs, | ||
| size_t * | system_msecs, | ||
| size_t * | current_rss, | ||
| size_t * | peak_rss, | ||
| size_t * | current_commit, | ||
| size_t * | peak_commit, | ||
| size_t * | page_faults ) |
Return process information (time and memory usage).
| elapsed_msecs | Optional. Elapsed wall-clock time of the process in milli-seconds. |
| user_msecs | Optional. User time in milli-seconds (as the sum over all threads). |
| system_msecs | Optional. System time in milli-seconds. |
| current_rss | Optional. Current resident set size (working set). |
| peak_rss | Optional. Peak resident set size (working set). |
| current_commit | Optional. Current memory charged to the process (footprint). |
| peak_commit | Optional. Peak memory charged to the process (footprint). |
| page_faults | Optional. Count of hard page faults. |
The resident set size (rss) is the memory that is currently in physical memory, including shared pages and pages that are freed but not yet reclaimed by the OS. The commit is the memory charged to the process (its footprint), including private memory that is swapped out or compressed. The current_rss is precise on Windows, macOS, and Linux; other systems estimate this using current_commit. The commit is precise on Windows (the commit charge) and macOS (the physical footprint), but estimated on other systems as the amount of read/write accessible memory reserved by mimalloc.
| void mi_process_info_print | ( | void | ) |
Print out all process info.
| void mi_process_info_print_out | ( | mi_output_fun * | out, |
| void * | arg ) |
Print out all process info.
| out | An output function or NULL for the default. |
| arg | Optional argument passed to out (if not NULL) |
| char * mi_stats_as_json | ( | mi_stats_t * | stats, |
| size_t | buf_size, | ||
| char * | buf ) |
v3: Show the given statistics as JSON.
| stats | The statistics. |
| buf_size | Byte size of the buffer buf (or 0 if buf is NULL). |
| buf | The buffer. Pass NULL to allocate a fresh buffer. |
| bool mi_stats_get | ( | mi_stats_t * | stats | ) |
Get the statistics for the current subprocess aggregated over all its heaps.
| stats | Pointer to a mi_stats_t() structure (declared as mi_stats_t_decl(name)). |
| size_t mi_stats_get_bin_size | ( | size_t | bin | ) |
v3: Return the block size for the given bin.
| char * mi_stats_get_json | ( | size_t | buf_size, |
| char * | buf ) |
Get the statistics for the current subprocess aggregated over all its heaps as JSON.
| buf_size | Byte size of the buffer buf (or 0 if buf is NULL) |
| buf | The buffer. Pass NULL to allocate a fresh buffer. |
| void mi_stats_header_init | ( | mi_stats_t * | stats | ) |
Initialize only the size and version fields of stats, leaving counters unchanged.
| void mi_stats_init | ( | mi_stats_t * | stats | ) |
Zero all counters and initialize the size and version fields of stats.
| void mi_stats_merge | ( | void | ) |
v1,v2: Merge thread local statistics with the main statistics and reset.
| void mi_stats_print | ( | void * | out | ) |
| out | Ignored, outputs to the registered output function or stderr by default. |
Most detailed when using a debug build.
| void mi_stats_print_out | ( | mi_output_fun * | out, |
| void * | arg ) |
Print statistics of the current subprocess aggregated over all its heaps.
| out | An output function or NULL for the default. |
| arg | Optional argument passed to out (if not NULL) |
Most detailed when using a debug build.
| void mi_stats_reset | ( | void | ) |
v1,v2: Reset statistics.
| void mi_subproc_heap_stats_print_out | ( | mi_subproc_id_t | subproc_id, |
| mi_output_fun * | out, | ||
| void * | arg ) |
v3: Print statistics for a given subprocess with each heap separately printed.
| subproc_id | The subprocess |
| out | An output function or NULL for the default. |
| arg | Optional argument passed to out (if not NULL) |
| bool mi_subproc_stats_get | ( | mi_subproc_id_t | subproc_id, |
| mi_stats_t * | stats ) |
v3: Get statistics for a given subprocess aggregated over all its heaps.
| subproc_id | The subprocess |
| stats | Pointer to a mi_stats_t() structure (declared as mi_stats_t_decl(name)). |
| bool mi_subproc_stats_get_exclusive | ( | mi_subproc_id_t | subproc_id, |
| mi_stats_t * | stats ) |
v3: Get subprocess statistics without aggregating its heaps.
Initialize stats with mi_stats_init() or mi_stats_t_decl() first.
| char * mi_subproc_stats_get_json | ( | mi_subproc_id_t | subproc_id, |
| size_t | buf_size, | ||
| char * | buf ) |
v3: Show the subproc statistics aggregated over all its heaps as JSON.
| subproc_id | The subprocess. |
| buf_size | Byte size of the buffer buf (or 0 if buf is NULL). |
| buf | The buffer. Pass NULL to allocate a fresh buffer. |
| void mi_subproc_stats_print_out | ( | mi_subproc_id_t | subproc_id, |
| mi_output_fun * | out, | ||
| void * | arg ) |
v3: Print the subproc statistics aggregated over all its heaps.
| subproc_id | The subprocess. |
| out | An output function or NULL for the default. |
| arg | Optional argument passed to out (if not NULL) |
| bool mi_theap_stats_get | ( | mi_theap_t * | theap, |
| mi_stats_t * | stats ) |
v3: Get statistics for a theap belonging to the calling thread.
Initialize stats with mi_stats_init() or mi_stats_t_decl() first.
| void mi_theap_stats_merge_to_heap | ( | mi_theap_t * | theap | ) |
v3: Merge a theap's statistics into its parent heap and clear the theap counters.
The theap must belong to the calling thread.
| void mi_thread_stats_print_out | ( | mi_output_fun * | out, |
| void * | arg ) |