}
static
-void print_ja_debug_info(struct cds_ja *ja)
+int ja_final_checks(struct cds_ja *ja)
{
double fallback_ratio;
unsigned long na, nf, nr_fallback;
+ int ret = 0;
fallback_ratio = (double) uatomic_read(&ja->nr_fallback);
fallback_ratio /= (double) uatomic_read(&ja->nr_nodes_allocated);
na = uatomic_read(&ja->nr_nodes_allocated);
nf = uatomic_read(&ja->nr_nodes_freed);
+ dbg_printf("Nodes allocated: %lu, Nodes freed: %lu.\n", na, nf);
+ if (nr_fallback)
+ print_debug_fallback_distribution(ja);
+
if (na != nf) {
fprintf(stderr, "[error] Judy array leaked %ld nodes. Allocated: %lu, freed: %lu.\n",
(long) na - nf, na, nf);
+ ret = -1;
}
- dbg_printf("Nodes allocated: %lu, Nodes freed: %lu.\n", na, nf);
- if (nr_fallback)
- print_debug_fallback_distribution(ja);
+ return ret;
}
/*
flavor->barrier();
flavor->thread_online();
- print_ja_debug_info(ja);
+ ret = ja_final_checks(ja);
free(ja);
- return 0;
+ return ret;
}