Browse Source

Avoid fp computations for stats, this make calling malloc_dump() safe in more

cases.
OPENBSD_5_0
otto 13 years ago
parent
commit
6ebcec8c72
1 changed files with 7 additions and 10 deletions
  1. +7
    -10
      src/lib/libc/stdlib/malloc.c

+ 7
- 10
src/lib/libc/stdlib/malloc.c View File

@ -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> * 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)); write(fd, buf, strlen(buf));
if (d == NULL) if (d == NULL)
return; 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)); 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)); 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)); write(fd, buf, strlen(buf));
snprintf(buf, sizeof(buf), "Deletes %zu/%zu\n", d->deletes, snprintf(buf, sizeof(buf), "Deletes %zu/%zu\n", d->deletes,
d->delete_moves); d->delete_moves);
@ -1587,8 +1586,6 @@ malloc_dump1(int fd, struct dir_info *d)
snprintf(buf, sizeof(buf), "Cheap reallocs %zu/%zu\n", snprintf(buf, sizeof(buf), "Cheap reallocs %zu/%zu\n",
d->cheap_reallocs, d->cheap_realloc_tries); d->cheap_reallocs, d->cheap_realloc_tries);
write(fd, buf, strlen(buf)); 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_chunk_info(fd, d);
dump_free_page_info(fd, d); dump_free_page_info(fd, d);
snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),


Loading…
Cancel
Save