mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-03 14:09:31 +03:00
fix mi_stat_get_json signature
This commit is contained in:
parent
b319156c4f
commit
c910750bbe
3 changed files with 5 additions and 5 deletions
|
@ -92,8 +92,8 @@ typedef struct mi_stats_s
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mi_decl_export void mi_stats_get( size_t stats_size, mi_stats_t* stats ) mi_attr_noexcept;
|
mi_decl_export void mi_stats_get( size_t stats_size, mi_stats_t* stats ) mi_attr_noexcept;
|
||||||
mi_decl_export const 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 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
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -539,7 +539,7 @@ static void mi_heap_buf_print_counter_value(mi_heap_buf_t* hbuf, const char* nam
|
||||||
#define MI_STAT_COUNT(stat) mi_heap_buf_print_count_value(&hbuf, #stat, &stats->stat);
|
#define MI_STAT_COUNT(stat) mi_heap_buf_print_count_value(&hbuf, #stat, &stats->stat);
|
||||||
#define MI_STAT_COUNTER(stat) mi_heap_buf_print_counter_value(&hbuf, #stat, &stats->stat);
|
#define MI_STAT_COUNTER(stat) mi_heap_buf_print_counter_value(&hbuf, #stat, &stats->stat);
|
||||||
|
|
||||||
const char* mi_stats_get_json(size_t output_size, char* output_buf) mi_attr_noexcept {
|
char* mi_stats_get_json(size_t output_size, char* output_buf) mi_attr_noexcept {
|
||||||
mi_heap_buf_t hbuf = { NULL, 0, 0, true };
|
mi_heap_buf_t hbuf = { NULL, 0, 0, true };
|
||||||
if (output_size > 0 && output_buf != NULL) {
|
if (output_size > 0 && output_buf != NULL) {
|
||||||
_mi_memzero(output_buf, output_size);
|
_mi_memzero(output_buf, output_size);
|
||||||
|
|
|
@ -331,9 +331,9 @@ int main(int argc, char** argv) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
mi_debug_show_arenas();
|
mi_debug_show_arenas();
|
||||||
mi_collect(true);
|
mi_collect(true);
|
||||||
const char* json = mi_stats_get_json(0, NULL);
|
char* json = mi_stats_get_json(0, NULL);
|
||||||
if (json != NULL) {
|
if (json != NULL) {
|
||||||
puts(json);
|
fputs(json,stderr);
|
||||||
mi_free(json);
|
mi_free(json);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue