Changeset 1363 for trunk/testcase/1023-maxfilehandles.c
- Timestamp:
- Apr 15, 2004, 12:27:11 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/testcase/1023-maxfilehandles.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1362 r1363 38 38 unsigned msEnd; 39 39 unsigned msStart; 40 unsigned msTotal = 0; 41 unsigned cFiles = 0; 42 unsigned cIncrements = 0; 43 int fStreams; 40 44 PGINFOSEG pGIS = GETGINFOSEG(); 41 45 #define MAX_FHS 10000 42 #ifdef TEST_STREAMS43 46 static FILE *apFiles[MAX_FHS]; 44 #else45 47 static int aiFiles[MAX_FHS]; 46 #endif47 48 48 49 DosSetRelMaxFH(&lFHDelta, &cFHs); 49 50 printf("cFHs=%d\n", cFHs); 51 52 /* check for args */ 53 fStreams = argc >= 2; 50 54 51 55 cFHLast = cFHs; … … 54 58 { 55 59 msStart = pGIS->msecs; 56 #ifdef TEST_STREAMS 57 apFiles[i] = fopen(argv[argc - 1], "rb"); 58 #else 59 aiFiles[i] = open(argv[argc - 1], O_BINARY | O_RDONLY); 60 #endif 60 if (fStreams) 61 apFiles[i] = fopen(argv[argc - 1], "rb"); 62 else 63 aiFiles[i] = open(argv[argc - 1], O_BINARY | O_RDONLY); 61 64 msEnd = pGIS->msecs; 62 #ifdef TEST_STREAMS 63 if (apFiles[i] == NULL) 64 #else 65 if (aiFiles[i] < 0) 66 #endif 65 if (fStreams ? apFiles[i] == NULL : aiFiles[i] < 0) 67 66 { 68 67 printf("error %d!\n", i + 1); … … 77 76 { 78 77 printf("Max FH change %i (fh=%d): %d -> %d (inc: %d ms since last: %d ms)\n", 79 i + 1, 80 #ifdef TEST_STREAMS 81 fileno(apFiles[i]), 82 #else 83 aiFiles[i], 84 #endif 85 cFHLast, cFHs, 86 msEnd - msStart, msStart - msLastInc); 87 msLastInc = msEnd; 78 i + 1, fStreams ? fileno(apFiles[i]) : aiFiles[i], 79 cFHLast, cFHs, msEnd - msStart, msStart - msLastInc); 80 /* stats */ 81 cIncrements++; 82 msTotal += msEnd - msLastInc; 83 msEnd = msLastInc = pGIS->msecs; 88 84 } 89 85 cFHLast = cFHs; 90 86 } 91 87 88 msTotal += msEnd - msLastInc; 89 cFiles = i; 90 92 91 lFHDelta = cFHs = 0; 93 92 DosSetRelMaxFH(&lFHDelta, &cFHs); 94 93 printf("cFHs=%d\n", cFHs); 94 printf("msTotal=%d cIncrements=%d cFiles=%d i.e. %d handles per second\n", 95 msTotal, cIncrements, cFiles, cFiles * 1000 / msTotal); 95 96 96 97 /* … … 98 99 */ 99 100 msStart = pGIS->msecs; 100 for (j = 0; j < i; j++) 101 #ifdef TEST_STREAMS 102 fclose(apFiles[j]); 103 #else 104 close(aiFiles[j]); 105 #endif 101 if (fStreams) 102 { 103 for (j = 0; j < i; j++) 104 fclose(apFiles[j]); 105 } 106 else 107 { 108 for (j = 0; j < i; j++) 109 close(aiFiles[j]); 110 } 106 111 msEnd = pGIS->msecs; 107 112 printf("close of %d files took %d ms\n", j, msEnd - msStart); -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.