Ignore:
Timestamp:
Apr 15, 2004, 12:17:42 AM (21 years ago)
Author:
bird
Message:

...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/testcase/1023-maxfilehandles.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1361 r1362  
    2323#endif
    2424#include <stdio.h>
     25#include <io.h>
     26#include <fcntl.h>
    2527#include <string.h>
    2628
     
    3739    unsigned        msStart;
    3840    PGINFOSEG       pGIS = GETGINFOSEG();
    39 #define MAX_FHS 0x11000
     41#define MAX_FHS 10000
     42#ifdef TEST_STREAMS
    4043    static FILE    *apFiles[MAX_FHS];
     44#else
     45    static int      aiFiles[MAX_FHS];
     46#endif
    4147
    4248    DosSetRelMaxFH(&lFHDelta, &cFHs);
     
    4854    {
    4955        msStart = pGIS->msecs;
     56#ifdef TEST_STREAMS
    5057        apFiles[i] = fopen(argv[argc - 1], "rb");
     58#else
     59        aiFiles[i] = open(argv[argc - 1], O_BINARY | O_RDONLY);
     60#endif
    5161        msEnd = pGIS->msecs;
     62#ifdef TEST_STREAMS
    5263        if (apFiles[i] == NULL)
     64#else
     65        if (aiFiles[i] < 0)
     66#endif
    5367        {
    5468            printf("error %d!\n", i + 1);
     
    6276        if (cFHs != cFHLast)
    6377        {
    64             printf("Max FH change %i (fh=%d): %d -> %d (inc: %d ms  since last: %d ms)\n", i + 1, fileno(apFiles[i]), cFHLast, cFHs,
     78            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,
    6586                   msEnd - msStart, msStart - msLastInc);
    6687            msLastInc = msEnd;
     
    7899    msStart = pGIS->msecs;
    79100    for (j = 0; j < i; j++)
     101#ifdef TEST_STREAMS
    80102        fclose(apFiles[j]);
     103#else
     104        close(aiFiles[j]);
     105#endif
    81106    msEnd = pGIS->msecs;
    82     printf("close of %j files took %d ms\n", j, msEnd - msStart);
     107    printf("close of %d files took %d ms\n", j, msEnd - msStart);
    83108
    84109    /*
Note: See TracChangeset for help on using the changeset viewer.