1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

Fix repairing of memusage trace files.

This commit is contained in:
Ulrich Drepper
2009-10-29 14:19:33 -07:00
parent e0f471a118
commit 67854c131c
2 changed files with 24 additions and 13 deletions

View File

@@ -191,13 +191,6 @@ main (int argc, char *argv[])
maxsize_heap = headent[1].heap;
maxsize_stack = headent[1].stack;
maxsize_total = headent[0].stack;
if (also_total)
{
/* We use one scale and since we also draw the total amount of
memory used we have to adapt the maximum. */
maxsize_heap = maxsize_total;
maxsize_stack = maxsize_total;
}
if (maxsize_heap == 0 && maxsize_stack == 0)
{
@@ -210,18 +203,31 @@ main (int argc, char *argv[])
{
if (read (fd, &next, sizeof (next)) == 0)
break;
if (next.heap > headent[1].heap)
headent[1].heap = next.heap;
if (next.stack > headent[1].stack)
headent[1].stack = next.stack;
if (next.heap > maxsize_heap)
maxsize_heap = next.heap;
if (next.stack > maxsize_stack)
maxsize_stack = next.stack;
if (maxsize_heap + maxsize_stack > maxsize_total)
maxsize_total = maxsize_heap + maxsize_stack;
}
headent[0].stack = maxsize_total;
headent[1].heap = maxsize_heap;
headent[1].stack = maxsize_stack;
headent[1].time_low = next.time_low;
headent[1].time_high = next.time_high;
/* Write the computed values in the file. */
lseek (fd, sizeof (struct entry), SEEK_SET);
write (fd, &headent[1], sizeof (struct entry));
lseek (fd, 0, SEEK_SET);
write (fd, headent, 2 * sizeof (struct entry));
}
if (also_total)
{
/* We use one scale and since we also draw the total amount of
memory used we have to adapt the maximum. */
maxsize_heap = maxsize_total;
maxsize_stack = maxsize_total;
}
start_time = ((uint64_t) headent[0].time_high) << 32 | headent[0].time_low;