diff options
author | otto <> | 2011-05-12 12:03:40 +0000 |
---|---|---|
committer | otto <> | 2011-05-12 12:03:40 +0000 |
commit | d45d754e827ce79028a6fbdc3cb81ace2deedc16 (patch) | |
tree | a2ce40f59b33ef7605e6d030996f6288634c0cf6 | |
parent | 3696413c5e3e4a73b5dd8ecc1906d60fbdafe864 (diff) | |
download | openbsd-d45d754e827ce79028a6fbdc3cb81ace2deedc16.tar.gz openbsd-d45d754e827ce79028a6fbdc3cb81ace2deedc16.tar.bz2 openbsd-d45d754e827ce79028a6fbdc3cb81ace2deedc16.zip |
Avoid fp computations for stats, this make calling malloc_dump() safe in more
cases.
-rw-r--r-- | src/lib/libc/stdlib/malloc.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index eed71c25b6..b803501d41 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: malloc.c,v 1.133 2011/05/12 09:35:37 otto Exp $ */ | 1 | /* $OpenBSD: malloc.c,v 1.134 2011/05/12 12:03:40 otto Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net> | 3 | * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net> |
4 | * | 4 | * |
@@ -1571,15 +1571,14 @@ malloc_dump1(int fd, struct dir_info *d) | |||
1571 | write(fd, buf, strlen(buf)); | 1571 | write(fd, buf, strlen(buf)); |
1572 | if (d == NULL) | 1572 | if (d == NULL) |
1573 | return; | 1573 | return; |
1574 | snprintf(buf, sizeof(buf), "Regions slots %zu\n", d->regions_total); | 1574 | snprintf(buf, sizeof(buf), "Region slots free %zu/%zu\n", |
1575 | d->regions_free, d->regions_total); | ||
1575 | write(fd, buf, strlen(buf)); | 1576 | write(fd, buf, strlen(buf)); |
1576 | snprintf(buf, sizeof(buf), "Finds %zu/%zu %f\n", d->finds, | 1577 | snprintf(buf, sizeof(buf), "Finds %zu/%zu\n", d->finds, |
1577 | d->find_collisions, | 1578 | d->find_collisions); |
1578 | 1.0 + (double)d->find_collisions / d->finds); | ||
1579 | write(fd, buf, strlen(buf)); | 1579 | write(fd, buf, strlen(buf)); |
1580 | snprintf(buf, sizeof(buf), "Inserts %zu/%zu %f\n", d->inserts, | 1580 | snprintf(buf, sizeof(buf), "Inserts %zu/%zu\n", d->inserts, |
1581 | d->insert_collisions, | 1581 | d->insert_collisions); |
1582 | 1.0 + (double)d->insert_collisions / d->inserts); | ||
1583 | write(fd, buf, strlen(buf)); | 1582 | write(fd, buf, strlen(buf)); |
1584 | snprintf(buf, sizeof(buf), "Deletes %zu/%zu\n", d->deletes, | 1583 | snprintf(buf, sizeof(buf), "Deletes %zu/%zu\n", d->deletes, |
1585 | d->delete_moves); | 1584 | d->delete_moves); |
@@ -1587,8 +1586,6 @@ malloc_dump1(int fd, struct dir_info *d) | |||
1587 | snprintf(buf, sizeof(buf), "Cheap reallocs %zu/%zu\n", | 1586 | snprintf(buf, sizeof(buf), "Cheap reallocs %zu/%zu\n", |
1588 | d->cheap_reallocs, d->cheap_realloc_tries); | 1587 | d->cheap_reallocs, d->cheap_realloc_tries); |
1589 | write(fd, buf, strlen(buf)); | 1588 | write(fd, buf, strlen(buf)); |
1590 | snprintf(buf, sizeof(buf), "Regions slots free %zu\n", d->regions_free); | ||
1591 | write(fd, buf, strlen(buf)); | ||
1592 | dump_free_chunk_info(fd, d); | 1589 | dump_free_chunk_info(fd, d); |
1593 | dump_free_page_info(fd, d); | 1590 | dump_free_page_info(fd, d); |
1594 | snprintf(buf, sizeof(buf), | 1591 | snprintf(buf, sizeof(buf), |