From: Mathieu Desnoyers Date: Thu, 30 May 2013 11:08:35 +0000 (-0400) Subject: rcuja: print info about allocated/freed/fallback nodes X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=efbd222adc62d2c7e840df0cc8921b3503d6cb30;p=userspace-rcu.git rcuja: print info about allocated/freed/fallback nodes Signed-off-by: Mathieu Desnoyers --- diff --git a/rcuja/rcuja.c b/rcuja/rcuja.c index 56a6e56..e59ebe3 100644 --- a/rcuja/rcuja.c +++ b/rcuja/rcuja.c @@ -246,6 +246,8 @@ enum ja_recompact { static unsigned long node_fallback_count_distribution[JA_ENTRY_PER_NODE]; +static +unsigned long nr_nodes_allocated, nr_nodes_freed; static struct cds_ja_inode *_ja_node_mask_ptr(struct cds_ja_inode_flag *node) @@ -300,12 +302,14 @@ struct cds_ja_inode *alloc_cds_ja_node(const struct cds_ja_type *ja_type) return NULL; } memset(p, 0, len); + uatomic_inc(&nr_nodes_allocated); return p; } void free_cds_ja_node(struct cds_ja_inode *node) { free(node); + uatomic_inc(&nr_nodes_freed); } #define __JA_ALIGN_MASK(v, mask) (((v) + (mask)) & ~(mask)) @@ -2412,6 +2416,10 @@ int cds_ja_destroy(struct cds_ja *ja, fprintf(stderr, "[warning] RCU Judy Array used %lu fallback node(s)\n", uatomic_read(&ja->nr_fallback)); + fprintf(stderr, "Nodes allocated: %lu, Nodes freed: %lu. Fallback ratio: %g\n", + uatomic_read(&nr_nodes_allocated), + uatomic_read(&nr_nodes_freed), + (double) uatomic_read(&ja->nr_fallback) / (double) uatomic_read(&nr_nodes_allocated)); print_debug_fallback_distribution(); free(ja); return 0;