diff options
author | Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> | 2022-07-11 20:40:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-11 20:40:26 +0300 |
commit | 87e9700b2fb93731154eb59cbb53c69e55fbcc6b (patch) | |
tree | 50752e1a96f9c3d982834bf1212f16ecba5f9768 /libnetdata/libnetdata.c | |
parent | 0c954d2257fe3f87cb928fbc35841d07ce3a3fea (diff) |
Detect stored metric size by page type (#13334)
* Report unknown page only once
Get metric storage size by the page type
Verify validity of the page and skip problematic ones
* Change PAGE_SIZE to PAGE_POINT_SIZE_BYTES
* Add bitmap256 and unittests
* Fix unit test
tier_page_type array
page_type_size arrays
* Add another counter to not rely on uint8_t overflow to stop the test loop
Diffstat (limited to 'libnetdata/libnetdata.c')
-rw-r--r-- | libnetdata/libnetdata.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libnetdata/libnetdata.c b/libnetdata/libnetdata.c index 2997ce19e4..212eceb824 100644 --- a/libnetdata/libnetdata.c +++ b/libnetdata/libnetdata.c @@ -1534,3 +1534,19 @@ char *find_and_replace(const char *src, const char *find, const char *replace, c return value; } + + +bool bitmap256_get_bit(BITMAP256 *ptr, uint8_t idx) { + if (unlikely(!ptr)) + return false; + return (ptr->data[idx / 64] & (1 << (idx % 64))); +} + +void bitmap256_set_bit(BITMAP256 *ptr, uint8_t idx, bool value) { + if (unlikely(!ptr)) + return; + if (likely(value)) + ptr->data[idx / 64] |= (1U << (idx % 64)); + else + ptr->data[idx / 64] &= ~(1U << (idx % 64)); +} |