@cryptotaxi247 / netdata-1 / commits / bef825892

Remove July arrays (#19194)

Stelios Fragkakis committed Dec 12, 2024 at 21:33 UTC bef825892772711a3668c26a82175fafbf109ef7
10 files changed -580
CMakeLists.txt
-2
@@ -728,8 +728,6 @@ set(LIBNETDATA_FILES
728 src/libnetdata/functions_evloop/functions_evloop.h
729 src/libnetdata/gorilla/gorilla.cc
730 src/libnetdata/gorilla/gorilla.h
731 - src/libnetdata/july/july.c
732 - src/libnetdata/july/july.h
731 src/libnetdata/inlined.h
732 src/libnetdata/json/json.c
733 src/libnetdata/json/json.h
src/daemon/main.c
-5
@@ -801,7 +801,6 @@ int get_system_info(struct rrdhost_system_info *system_info) {
801 int buffer_unittest(void);
802 int pgc_unittest(void);
803 int mrg_unittest(void);
804 -int julytest(void);
804 int pluginsd_parser_unittest(void);
805 void replication_initialize(void);
806 void bearer_tokens_init(void);
@@ -1046,10 +1045,6 @@ int netdata_main(int argc, char **argv) {
1045 unittest_running = true;
1046 return mrg_unittest();
1047 }
1049 - else if(strcmp(optarg, "julytest") == 0) {
1050 - unittest_running = true;
1051 - return julytest();
1052 - }
1048 else if(strcmp(optarg, "parsertest") == 0) {
1049 unittest_running = true;
1050 return pluginsd_parser_unittest();
src/daemon/pulse/pulse-dbengine.c
-42
@@ -671,9 +671,6 @@ void pulse_dbengine_do(bool extended) {
671 struct rrdeng_buffer_sizes dbmem = rrdeng_pulse_memory_sizes();
672
673 size_t buffers_total_size = dbmem.xt_buf + dbmem.wal;
674 -#ifdef PDC_USE_JULYL
675 - buffers_total_size += buffers.julyl;
676 -#endif
674
675 size_t aral_structures_total_size = 0, aral_used_total_size = 0;
676 size_t aral_padding_total_size = 0;
@@ -757,9 +754,6 @@ void pulse_dbengine_do(bool extended) {
754 static RRDDIM *rd_pgc_buffers_epdl = NULL;
755 static RRDDIM *rd_pgc_buffers_deol = NULL;
756 static RRDDIM *rd_pgc_buffers_pd = NULL;
760 -#ifdef PDC_USE_JULYL
761 - static RRDDIM *rd_pgc_buffers_julyl = NULL;
762 -#endif
757
758 if (unlikely(!st_pgc_buffers)) {
759 st_pgc_buffers = rrdset_create_localhost(
@@ -790,9 +784,6 @@ void pulse_dbengine_do(bool extended) {
784 rd_pgc_buffers_xt_buf = rrddim_add(st_pgc_buffers, "extent buffers", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
785 rd_pgc_buffers_epdl = rrddim_add(st_pgc_buffers, "epdl", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
786 rd_pgc_buffers_deol = rrddim_add(st_pgc_buffers, "deol", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
793 -#ifdef PDC_USE_JULYL
794 - rd_pgc_buffers_julyl = rrddim_add(st_pgc_buffers, "julyl", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
795 -#endif
787 }
788 priority++;
789
@@ -810,43 +801,10 @@ void pulse_dbengine_do(bool extended) {
801 rrddim_set_by_pointer(st_pgc_buffers, rd_pgc_buffers_xt_buf, (collected_number)dbmem.xt_buf);
802 rrddim_set_by_pointer(st_pgc_buffers, rd_pgc_buffers_epdl, (collected_number)aral_free_bytes_from_stats(dbmem.as[RRDENG_MEM_EPDL]));
803 rrddim_set_by_pointer(st_pgc_buffers, rd_pgc_buffers_deol, (collected_number)aral_free_bytes_from_stats(dbmem.as[RRDENG_MEM_DEOL]));
813 -#ifdef PDC_USE_JULYL
814 - rrddim_set_by_pointer(st_pgc_buffers, rd_pgc_buffers_julyl, (collected_number)buffers.julyl);
815 -#endif
804
805 rrdset_done(st_pgc_buffers);
806 }
807
820 -#ifdef PDC_USE_JULYL
821 - {
822 - static RRDSET *st_julyl_moved = NULL;
823 - static RRDDIM *rd_julyl_moved = NULL;
824 -
825 - if (unlikely(!st_julyl_moved)) {
826 - st_julyl_moved = rrdset_create_localhost(
827 - "netdata",
828 - "dbengine_julyl_moved",
829 - NULL,
830 - "dbengine memory",
831 - NULL,
832 - "Netdata JulyL Memory Moved",
833 - "bytes/s",
834 - "netdata",
835 - "pulse",
836 - priority,
837 - localhost->rrd_update_every,
838 - RRDSET_TYPE_AREA);
839 -
840 - rd_julyl_moved = rrddim_add(st_julyl_moved, "moved", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
841 - }
842 - priority++;
843 -
844 - rrddim_set_by_pointer(st_julyl_moved, rd_julyl_moved, (collected_number)julyl_bytes_moved());
845 -
846 - rrdset_done(st_julyl_moved);
847 - }
848 -#endif
849 -
808 {
809 static RRDSET *st_mrg_metrics = NULL;
810 static RRDDIM *rd_mrg_metrics = NULL;
src/database/engine/pdc.h
-12
@@ -7,17 +7,6 @@
7
8 struct rrdeng_cmd;
9
10 -#ifdef PDC_USE_JULYL
11 -#define PDCJudyLIns JulyLIns
12 -#define PDCJudyLGet JulyLGet
13 -#define PDCJudyLFirst JulyLFirst
14 -#define PDCJudyLNext JulyLNext
15 -#define PDCJudyLLast JulyLLast
16 -#define PDCJudyLPrev JulyLPrev
17 -#define PDCJudyLFirstThenNext JulyLFirstThenNext
18 -#define PDCJudyLLastThenPrev JulyLLastThenPrev
19 -#define PDCJudyLFreeArray JulyLFreeArray
20 -#else
10 #define PDCJudyLIns JudyLIns
11 #define PDCJudyLGet JudyLGet
12 #define PDCJudyLFirst JudyLFirst
@@ -27,7 +16,6 @@ struct rrdeng_cmd;
16 #define PDCJudyLFirstThenNext JudyLFirstThenNext
17 #define PDCJudyLLastThenPrev JudyLLastThenPrev
18 #define PDCJudyLFreeArray JudyLFreeArray
30 -#endif
19
20 typedef struct extent_page_details_list EPDL;
21 typedef void (*execute_extent_page_details_list_t)(struct rrdengine_instance *ctx, EPDL *epdl, enum storage_priority priority);
src/database/engine/rrdengine.c
-8
@@ -1601,10 +1601,6 @@ struct rrdeng_buffer_sizes rrdeng_pulse_memory_sizes(void) {
1601 },
1602 .wal = __atomic_load_n(&wal_globals.atomics.allocated, __ATOMIC_RELAXED) * (sizeof(WAL) + RRDENG_BLOCK_SIZE),
1603 .xt_buf = extent_buffer_cache_size(),
1604 -
1605 -#ifdef PDC_USE_JULYL
1606 - .julyl = julyl_cache_size(),
1607 -#endif
1604 };
1605 }
1606
@@ -1627,10 +1623,6 @@ static void *cleanup_tp_worker(struct rrdengine_instance *ctx __maybe_unused, vo
1623 }
1624 }
1625
1630 -#ifdef PDC_USE_JULYL
1631 - julyl_cleanup1();
1632 -#endif
1633 -
1626 return data;
1627 }
1628
src/database/engine/rrdengineapi.h
-3
@@ -231,9 +231,6 @@ struct rrdeng_buffer_sizes {
231
232 size_t wal;
233 size_t xt_buf;
234 -#ifdef PDC_USE_JULYL
235 - size_t julyl;
236 -#endif
234 };
235
236 struct rrdeng_buffer_sizes rrdeng_pulse_memory_sizes(void);
src/libnetdata/july/README.md deleted
-14
@@ -1,14 +0,0 @@
1 -<!--
2 -custom_edit_url: https://github.com/netdata/netdata/edit/master/src/libnetdata/july/README.md
3 -sidebar_label: "July interface"
4 -learn_status: "Published"
5 -learn_topic_type: "Tasks"
6 -learn_rel_path: "Developers/libnetdata"
7 --->
8 -
9 -
10 -# July
11 -
12 -An interface similar to `Judy` that uses minimal allocations (that can be cached)
13 -for items that are mainly appended (just a few insertions in the middle)
14 -
src/libnetdata/july/july.c deleted
-453
@@ -1,453 +0,0 @@
1 -// SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -#include "july.h"
4 -
5 -#define JULYL_MIN_ENTRIES 10
6 -
7 -struct JulyL_item {
8 - Word_t index;
9 - void *value;
10 -};
11 -
12 -struct JulyL {
13 - size_t entries;
14 - size_t used;
15 -
16 - // statistics
17 - size_t bytes;
18 - size_t bytes_moved;
19 - size_t reallocs;
20 -
21 - struct {
22 - struct JulyL *prev;
23 - struct JulyL *next;
24 - } cache;
25 -
26 - struct JulyL_item array[];
27 -};
28 -
29 -// ----------------------------------------------------------------------------
30 -// JulyL cache
31 -
32 -static struct {
33 - struct {
34 - SPINLOCK spinlock;
35 - struct JulyL *available_items;
36 - size_t available;
37 - } protected;
38 -
39 - struct {
40 - size_t bytes;
41 - size_t allocated;
42 - size_t bytes_moved;
43 - size_t reallocs;
44 - } atomics;
45 -} julyl_globals = {
46 - .protected = {
47 - .spinlock = SPINLOCK_INITIALIZER,
48 - .available_items = NULL,
49 - .available = 0,
50 - },
51 - .atomics = {
52 - .bytes = 0,
53 - .allocated = 0,
54 - .bytes_moved = 0,
55 - .reallocs = 0,
56 - },
57 -};
58 -
59 -void julyl_cleanup1(void) {
60 - struct JulyL *item = NULL;
61 -
62 - if(!spinlock_trylock(&julyl_globals.protected.spinlock))
63 - return;
64 -
65 - if(julyl_globals.protected.available_items && julyl_globals.protected.available > 10) {
66 - item = julyl_globals.protected.available_items;
67 - DOUBLE_LINKED_LIST_REMOVE_ITEM_UNSAFE(julyl_globals.protected.available_items, item, cache.prev, cache.next);
68 - julyl_globals.protected.available--;
69 - }
70 -
71 - spinlock_unlock(&julyl_globals.protected.spinlock);
72 -
73 - if(item) {
74 - size_t bytes = item->bytes;
75 - freez(item);
76 - __atomic_sub_fetch(&julyl_globals.atomics.bytes, bytes, __ATOMIC_RELAXED);
77 - __atomic_sub_fetch(&julyl_globals.atomics.allocated, 1, __ATOMIC_RELAXED);
78 - }
79 -}
80 -
81 -struct JulyL *julyl_get(void) {
82 - struct JulyL *j;
83 -
84 - spinlock_lock(&julyl_globals.protected.spinlock);
85 -
86 - j = julyl_globals.protected.available_items;
87 - if(likely(j)) {
88 - DOUBLE_LINKED_LIST_REMOVE_ITEM_UNSAFE(julyl_globals.protected.available_items, j, cache.prev, cache.next);
89 - julyl_globals.protected.available--;
90 - }
91 -
92 - spinlock_unlock(&julyl_globals.protected.spinlock);
93 -
94 - if(unlikely(!j)) {
95 - size_t bytes = sizeof(struct JulyL) + JULYL_MIN_ENTRIES * sizeof(struct JulyL_item);
96 - j = mallocz(bytes);
97 - j->bytes = bytes;
98 - j->entries = JULYL_MIN_ENTRIES;
99 - __atomic_add_fetch(&julyl_globals.atomics.bytes, bytes, __ATOMIC_RELAXED);
100 - __atomic_add_fetch(&julyl_globals.atomics.allocated, 1, __ATOMIC_RELAXED);
101 - }
102 -
103 - j->used = 0;
104 - j->bytes_moved = 0;
105 - j->reallocs = 0;
106 - j->cache.next = j->cache.prev = NULL;
107 - return j;
108 -}
109 -
110 -static void julyl_release(struct JulyL *j) {
111 - if(unlikely(!j)) return;
112 -
113 - __atomic_add_fetch(&julyl_globals.atomics.bytes_moved, j->bytes_moved, __ATOMIC_RELAXED);
114 - __atomic_add_fetch(&julyl_globals.atomics.reallocs, j->reallocs, __ATOMIC_RELAXED);
115 -
116 - spinlock_lock(&julyl_globals.protected.spinlock);
117 - DOUBLE_LINKED_LIST_APPEND_ITEM_UNSAFE(julyl_globals.protected.available_items, j, cache.prev, cache.next);
118 - julyl_globals.protected.available++;
119 - spinlock_unlock(&julyl_globals.protected.spinlock);
120 -}
121 -
122 -size_t julyl_cache_size(void) {
123 - return __atomic_load_n(&julyl_globals.atomics.bytes, __ATOMIC_RELAXED);
124 -}
125 -
126 -size_t julyl_bytes_moved(void) {
127 - return __atomic_load_n(&julyl_globals.atomics.bytes_moved, __ATOMIC_RELAXED);
128 -}
129 -
130 -// ----------------------------------------------------------------------------
131 -// JulyL
132 -
133 -size_t JulyLGet_binary_search_position_of_index(const struct JulyL *July, Word_t Index) {
134 - // return the position of the first item >= Index
135 -
136 - size_t left = 0;
137 - size_t right = July->used;
138 - while(left < right) {
139 - size_t middle = (left + right) >> 1;
140 -
141 - if(July->array[middle].index > Index)
142 - right = middle;
143 -
144 - else
145 - left = middle + 1;
146 - }
147 -
148 - internal_fatal(left > July->used, "JULY: invalid position returned");
149 -
150 - if(left > 0 && July->array[left - 1].index == Index)
151 - return left - 1;
152 -
153 - internal_fatal( (left < July->used && July->array[left].index < Index) ||
154 - (left > 0 && July->array[left - 1].index >= Index)
155 - , "JULY: wrong item returned");
156 -
157 - return left;
158 -}
159 -
160 -PPvoid_t JulyLGet(Pcvoid_t PArray, Word_t Index, PJError_t PJError __maybe_unused) {
161 - const struct JulyL *July = PArray;
162 - if(!July)
163 - return NULL;
164 -
165 - size_t pos = JulyLGet_binary_search_position_of_index(July, Index);
166 -
167 - if(unlikely(pos >= July->used || July->array[pos].index != Index))
168 - return NULL;
169 -
170 - return (PPvoid_t)&July->array[pos].value;
171 -}
172 -
173 -PPvoid_t JulyLIns(PPvoid_t PPArray, Word_t Index, PJError_t PJError __maybe_unused) {
174 - struct JulyL *July = *PPArray;
175 - if(unlikely(!July)) {
176 - July = julyl_get();
177 - July->used = 0;
178 - *PPArray = July;
179 - }
180 -
181 - size_t pos = JulyLGet_binary_search_position_of_index(July, Index);
182 -
183 - if((pos == July->used || July->array[pos].index != Index)) {
184 - // we have to add this entry
185 -
186 - if (unlikely(July->used == July->entries)) {
187 - // we have to expand the array
188 - size_t bytes = sizeof(struct JulyL) + July->entries * 2 * sizeof(struct JulyL_item);
189 - __atomic_add_fetch(&julyl_globals.atomics.bytes, bytes - July->bytes, __ATOMIC_RELAXED);
190 - July = reallocz(July, bytes);
191 - July->bytes = bytes;
192 - July->entries *= 2;
193 - July->reallocs++;
194 - *PPArray = July;
195 - }
196 -
197 - if (unlikely(pos != July->used)) {
198 - // we have to shift some members to make room
199 - size_t size = (July->used - pos) * sizeof(struct JulyL_item);
200 - memmove(&July->array[pos + 1], &July->array[pos], size);
201 - July->bytes_moved += size;
202 - }
203 -
204 - July->used++;
205 - July->array[pos].value = NULL;
206 - July->array[pos].index = Index;
207 - }
208 -
209 - return &July->array[pos].value;
210 -}
211 -
212 -PPvoid_t JulyLFirst(Pcvoid_t PArray, Word_t *Index, PJError_t PJError __maybe_unused) {
213 - const struct JulyL *July = PArray;
214 - if(!July)
215 - return NULL;
216 -
217 - size_t pos = JulyLGet_binary_search_position_of_index(July, *Index);
218 - // pos is >= Index
219 -
220 - if(unlikely(pos == July->used))
221 - return NULL;
222 -
223 - *Index = July->array[pos].index;
224 - return (PPvoid_t)&July->array[pos].value;
225 -}
226 -
227 -PPvoid_t JulyLNext(Pcvoid_t PArray, Word_t *Index, PJError_t PJError __maybe_unused) {
228 - const struct JulyL *July = PArray;
229 - if(!July)
230 - return NULL;
231 -
232 - size_t pos = JulyLGet_binary_search_position_of_index(July, *Index);
233 - // pos is >= Index
234 -
235 - if(unlikely(pos == July->used))
236 - return NULL;
237 -
238 - if(July->array[pos].index == *Index) {
239 - pos++;
240 -
241 - if(unlikely(pos == July->used))
242 - return NULL;
243 - }
244 -
245 - *Index = July->array[pos].index;
246 - return (PPvoid_t)&July->array[pos].value;
247 -}
248 -
249 -PPvoid_t JulyLLast(Pcvoid_t PArray, Word_t *Index, PJError_t PJError __maybe_unused) {
250 - const struct JulyL *July = PArray;
251 - if(!July)
252 - return NULL;
253 -
254 - size_t pos = JulyLGet_binary_search_position_of_index(July, *Index);
255 - // pos is >= Index
256 -
257 - if(pos > 0 && (pos == July->used || July->array[pos].index > *Index))
258 - pos--;
259 -
260 - if(unlikely(pos == 0 && July->array[0].index > *Index))
261 - return NULL;
262 -
263 - *Index = July->array[pos].index;
264 - return (PPvoid_t)&July->array[pos].value;
265 -}
266 -
267 -PPvoid_t JulyLPrev(Pcvoid_t PArray, Word_t *Index, PJError_t PJError __maybe_unused) {
268 - const struct JulyL *July = PArray;
269 - if(!July)
270 - return NULL;
271 -
272 - size_t pos = JulyLGet_binary_search_position_of_index(July, *Index);
273 - // pos is >= Index
274 -
275 - if(unlikely(pos == 0 || July->used == 0))
276 - return NULL;
277 -
278 - // get the previous one
279 - pos--;
280 -
281 - *Index = July->array[pos].index;
282 - return (PPvoid_t)&July->array[pos].value;
283 -}
284 -
285 -Word_t JulyLFreeArray(PPvoid_t PPArray, PJError_t PJError __maybe_unused) {
286 - struct JulyL *July = *PPArray;
287 - if(unlikely(!July))
288 - return 0;
289 -
290 - size_t bytes = July->bytes;
291 - julyl_release(July);
292 - *PPArray = NULL;
293 - return bytes;
294 -}
295 -
296 -// ----------------------------------------------------------------------------
297 -// unittest
298 -
299 -#define item_index(i) (((i) * 2) + 100)
300 -
301 -int julytest(void) {
302 - Word_t entries = 10000;
303 - Pvoid_t array = NULL;
304 -
305 - // test additions
306 - for(Word_t i = 0; i < entries ;i++) {
307 - Pvoid_t *PValue = JulyLIns(&array, item_index(i), PJE0);
308 - if(!PValue)
309 - fatal("JULY: cannot insert item %lu", item_index(i));
310 -
311 - *PValue = (void *)(item_index(i));
312 - }
313 -
314 - // test successful finds
315 - for(Word_t i = 0; i < entries ;i++) {
316 - Pvoid_t *PValue = JulyLGet(array, item_index(i), PJE0);
317 - if(!PValue)
318 - fatal("JULY: cannot find item %lu", item_index(i));
319 -
320 - if(*PValue != (void *)(item_index(i)))
321 - fatal("JULY: item %lu has the value %lu", item_index(i), (unsigned long)(*PValue));
322 - }
323 -
324 - // test finding the first item
325 - for(Word_t i = 0; i < entries ;i++) {
326 - Word_t index = item_index(i);
327 - Pvoid_t *PValue = JulyLFirst(array, &index, PJE0);
328 - if(!PValue)
329 - fatal("JULY: cannot find first item %lu", item_index(i));
330 -
331 - if(*PValue != (void *)(item_index(i)))
332 - fatal("JULY: item %lu has the value %lu", item_index(i), (unsigned long)(*PValue));
333 -
334 - if(index != item_index(i))
335 - fatal("JULY: item %lu has index %lu", item_index(i), index);
336 - }
337 -
338 - // test finding the next item
339 - for(Word_t i = 0; i < entries - 1 ;i++) {
340 - Word_t index = item_index(i);
341 - Pvoid_t *PValue = JulyLNext(array, &index, PJE0);
342 - if(!PValue)
343 - fatal("JULY: cannot find next item %lu", item_index(i));
344 -
345 - if(*PValue != (void *)(item_index(i + 1)))
346 - fatal("JULY: item %lu next has the value %lu", item_index(i), (unsigned long)(*PValue));
347 -
348 - if(index != item_index(i + 1))
349 - fatal("JULY: item %lu next has index %lu", item_index(i), index);
350 - }
351 -
352 - // test finding the last item
353 - for(Word_t i = 0; i < entries ;i++) {
354 - Word_t index = item_index(i);
355 - Pvoid_t *PValue = JulyLLast(array, &index, PJE0);
356 - if(!PValue)
357 - fatal("JULY: cannot find last item %lu", item_index(i));
358 -
359 - if(*PValue != (void *)(item_index(i)))
360 - fatal("JULY: item %lu has the value %lu", item_index(i), (unsigned long)(*PValue));
361 -
362 - if(index != item_index(i))
363 - fatal("JULY: item %lu has index %lu", item_index(i), index);
364 - }
365 -
366 - // test finding the prev item
367 - for(Word_t i = 1; i < entries ;i++) {
368 - Word_t index = item_index(i);
369 - Pvoid_t *PValue = JulyLPrev(array, &index, PJE0);
370 - if(!PValue)
371 - fatal("JULY: cannot find prev item %lu", item_index(i));
372 -
373 - if(*PValue != (void *)(item_index(i - 1)))
374 - fatal("JULY: item %lu prev has the value %lu", item_index(i), (unsigned long)(*PValue));
375 -
376 - if(index != item_index(i - 1))
377 - fatal("JULY: item %lu prev has index %lu", item_index(i), index);
378 - }
379 -
380 - // test full traversal forward
381 - {
382 - Word_t i = 0;
383 - Word_t index = 0;
384 - bool first = true;
385 - Pvoid_t *PValue;
386 - while((PValue = JulyLFirstThenNext(array, &index, &first))) {
387 - if(*PValue != (void *)(item_index(i)))
388 - fatal("JULY: item %lu traversal has the value %lu", item_index(i), (unsigned long)(*PValue));
389 -
390 - if(index != item_index(i))
391 - fatal("JULY: item %lu traversal has index %lu", item_index(i), index);
392 -
393 - i++;
394 - }
395 -
396 - if(i != entries)
397 - fatal("JULY: expected to forward traverse %lu entries, but traversed %lu", entries, i);
398 - }
399 -
400 - // test full traversal backward
401 - {
402 - Word_t i = 0;
403 - Word_t index = (Word_t)(-1);
404 - bool first = true;
405 - Pvoid_t *PValue;
406 - while((PValue = JulyLLastThenPrev(array, &index, &first))) {
407 - if(*PValue != (void *)(item_index(entries - i - 1)))
408 - fatal("JULY: item %lu traversal has the value %lu", item_index(i), (unsigned long)(*PValue));
409 -
410 - if(index != item_index(entries - i - 1))
411 - fatal("JULY: item %lu traversal has index %lu", item_index(i), index);
412 -
413 - i++;
414 - }
415 -
416 - if(i != entries)
417 - fatal("JULY: expected to back traverse %lu entries, but traversed %lu", entries, i);
418 - }
419 -
420 - // test finding non-existing first item
421 - for(Word_t i = 0; i < entries ;i++) {
422 - Word_t index = item_index(i) - 1;
423 - Pvoid_t *PValue = JulyLFirst(array, &index, PJE0);
424 - if(!PValue)
425 - fatal("JULY: cannot find first item %lu", item_index(i) - 1);
426 -
427 - if(*PValue != (void *)(item_index(i)))
428 - fatal("JULY: item %lu has the value %lu", item_index(i), (unsigned long)(*PValue));
429 -
430 - if(index != item_index(i))
431 - fatal("JULY: item %lu has index %lu", item_index(i), index);
432 - }
433 -
434 - // test finding non-existing last item
435 - for(Word_t i = 0; i < entries ;i++) {
436 - Word_t index = item_index(i) + 1;
437 - Pvoid_t *PValue = JulyLLast(array, &index, PJE0);
438 - if(!PValue)
439 - fatal("JULY: cannot find last item %lu", item_index(i) + 1);
440 -
441 - if(*PValue != (void *)(item_index(i)))
442 - fatal("JULY: item %lu has the value %lu", item_index(i), (unsigned long)(*PValue));
443 -
444 - if(index != item_index(i))
445 - fatal("JULY: item %lu has index %lu", item_index(i), index);
446 - }
447 -
448 - JulyLFreeArray(&array, PJE0);
449 -
450 - return 0;
451 -}
452 -
453 -
src/libnetdata/july/july.h deleted
-40
@@ -1,40 +0,0 @@
1 -// SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -#ifndef NETDATA_JULY_H
4 -#define NETDATA_JULY_H 1
5 -
6 -#include "../libnetdata.h"
7 -
8 -// #define PDC_USE_JULYL 1
9 -
10 -PPvoid_t JulyLGet(Pcvoid_t PArray, Word_t Index, PJError_t PJError);
11 -PPvoid_t JulyLIns(PPvoid_t PPArray, Word_t Index, PJError_t PJError);
12 -PPvoid_t JulyLFirst(Pcvoid_t PArray, Word_t *Index, PJError_t PJError);
13 -PPvoid_t JulyLNext(Pcvoid_t PArray, Word_t *Index, PJError_t PJError);
14 -PPvoid_t JulyLLast(Pcvoid_t PArray, Word_t *Index, PJError_t PJError);
15 -PPvoid_t JulyLPrev(Pcvoid_t PArray, Word_t *Index, PJError_t PJError);
16 -Word_t JulyLFreeArray(PPvoid_t PPArray, PJError_t PJError);
17 -
18 -static inline PPvoid_t JulyLFirstThenNext(Pcvoid_t PArray, Word_t * PIndex, bool *first) {
19 - if(unlikely(*first)) {
20 - *first = false;
21 - return JulyLFirst(PArray, PIndex, PJE0);
22 - }
23 -
24 - return JulyLNext(PArray, PIndex, PJE0);
25 -}
26 -
27 -static inline PPvoid_t JulyLLastThenPrev(Pcvoid_t PArray, Word_t * PIndex, bool *first) {
28 - if(unlikely(*first)) {
29 - *first = false;
30 - return JulyLLast(PArray, PIndex, PJE0);
31 - }
32 -
33 - return JulyLPrev(PArray, PIndex, PJE0);
34 -}
35 -
36 -void julyl_cleanup1(void);
37 -size_t julyl_cache_size(void);
38 -size_t julyl_bytes_moved(void);
39 -
40 -#endif // NETDATA_JULY_H
src/libnetdata/libnetdata.h
-1
@@ -109,7 +109,6 @@ extern const char *netdata_configured_host_prefix;
109 #include "template-enum.h"
110 #include "libjudy/vendored/Judy.h"
111 #include "libjudy/judyl-typed.h"
112 -#include "july/july.h"
112
113 #include "string/string.h"
114 #include "buffer/buffer.h"