VirtualBox

Changeset 59826 in vbox for trunk


Ignore:
Timestamp:
Feb 25, 2016 8:59:17 PM (9 years ago)
Author:
vboxsync
Message:

RTZipTarCmd: Added --read-ahead option for testing the read ahead code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/zip/tarcmd.cpp

    r57358 r59826  
    6161#define RTZIPTARCMD_OPT_DIR_MODE_OR_MASK    1008
    6262#define RTZIPTARCMD_OPT_FORMAT              1009
     63#define RTZIPTARCMD_OPT_READ_AHEAD          1010
    6364
    6465/** File format. */
     
    104105     * traditional TAR format). */
    105106    bool            fNoModTime;
     107    /** Whether to add a read ahead thread. */
     108    bool            fReadAhead;
    106109    /** The compressor/decompressor method to employ (0, z or j). */
    107110    char            chZipper;
     
    494497    {
    495498        /*
     499         * Convert source to a stream and optionally add a read ahead stage.
     500         */
     501        RTVFSIOSTREAM hVfsIosSrc = RTVfsObjToIoStream(hVfsObj);
     502        if (pOpts->fReadAhead)
     503        {
     504            RTVFSIOSTREAM hVfsReadAhead;
     505            rc = RTVfsCreateReadAheadForIoStream(hVfsIosSrc, 0 /*fFlag*/, 16 /*cBuffers*/, _256K /*cbBuffer*/, &hVfsReadAhead);
     506            if (RT_SUCCESS(rc))
     507            {
     508                RTVfsIoStrmRelease(hVfsIosSrc);
     509                hVfsIosSrc = hVfsReadAhead;
     510            }
     511            else
     512                AssertRC(rc); /* can be ignored in release builds. */
     513        }
     514
     515        /*
    496516         * Pump the data thru.
    497517         */
    498         RTVFSIOSTREAM hVfsIosSrc = RTVfsObjToIoStream(hVfsObj);
    499518        rc = RTVfsUtilPumpIoStreams(hVfsIosSrc, hVfsIosDst, (uint32_t)RT_MIN(pUnixInfo->cbObject, _1M));
    500519        if (RT_SUCCESS(rc))
     
    641660
    642661    /*
    643      * Set other attributes as requested  .
    644      *                                    .
     662     * Set other attributes as requested.
     663     *
    645664     * Note! File extraction does get here.
    646665     */
     
    931950             "    --dir-mode-and-mask <octal-mode>      (-A, -C, -d, -r, -u, -x)\n"
    932951             "        Include the given access mode for directories.\n"
     952             "    --read-ahead                          (-x)\n"
     953             "        Enabled read ahead thread when extracting files.\n"
    933954             "\n");
    934955    RTPrintf("Standard Options:\n"
     
    9861007        { "--dir-mode-or-mask",     RTZIPTARCMD_OPT_DIR_MODE_OR_MASK,   RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_OCT },
    9871008        { "--format",               RTZIPTARCMD_OPT_FORMAT,             RTGETOPT_REQ_STRING },
     1009        { "--read-ahead",           RTZIPTARCMD_OPT_READ_AHEAD,         RTGETOPT_REQ_NOTHING },
    9881010    };
    9891011
     
    11341156                break;
    11351157
     1158            case RTZIPTARCMD_OPT_READ_AHEAD:
     1159                Opts.fReadAhead = true;
     1160                break;
     1161
    11361162            /* Standard bits. */
    11371163            case 'h':
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette