summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2011-05-12 12:03:41 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2011-05-12 12:03:41 +0000
commit5fe4dce87abcaf489b618a85253a376bc2531319 (patch)
treea2c6d6c88a7c0c7360ea8a27e9f8ba3b035b9248 /lib/libc
parent6ec8d2ad30b8b989e23ef97f622375348fb3cf43 (diff)
Avoid fp computations for stats, this make calling malloc_dump() safe in more
cases.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdlib/malloc.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index eed71c25b69..b803501d41f 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: malloc.c,v 1.133 2011/05/12 09:35:37 otto Exp $ */
+/* $OpenBSD: malloc.c,v 1.134 2011/05/12 12:03:40 otto Exp $ */
/*
* Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
*
@@ -1571,15 +1571,14 @@ malloc_dump1(int fd, struct dir_info *d)
write(fd, buf, strlen(buf));
if (d == NULL)
return;
- snprintf(buf, sizeof(buf), "Regions slots %zu\n", d->regions_total);
+ snprintf(buf, sizeof(buf), "Region slots free %zu/%zu\n",
+ d->regions_free, d->regions_total);
write(fd, buf, strlen(buf));
- snprintf(buf, sizeof(buf), "Finds %zu/%zu %f\n", d->finds,
- d->find_collisions,
- 1.0 + (double)d->find_collisions / d->finds);
+ snprintf(buf, sizeof(buf), "Finds %zu/%zu\n", d->finds,
+ d->find_collisions);
write(fd, buf, strlen(buf));
- snprintf(buf, sizeof(buf), "Inserts %zu/%zu %f\n", d->inserts,
- d->insert_collisions,
- 1.0 + (double)d->insert_collisions / d->inserts);
+ snprintf(buf, sizeof(buf), "Inserts %zu/%zu\n", d->inserts,
+ d->insert_collisions);
write(fd, buf, strlen(buf));
snprintf(buf, sizeof(buf), "Deletes %zu/%zu\n", d->deletes,
d->delete_moves);
@@ -1587,8 +1586,6 @@ malloc_dump1(int fd, struct dir_info *d)
snprintf(buf, sizeof(buf), "Cheap reallocs %zu/%zu\n",
d->cheap_reallocs, d->cheap_realloc_tries);
write(fd, buf, strlen(buf));
- snprintf(buf, sizeof(buf), "Regions slots free %zu\n", d->regions_free);
- write(fd, buf, strlen(buf));
dump_free_chunk_info(fd, d);
dump_free_page_info(fd, d);
snprintf(buf, sizeof(buf),