Changeset 1361


Ignore:
Timestamp:
Apr 14, 2004, 10:01:47 PM (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.1 to 1.2
    r1360 r1361  
    2929int main(int argc, const char **argv)
    3030{
    31     int             i;
     31    int             i,j;
    3232    LONG            lFHDelta = 0;
    3333    ULONG           cFHs = 0;
    3434    ULONG           cFHLast;
    3535    unsigned        msLastInc;
     36    unsigned        msEnd;
     37    unsigned        msStart;
    3638    PGINFOSEG       pGIS = GETGINFOSEG();
    37 #define MAX_FHS 32768
     39#define MAX_FHS 0x11000
    3840    static FILE    *apFiles[MAX_FHS];
    3941
     
    4547    for (i = 0; i < MAX_FHS; i++)
    4648    {
    47         unsigned    msEnd;
    48         unsigned    msStart = pGIS->msecs;
    49         apFiles[i] = fopen("\\dev\\nul", "rb");
     49        msStart = pGIS->msecs;
     50        apFiles[i] = fopen(argv[argc - 1], "rb");
    5051        msEnd = pGIS->msecs;
    5152        if (apFiles[i] == NULL)
     
    6162        if (cFHs != cFHLast)
    6263        {
    63             printf("Max FH change %i: %d -> %d (inc: %d ms  since last: %d ms)\n", i + 1, cFHLast, cFHs,
     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,
    6465                   msEnd - msStart, msStart - msLastInc);
    6566            msLastInc = msEnd;
     
    7172    DosSetRelMaxFH(&lFHDelta, &cFHs);
    7273    printf("cFHs=%d\n", cFHs);
     74
     75    /*
     76     * Free the files.
     77     */
     78    msStart = pGIS->msecs;
     79    for (j = 0; j < i; j++)
     80        fclose(apFiles[j]);
     81    msEnd = pGIS->msecs;
     82    printf("close of %j files took %d ms\n", j, msEnd - msStart);
     83
     84    /*
     85     * Report the result.
     86     */
    7387    if (i < 9900)
    7488    {
Note: See TracChangeset for help on using the changeset viewer.