summaryrefslogtreecommitdiff
path: root/src/c
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-09-11 13:06:51 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-09-11 13:06:51 -0400
commit05fbd01cabc967d7216d8cbe701ac10ad797b122 (patch)
tree73966b5bbe40adcbb3abbf589652ef3b8afc0440 /src/c
parentfe9025e471578cbdef8ee21e0f9dc51f0f2107ce (diff)
More opportunities to use regions and lack of string copying
Diffstat (limited to 'src/c')
-rw-r--r--src/c/driver.c5
-rw-r--r--src/c/urweb.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/src/c/driver.c b/src/c/driver.c
index e5e1affd..705bb613 100644
--- a/src/c/driver.c
+++ b/src/c/driver.c
@@ -52,8 +52,8 @@ static pthread_cond_t queue_cond = PTHREAD_COND_INITIALIZER;
#define MAX_RETRIES 5
static void *worker(void *data) {
- int me = *(int *)data, retries_left = MAX_RETRIES;;
- uw_context ctx = uw_init(1024, 1024);
+ int me = *(int *)data, retries_left = MAX_RETRIES;
+ uw_context ctx = uw_init(1024, 0);
while (1) {
failure_kind fk = uw_begin_init(ctx);
@@ -224,6 +224,7 @@ static void *worker(void *data) {
uw_send(ctx, sock);
printf("Done with client.\n\n");
+ uw_memstats(ctx);
break;
}
}
diff --git a/src/c/urweb.c b/src/c/urweb.c
index 7c7b057f..d4fd1844 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -207,6 +207,11 @@ void uw_end_region(uw_context ctx) {
ctx->regions = r->next;
}
+void uw_memstats(uw_context ctx) {
+ printf("Page: %d/%d\n", ctx->page_front - ctx->page, ctx->page_back - ctx->page);
+ printf("Heap: %d/%d\n", ctx->heap_front - ctx->heap, ctx->heap_back - ctx->heap);
+}
+
int uw_really_send(int sock, const void *buf, ssize_t len) {
while (len > 0) {
ssize_t n = send(sock, buf, len, 0);