Changeset 8754
- Timestamp:
- 03/03/11 17:58:33 (2 years ago)
- Location:
- branches/windows-client
- Files:
-
- 2 added
- 3 modified
-
projects/TestOrangeFS/TestOrangeFS.sln (modified) (2 diffs)
-
projects/TestOrangeFS/posix-test (added)
-
projects/TestOrangeFS/posix-test/posix-test.vcxproj (added)
-
src/client/windows/client-test/test-io.c (modified) (6 diffs)
-
test/posix/open.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/windows-client/projects/TestOrangeFS/TestOrangeFS.sln
r8743 r8754 138 138 EndProject 139 139 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client-test", "client-test\client-test.vcxproj", "{28761587-FE68-4AEB-8BF0-AB73484A0AD4}" 140 EndProject 141 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "posix-test", "posix-test\posix-test.vcxproj", "{D3738B06-0CF0-438F-856D-AA92B07F584E}" 140 142 EndProject 141 143 Global … … 293 295 {28761587-FE68-4AEB-8BF0-AB73484A0AD4}.Release|Win32.Build.0 = Release|Win32 294 296 {28761587-FE68-4AEB-8BF0-AB73484A0AD4}.Release|x64.ActiveCfg = Release|Win32 297 {D3738B06-0CF0-438F-856D-AA92B07F584E}.Debug|Win32.ActiveCfg = Debug|Win32 298 {D3738B06-0CF0-438F-856D-AA92B07F584E}.Debug|Win32.Build.0 = Debug|Win32 299 {D3738B06-0CF0-438F-856D-AA92B07F584E}.Debug|x64.ActiveCfg = Debug|Win32 300 {D3738B06-0CF0-438F-856D-AA92B07F584E}.Release|Win32.ActiveCfg = Release|Win32 301 {D3738B06-0CF0-438F-856D-AA92B07F584E}.Release|Win32.Build.0 = Release|Win32 302 {D3738B06-0CF0-438F-856D-AA92B07F584E}.Release|x64.ActiveCfg = Release|Win32 295 303 EndGlobalSection 296 304 GlobalSection(SolutionProperties) = preSolution -
branches/windows-client/src/client/windows/client-test/test-io.c
r8747 r8754 422 422 struct timeval start; 423 423 double elapsed; 424 unsigned int *total = 0;424 unsigned int *total; 425 425 FILE *f; 426 426 … … 449 449 } 450 450 elapsed = timer_elapsed(&start); 451 total += (unsigned int) (elapsed * 1000000.0);451 *total += (unsigned int) (elapsed * 1000000.0); 452 452 453 453 free(file_name); … … 455 455 456 456 free(dir_name); 457 458 pthread_exit(total); 457 459 458 460 return total; … … 464 466 pthread_t *hthreads; 465 467 int threadi, ret, i, code = 0; 466 unsigned int *counter, total; 468 unsigned int total; 469 void *counter; 467 470 struct timeval start; 468 471 double elapsed; … … 491 494 for (i = 0; i < THREAD_COUNT && code == 0; i++) 492 495 { 493 counter = (unsigned int *) malloc(sizeof(unsigned int));494 495 496 /* return value is time in microseconds */ 496 code = pthread_join(hthreads[ threadi], &counter);497 total += * counter;497 code = pthread_join(hthreads[i], &counter); 498 total += *((unsigned int *) counter); 498 499 499 500 free(counter); … … 526 527 io_file_mt_cleanup(options); 527 528 528 free(counter);529 529 free(hthreads); 530 530 free(args); -
branches/windows-client/test/posix/open.c
r5718 r8754 5 5 */ 6 6 #include <stdio.h> 7 #ifdef WIN32 8 #include <Windows.h> 9 #include <io.h> 10 #else 7 11 #include <sys/time.h> 12 #endif 8 13 #include <string.h> 9 14 #include <errno.h> 15 #ifndef WIN32 10 16 #include <unistd.h> 17 #endif 11 18 #include <stdlib.h> 12 19 #include <sys/types.h> … … 14 21 #include <fcntl.h> 15 22 #include <time.h> 23 #ifndef WIN32 16 24 #include <linux/unistd.h> 17 25 #include "sha1.h" 18 26 #include "crc32c.h" 27 #endif 19 28 #include "mpi.h" 20 29 30 #ifdef WIN32 31 #define open(f, o, p) _open(f, o, p) 32 #define close(f) _close(f) 33 #define unlink(f) _unlink(f) 34 #endif 35 36 #if 0 21 37 static inline double msec_diff(double *end, double *begin) 22 38 { 23 39 return (*end - *begin); 24 40 } 41 #endif 25 42 43 #ifdef WIN32 44 static double Wtime(void) 45 { 46 LARGE_INTEGER counter; 47 48 QueryPerformanceCounter(&counter); 49 50 return (double) counter.QuadPart; 51 } 52 #else 26 53 static double Wtime(void) 27 54 { … … 30 57 return((double)t.tv_sec * 1e03 + (double)(t.tv_usec) * 1e-03); 31 58 } 59 #endif 32 60 61 #if 0 33 62 struct file_handle_generic { 34 63 /* Filled by VFS */ … … 39 68 unsigned char fhg_hmac_sha1[24]; /* hmac-sha1 message authentication code */ 40 69 }; 70 #endif 41 71 42 72 int main(int argc, char *argv[]) … … 48 78 int open_flags = 0; 49 79 int i, rank, np; 80 #ifdef WIN32 81 LARGE_INTEGER freq; 82 HANDLE hFile; 83 #endif 50 84 51 85 MPI_Init(&argc, &argv); 52 86 MPI_Comm_rank(MPI_COMM_WORLD, &rank); 53 87 MPI_Comm_size(MPI_COMM_WORLD, &np); 54 88 #ifdef WIN32 89 /* just use one option for now */ 90 fname = argv[1]; 91 open_flags |= O_CREAT; 92 do_create = 1; 93 #else 55 94 while ((c = getopt(argc, argv, opt)) != EOF) { 56 95 switch (c) { … … 76 115 } 77 116 } 117 #endif 78 118 if (fname == NULL) 79 119 { … … 89 129 90 130 begin = Wtime(); 131 #ifdef WIN32 132 hFile = CreateFile(fname, 133 GENERIC_READ | GENERIC_WRITE, 134 FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 135 NULL, 136 CREATE_ALWAYS, 137 FILE_ATTRIBUTE_NORMAL, 138 NULL); 139 if (hFile == INVALID_HANDLE_VALUE) 140 { 141 fprintf(stderr, "CreateFile: %d\n", GetLastError()); 142 MPI_Finalize(); 143 exit(1); 144 } 145 #else 91 146 fd = open(fname, open_flags, 0775); 92 147 if (fd < 0) { … … 95 150 exit(1); 96 151 } 152 #endif 97 153 end = Wtime(); 98 154 tdiff += (end - begin); 155 #ifdef WIN32 156 CloseHandle(hFile); 157 #else 99 158 close(fd); 159 #endif 100 160 if (rank == 0 && i < (niters - 1)) 101 161 unlink(fname); 102 162 } 163 164 #ifdef WIN32 165 QueryPerformanceFrequency(&freq); 166 tdiff = tdiff / (double) freq.QuadPart * 1000.0; 167 #endif 103 168 tdiff = tdiff / niters; 104 169 MPI_Allreduce(&tdiff, &max_diff, 1,
