[dbench @ tridge@samba.org-20070716045738-w43whgzrlijwipu7]
authorAndrew Tridgell <tridge@samba.org>
Mon, 16 Jul 2007 04:57:38 +0000 (14:57 +1000)
committerAndrew Tridgell <tridge@samba.org>
Mon, 16 Jul 2007 04:57:38 +0000 (14:57 +1000)
fixed cleanup for multiple clients per process

child.c
fileio.c
sockio.c

diff --git a/child.c b/child.c
index 20c038ea51bfd180612ef7c12b65f380e3f30cd9..5524e077bae99af814eead107df29578f8d9170a 100644 (file)
--- a/child.c
+++ b/child.c
@@ -162,8 +162,12 @@ again:
        while (fgets(line, sizeof(line)-1, f)) {
                params = sparams;
 
-               if (child->done || kill(parent, 0) == -1) {
-                       goto done;
+               if (kill(parent, 0) == -1) {
+                       exit(1);
+               }
+
+               for (child=child0;child<child0+options.clients_per_process;child++) {
+                       if (child->done) goto done;
                }
 
                child->line++;
@@ -237,6 +241,7 @@ done:
        fclose(f);
        for (child=child0;child<child0+options.clients_per_process;child++) {
                child->cleanup = 1;
+               fflush(stdout);
                nb_cleanup(child);
        }
 }
index 19a609a09407490311d8ee4f7f6d3cb5e47cc4af..838bf6a90f5bd0e10aa971af3c39c16e23b75322 100644 (file)
--- a/fileio.c
+++ b/fileio.c
@@ -192,6 +192,8 @@ void nb_setup(struct child_struct *child)
        struct ftable *ftable;
        ftable = calloc(MAX_FILES, sizeof(struct ftable));
        child->private = ftable;
+       child->rate.last_time = timeval_current();
+       child->rate.last_bytes = 0;
 }
 
 void nb_unlink(struct child_struct *child, const char *fname, int attr, const char *status)
index f86d0e501b5204c27500b29aa19d684e3712247b..b01ccc722bb3b35e5aa338061d55731b5f3810c7 100644 (file)
--- a/sockio.c
+++ b/sockio.c
@@ -68,6 +68,8 @@ void nb_setup(struct child_struct *child)
        struct sockio *sockio;
        sockio = calloc(1, sizeof(struct sockio));
        child->private = sockio;
+       child->rate.last_time = timeval_current();
+       child->rate.last_bytes = 0;
        
        sockio->sock = open_socket_out(options.server, TCP_PORT);
        if (sockio->sock == -1) {