[Pvfs2-cvs] commit by sampson in pvfs2/src/client/windows/client-test: test-io.c

CVS commit program cvs at parl.clemson.edu
Thu Mar 3 17:58:33 EST 2011


Update of /projects/cvsroot/pvfs2/src/client/windows/client-test
In directory parlweb1:/tmp/cvs-serv1777/src/client/windows/client-test

Modified Files:
      Tag: windows-client
	test-io.c 
Log Message:
Windows testing


Index: test-io.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/windows/client-test/Attic/test-io.c,v
diff -p -u -r1.1.2.9 -r1.1.2.10
--- test-io.c	25 Feb 2011 23:03:10 -0000	1.1.2.9
+++ test-io.c	3 Mar 2011 22:58:32 -0000	1.1.2.10
@@ -421,7 +421,7 @@ void *io_file_mt_thread(void *pargs)
     int i;
     struct timeval start;
     double elapsed;
-    unsigned int *total = 0;
+    unsigned int *total;
     FILE *f;
 
     total = (unsigned int *) malloc(sizeof(unsigned int));
@@ -448,13 +448,15 @@ void *io_file_mt_thread(void *pargs)
             fclose(f);
         }
         elapsed = timer_elapsed(&start);
-        total += (unsigned int) (elapsed * 1000000.0);
+        *total += (unsigned int) (elapsed * 1000000.0);
 
         free(file_name);
     }
 
     free(dir_name);
 
+    pthread_exit(total);
+
     return total;
 }
 
@@ -463,7 +465,8 @@ int io_file_mt(global_options *options, 
     thread_args *args;
     pthread_t *hthreads;
     int threadi, ret, i, code = 0;
-    unsigned int *counter, total;
+    unsigned int total;
+    void *counter;
     struct timeval start;
     double elapsed;
 
@@ -490,11 +493,9 @@ int io_file_mt(global_options *options, 
     {
         for (i = 0; i < THREAD_COUNT && code == 0; i++)
         {
-            counter = (unsigned int *) malloc(sizeof(unsigned int));
-
             /* return value is time in microseconds */
-            code = pthread_join(hthreads[threadi], &counter);
-            total += *counter;
+            code = pthread_join(hthreads[i], &counter);            
+            total += *((unsigned int *) counter);
 
             free(counter);
         }
@@ -525,7 +526,6 @@ int io_file_mt(global_options *options, 
 
     io_file_mt_cleanup(options);
 
-    free(counter);
     free(hthreads);
     free(args);
 



More information about the Pvfs2-cvs mailing list