aboutsummaryrefslogtreecommitdiff
path: root/gcc/bitmap.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2010-06-02 13:53:16 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2010-06-02 11:53:16 +0000
commitd4fb676f6ffed9b9b6230b54497cf0e266175b6a (patch)
tree5c522620d37262258f1f0c92bfad41d5d9f92b4e /gcc/bitmap.c
parent36c4a482b2819cae529b52c4afa1af87c7d7a2d0 (diff)
downloadgcc-d4fb676f6ffed9b9b6230b54497cf0e266175b6a.zip
gcc-d4fb676f6ffed9b9b6230b54497cf0e266175b6a.tar.gz
gcc-d4fb676f6ffed9b9b6230b54497cf0e266175b6a.tar.bz2
bitmap.c (bitmap_descriptor): Add search_iter.
* bitmap.c (bitmap_descriptor): Add search_iter. (bitmap_find_bit): Increment it. (print_statistics): Print it. From-SVN: r160148
Diffstat (limited to 'gcc/bitmap.c')
-rw-r--r--gcc/bitmap.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/gcc/bitmap.c b/gcc/bitmap.c
index f7309a0..8f4a566 100644
--- a/gcc/bitmap.c
+++ b/gcc/bitmap.c
@@ -42,6 +42,7 @@ struct bitmap_descriptor
HOST_WIDEST_INT peak;
HOST_WIDEST_INT current;
int nsearches;
+ int search_iter;
};
/* Hashtable mapping bitmap names to descriptors. */
@@ -556,12 +557,12 @@ bitmap_find_bit (bitmap head, unsigned int bit)
bitmap_element *element;
unsigned int indx = bit / BITMAP_ELEMENT_ALL_BITS;
-#ifdef GATHER_STATISTICS
- head->desc->nsearches++;
-#endif
if (head->current == 0
|| head->indx == indx)
return head->current;
+#ifdef GATHER_STATISTICS
+ head->desc->nsearches++;
+#endif
if (head->indx < indx)
/* INDX is beyond head->indx. Search from head->current
@@ -569,7 +570,11 @@ bitmap_find_bit (bitmap head, unsigned int bit)
for (element = head->current;
element->next != 0 && element->indx < indx;
element = element->next)
+#ifdef GATHER_STATISTICS
+ head->desc->search_iter++;
+#else
;
+#endif
else if (head->indx / 2 < indx)
/* INDX is less than head->indx and closer to head->indx than to
@@ -577,7 +582,11 @@ bitmap_find_bit (bitmap head, unsigned int bit)
for (element = head->current;
element->prev != 0 && element->indx > indx;
element = element->prev)
+#ifdef GATHER_STATISTICS
+ head->desc->search_iter++;
+#else
;
+#endif
else
/* INDX is less than head->indx and closer to 0 than to
@@ -585,7 +594,11 @@ bitmap_find_bit (bitmap head, unsigned int bit)
for (element = head->first;
element->next != 0 && element->indx < indx;
element = element->next)
+#ifdef GATHER_STATISTICS
+ head->desc->search_iter++;
+#else
;
+#endif
/* `element' is the nearest to the one we want. If it's not the one we
want, the one we want doesn't exist. */
@@ -2115,8 +2128,9 @@ print_statistics (void **slot, void *b)
sprintf (s, "%s:%i (%s)", s1, d->line, d->function);
s[41] = 0;
fprintf (stderr, "%-41s %8d %15"HOST_WIDEST_INT_PRINT"d %15"
- HOST_WIDEST_INT_PRINT"d %15"HOST_WIDEST_INT_PRINT"d %10d\n",
- s, d->created, d->allocated, d->peak, d->current, d->nsearches);
+ HOST_WIDEST_INT_PRINT"d %15"HOST_WIDEST_INT_PRINT"d %10d %10d\n",
+ s, d->created, d->allocated, d->peak, d->current, d->nsearches,
+ d->search_iter);
i->size += d->allocated;
i->count += d->created;
}
@@ -2134,8 +2148,8 @@ dump_bitmap_statistics (void)
return;
fprintf (stderr, "\nBitmap Overall "
- " Allocated Peak Leak searched "
- " per search\n");
+ " Allocated Peak Leak searched "
+ " search itr\n");
fprintf (stderr, "---------------------------------------------------------------------------------\n");
info.count = 0;
info.size = 0;