diff options
author | Costa Tsaousis <costa@netdata.cloud> | 2022-06-01 20:01:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-01 20:01:52 +0300 |
commit | 7784a16cc7af8260bb8877873a60d7dc6d2c9e73 (patch) | |
tree | 28964e18f97bfee01977240981fb53333f95bc7e /daemon | |
parent | c261a771cc0c93fe4e9fbb83e1be141406d314be (diff) |
Dictionary with JudyHS and double linked list (#13032)
* dictionary internals isolation
* more dictionary cleanups
* added unit test
* we should use DICT internally
* disable cups in cmake
* implement DICTIONARY with Judy arrays
* operational JUDY implementation
* JUDY cleanup
* JUDY summary added
* JudyHS implementation with double linked list
* test negative searches too
* optimize destruction
* optimize set to insert first without lookup
* updated stats
* code cleanup; better organization; updated info
* more code cleanup and commenting
* more cleanup, renames and comments
* fix rename
* more cleanups
* use Judy.h from system paths
* added foreach traversal; added flag to add item in front; isolated locks to their own functions; destruction returns the number of bytes freed
* more comments; flags are now 16-bit
* completed unittesting
* addressed comments and added reference counters maintainance
* added unittest in main; tested removal of items in front, back and middle
* added read/write walkthrough and foreach; allowed walkthrough and foreach in write mode to delete the current element (used by cups.plugin); referenced counters removed from the API
* DICTFE.name should be const too
* added API calls for exposing all statistics
* dictionary flags as enum and reference counters as atomic operations
* more comments; improved error handling at unit tests
* added functions to allow unsafe access while traversing the dictionary with locks in place
* check for libcups in cmake
* added delete callback; implemented statsd with this dictionary
* added missing dfe_done()
* added alternative implementation with AVL
* added documentation
* added comments and warning about AVL
* dictionary walktrhough on new code
* simplified foreach; updated docs
* updated docs
* AVL is much faster without hashes
* AVL should follow DBENGINE
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/analytics.c | 7 | ||||
-rw-r--r-- | daemon/main.c | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/daemon/analytics.c b/daemon/analytics.c index c290d01444..6c02561d0c 100644 --- a/daemon/analytics.c +++ b/daemon/analytics.c @@ -249,8 +249,9 @@ void analytics_exporters(void) buffer_free(bi); } -int collector_counter_callb(void *entry, void *data) -{ +int collector_counter_callb(const char *name, void *entry, void *data) { + (void)name; + struct array_printer *ap = (struct array_printer *)data; struct collector *col = (struct collector *)entry; @@ -296,7 +297,7 @@ void analytics_collectors(void) ap.c = 0; ap.both = bt; - dictionary_get_all(dict, collector_counter_callb, &ap); + dictionary_walkthrough_read(dict, collector_counter_callb, &ap); dictionary_destroy(dict); analytics_set_data(&analytics_data.netdata_collectors, (char *)buffer_tostring(ap.both)); diff --git a/daemon/main.c b/daemon/main.c index c45d0bd9d6..e10d38b406 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -895,6 +895,9 @@ int main(int argc, char **argv) { } #endif #ifdef ENABLE_DBENGINE + else if(strcmp(optarg, "dicttest") == 0) { + return dictionary_unittest(10000); + } else if(strncmp(optarg, createdataset_string, strlen(createdataset_string)) == 0) { optarg += strlen(createdataset_string); unsigned history_seconds = strtoul(optarg, NULL, 0); |