Buckets:
| /* ---------------------------------------------------------------------------- | |
| Copyright (c) 2024-2025, Microsoft Research, Daan Leijen | |
| This is free software; you can redistribute it and/or modify it under the | |
| terms of the MIT license. A copy of the license can be found in the file | |
| "LICENSE" at the root of this distribution. | |
| -----------------------------------------------------------------------------*/ | |
| // alignment for atomic fields | |
| // count allocation over time | |
| typedef struct mi_stat_count_s { | |
| int64_t total; // total allocated | |
| int64_t peak; // peak allocation | |
| int64_t current; // current allocation | |
| } mi_stat_count_t; | |
| // counters only increase | |
| typedef struct mi_stat_counter_s { | |
| int64_t total; // total count | |
| } mi_stat_counter_t; | |
| // Size bins for chunks | |
| typedef enum mi_chunkbin_e { | |
| MI_CBIN_SMALL, // slice_count == 1 | |
| MI_CBIN_OTHER, // slice_count: any other from the other bins, and 1 <= slice_count <= MI_BCHUNK_BITS | |
| MI_CBIN_MEDIUM, // slice_count == 8 | |
| MI_CBIN_LARGE, // slice_count == MI_SIZE_BITS (only used if MI_ENABLE_LARGE_PAGES is 1) | |
| MI_CBIN_HUGE, // slice_count > MI_BCHUNK_BITS | |
| MI_CBIN_NONE, // no bin assigned yet (the chunk is completely free) | |
| MI_CBIN_COUNT | |
| } mi_chunkbin_t; | |
| // Define the statistics structure | |
| typedef struct mi_stats_s | |
| { | |
| size_t size; // size of the mi_stats_t structure | |
| size_t version; | |
| mi_decl_align(8) MI_STAT_FIELDS() | |
| // future extension | |
| mi_stat_count_t _stat_reserved[4]; | |
| mi_stat_counter_t _stat_counter_reserved[4]; | |
| // size segregated statistics | |
| mi_stat_count_t malloc_bins[MI_BIN_HUGE+1]; // allocation per size bin | |
| mi_stat_count_t page_bins[MI_BIN_HUGE+1]; // pages allocated per size bin | |
| mi_stat_count_t chunk_bins[MI_CBIN_COUNT]; // chunks per page sizes | |
| } mi_stats_t; | |
| // helper | |
| // Exported definitions | |
| extern "C" { | |
| // stats from a heap | |
| mi_decl_export bool mi_heap_stats_get(mi_heap_t* heap, mi_stats_t* stats) mi_attr_noexcept; | |
| mi_decl_export char* mi_heap_stats_get_json(mi_heap_t* heap, size_t buf_size, char* buf) mi_attr_noexcept; // use mi_free to free the result if the input buf == NULL | |
| mi_decl_export void mi_heap_stats_print_out(mi_heap_t* heap, mi_output_fun* out, void* arg) mi_attr_noexcept; | |
| // stats from a subprocess and its heaps aggregated | |
| mi_decl_export bool mi_subproc_stats_get(mi_subproc_id_t subproc_id, mi_stats_t* stats) mi_attr_noexcept; | |
| mi_decl_export char* mi_subproc_stats_get_json(mi_subproc_id_t subproc_id, size_t buf_size, char* buf) mi_attr_noexcept; // use mi_free to free the result if the input buf == NULL | |
| mi_decl_export void mi_subproc_stats_print_out(mi_subproc_id_t subproc_id, mi_output_fun* out, void* arg) mi_attr_noexcept; | |
| // print subprocess and all its heap stats segregated | |
| mi_decl_export void mi_subproc_heap_stats_print_out(mi_subproc_id_t subproc_id, mi_output_fun* out, void* arg) mi_attr_noexcept; | |
| // stats aggregated for the current subprocess and all its heaps. | |
| mi_decl_export bool mi_stats_get(mi_stats_t* stats) mi_attr_noexcept; | |
| mi_decl_export char* mi_stats_get_json(size_t buf_size, char* buf) mi_attr_noexcept; // use mi_free to free the result if the input buf == NULL | |
| mi_decl_export void mi_stats_print_out(mi_output_fun* out, void* arg) mi_attr_noexcept; | |
| // add the stats of the heap to the subprocess and clear the heap stats | |
| mi_decl_export void mi_heap_stats_merge_to_subproc(mi_heap_t* heap); | |
| // stats from the subprocess without aggregating its heaps | |
| mi_decl_export bool mi_subproc_stats_get_exclusive(mi_subproc_id_t subproc_id, mi_stats_t* stats) mi_attr_noexcept; | |
| mi_decl_export char* mi_stats_as_json(mi_stats_t* stats, size_t buf_size, char* buf) mi_attr_noexcept; // use mi_free to free the result if the input buf == NULL | |
| mi_decl_export size_t mi_stats_get_bin_size(size_t bin) mi_attr_noexcept; | |
| } | |
Xet Storage Details
- Size:
- 7.3 kB
- Xet hash:
- 8e2b09ecd0d6d391d1b19c4a9992760055d3834e586b3462b5b56b04dc35fe65
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.