mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-05 15:09:31 +03:00
add numa nodes to stats
This commit is contained in:
parent
723fbba259
commit
e320488791
3 changed files with 7 additions and 4 deletions
|
@ -57,7 +57,7 @@ void* _mi_os_alloc(size_t size, mi_stats_t* stats); // to allocat
|
||||||
void _mi_os_free(void* p, size_t size, mi_stats_t* stats); // to free thread local data
|
void _mi_os_free(void* p, size_t size, mi_stats_t* stats); // to free thread local data
|
||||||
size_t _mi_os_good_alloc_size(size_t size);
|
size_t _mi_os_good_alloc_size(size_t size);
|
||||||
int _mi_os_numa_node(mi_os_tld_t* tld);
|
int _mi_os_numa_node(mi_os_tld_t* tld);
|
||||||
|
int _mi_os_numa_node_count(void);
|
||||||
|
|
||||||
// memory.c
|
// memory.c
|
||||||
void* _mi_mem_alloc_aligned(size_t size, size_t alignment, bool* commit, bool* large, bool* is_zero, size_t* id, mi_os_tld_t* tld);
|
void* _mi_mem_alloc_aligned(size_t size, size_t alignment, bool* commit, bool* large, bool* is_zero, size_t* id, mi_os_tld_t* tld);
|
||||||
|
|
5
src/os.c
5
src/os.c
|
@ -840,7 +840,8 @@ static void* mi_os_alloc_huge_os_pagesx(void* addr, size_t size, int numa_node)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
_mi_warning_message("failed to allocate huge OS pages (size %zu) (error %d)\n", size, GetLastError());
|
DWORD winerr = GetLastError();
|
||||||
|
_mi_warning_message("failed to allocate huge OS pages (size %zu) (windows error %d%s)\n", size, winerr, (winerr==1450 ? " (insufficient resources)" : ""));
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -982,11 +983,13 @@ int _mi_os_numa_node_count(void) {
|
||||||
static int numa_node_count = 0; // cache the node count
|
static int numa_node_count = 0; // cache the node count
|
||||||
if (mi_unlikely(numa_node_count <= 0)) {
|
if (mi_unlikely(numa_node_count <= 0)) {
|
||||||
int ncount = mi_os_numa_node_countx();
|
int ncount = mi_os_numa_node_countx();
|
||||||
|
int ncount0 = ncount;
|
||||||
// never more than max numa node and at least 1
|
// never more than max numa node and at least 1
|
||||||
int nmax = 1 + (int)mi_option_get(mi_option_max_numa_node);
|
int nmax = 1 + (int)mi_option_get(mi_option_max_numa_node);
|
||||||
if (ncount > nmax) ncount = nmax;
|
if (ncount > nmax) ncount = nmax;
|
||||||
if (ncount <= 0) ncount = 1;
|
if (ncount <= 0) ncount = 1;
|
||||||
numa_node_count = ncount;
|
numa_node_count = ncount;
|
||||||
|
_mi_verbose_message("using %i numa regions (%i nodes detected)\n", numa_node_count, ncount0);
|
||||||
}
|
}
|
||||||
mi_assert_internal(numa_node_count >= 1);
|
mi_assert_internal(numa_node_count >= 1);
|
||||||
return numa_node_count;
|
return numa_node_count;
|
||||||
|
|
|
@ -265,7 +265,7 @@ static void _mi_stats_print(mi_stats_t* stats, double secs, mi_output_fun* out)
|
||||||
mi_stat_counter_print(&stats->commit_calls, "commits", out);
|
mi_stat_counter_print(&stats->commit_calls, "commits", out);
|
||||||
mi_stat_print(&stats->threads, "threads", -1, out);
|
mi_stat_print(&stats->threads, "threads", -1, out);
|
||||||
mi_stat_counter_print_avg(&stats->searches, "searches", out);
|
mi_stat_counter_print_avg(&stats->searches, "searches", out);
|
||||||
|
_mi_fprintf(out, "%10s: %7i\n", "numa nodes", _mi_os_numa_node_count());
|
||||||
if (secs >= 0.0) _mi_fprintf(out, "%10s: %9.3f s\n", "elapsed", secs);
|
if (secs >= 0.0) _mi_fprintf(out, "%10s: %9.3f s\n", "elapsed", secs);
|
||||||
|
|
||||||
double user_time;
|
double user_time;
|
||||||
|
|
Loading…
Add table
Reference in a new issue