summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2007-12-07 11:06:15 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2007-12-07 11:06:15 +0000
commitb474b1d7c937251b0abb37df5c9d60ede82d2d10 (patch)
treee3ad5f18cf4623bad4d84b4024eb739aa4a08e4a /src/app.c
parent5c0d66d33f1c19ae7592f858b330ffd03b0ec113 (diff)
Attribute reallocated blocks to the original allocator.
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/src/app.c b/src/app.c
index da97889..60b6f1c 100644
--- a/src/app.c
+++ b/src/app.c
@@ -31,6 +31,8 @@
#include <unistd.h>
#include <errno.h>
+#include <sys/wait.h> /* status macros */
+
#include "odin.h"
#include "client.h"
#include "block.h"
@@ -1280,27 +1282,32 @@ _client_move_block (Client *c, Allocator *A, gpointer old_addr, gpointer new_add
if (new_addr != old_addr) {
_client_delete_block (c, A, old_addr, time, max_time);
if (new_addr != NULL)
- _client_new_block (c, A, new_addr, new_size, time, max_time);
+ _client_new_block (c, b->allocator,
+ new_addr, new_size, time, max_time);
} else {
AllocatorTime *At;
gsize old_size = b->size;
- guint index;
-
- b->size = new_size;
At = _allocator_get_time (c, b->allocator, max_time);
- At->bytes += (gssize) (new_size - old_size);
- if (At->bytes > At->peak_bytes)
- At->peak_bytes = At->bytes;
At->n_reallocs++;
- index = log2_ceil (old_size);
- At->size_allocs[index]--;
+ if (old_size != new_size) {
+ guint index;
+
+ b->size = new_size;
+
+ At->bytes += (gssize) (new_size - old_size);
+ if (At->bytes > At->peak_bytes)
+ At->peak_bytes = At->bytes;
- index = log2_ceil (new_size);
- At->size_allocs[index]--;
- if (index >= At->max_size_alloc)
- At->max_size_alloc = index + 1;
+ index = log2_ceil (old_size);
+ At->size_allocs[index]--;
+
+ index = log2_ceil (new_size);
+ At->size_allocs[index]--;
+ if (index >= At->max_size_alloc)
+ At->max_size_alloc = index + 1;
+ }
}
}
@@ -1923,6 +1930,12 @@ reap_child (GPid pid, gint status, gpointer data)
{
App *app = data;
+ if (WIFEXITED (status)) {
+ g_print ("child exited with %d\n", WEXITSTATUS (status));
+ } else if (WIFSIGNALED (status)) {
+ g_print ("child died with signal %d\n", WTERMSIG (status));
+ }
+
g_spawn_close_pid (pid);
app->client.terminated = TRUE;