mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-05-29 16:17:44 +03:00
Add mallctl to set and get ncached_max of each cache_bin.
1. `thread_tcache_ncached_max_read_sizeclass` allows users to get the
ncached_max of the bin with the input sizeclass, passed in through
oldp (will be upper casted if not an exact bin size is given).
2. `thread_tcache_ncached_max_write` takes in a char array
representing the settings for bins in the tcache.
This commit is contained in:
parent
6b197fdd46
commit
630f7de952
14 changed files with 477 additions and 70 deletions
49
src/util.c
Normal file
49
src/util.c
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#include "jemalloc/internal/jemalloc_preamble.h"
|
||||
#include "jemalloc/internal/jemalloc_internal_includes.h"
|
||||
|
||||
#include "jemalloc/internal/util.h"
|
||||
|
||||
/* Reads the next size pair in a multi-sized option. */
|
||||
bool
|
||||
multi_setting_parse_next(const char **setting_segment_cur, size_t *len_left,
|
||||
size_t *key_start, size_t *key_end, size_t *value) {
|
||||
const char *cur = *setting_segment_cur;
|
||||
char *end;
|
||||
uintmax_t um;
|
||||
|
||||
set_errno(0);
|
||||
|
||||
/* First number, then '-' */
|
||||
um = malloc_strtoumax(cur, &end, 0);
|
||||
if (get_errno() != 0 || *end != '-') {
|
||||
return true;
|
||||
}
|
||||
*key_start = (size_t)um;
|
||||
cur = end + 1;
|
||||
|
||||
/* Second number, then ':' */
|
||||
um = malloc_strtoumax(cur, &end, 0);
|
||||
if (get_errno() != 0 || *end != ':') {
|
||||
return true;
|
||||
}
|
||||
*key_end = (size_t)um;
|
||||
cur = end + 1;
|
||||
|
||||
/* Last number */
|
||||
um = malloc_strtoumax(cur, &end, 0);
|
||||
if (get_errno() != 0) {
|
||||
return true;
|
||||
}
|
||||
*value = (size_t)um;
|
||||
|
||||
/* Consume the separator if there is one. */
|
||||
if (*end == '|') {
|
||||
end++;
|
||||
}
|
||||
|
||||
*len_left -= end - *setting_segment_cur;
|
||||
*setting_segment_cur = end;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue