VirtualBox

Ignore:
Timestamp:
Jan 14, 2019 4:48:55 AM (6 years ago)
Author:
vboxsync
Message:

ValKit/FsPerf: Started on a simple shared folders performance profiler. bugref:9172 [build fix]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/fs/FsPerf.cpp

    r76795 r76796  
    5858 * Always does an even number of iterations.
    5959 */
    60 #define PROFILE_FN(a_fnCall, a_cNsTarget, a_szDesc1, a_szDesc2) \
     60#define PROFILE_FN(a_fnCall, a_cNsTarget, a_szDesc) \
    6161    do { \
    6262        /* Estimate how many iterations we need to fill up the given timeslot: */ \
     
    7878        } \
    7979        uint64_t const cNsElapsed = RTTimeNanoTS() - nsStart; \
    80         if (a_szDesc1 != NULL) \
    81             RTTestIValueF(cNsElapsed, RTTESTUNIT_NS, a_szDesc1, cIterations); \
    82         RTTestIValueF(cNsElapsed / cIterations, RTTESTUNIT_NS_PER_OCCURRENCE, a_szDesc2); \
     80        RTTestIValueF(cNsElapsed / cIterations, RTTESTUNIT_NS_PER_OCCURRENCE, a_szDesc); \
    8381    } while (0)
    8482
     
    416414    RTTESTI_CHECK_RC(RTFileClose(hFile1), VINF_SUCCESS);
    417415
    418     PROFILE_FN(fsPerfOpenExistingOnceReadonly(g_szDir),  g_nsTestRun, NULL, "RTFileOpen/Close/Readonly");
    419     PROFILE_FN(fsPerfOpenExistingOnceWriteonly(g_szDir), g_nsTestRun, NULL, "RTFileOpen/Close/Writeonly");
     416    PROFILE_FN(fsPerfOpenExistingOnceReadonly(g_szDir),  g_nsTestRun, "RTFileOpen/Close/Readonly");
     417    PROFILE_FN(fsPerfOpenExistingOnceWriteonly(g_szDir), g_nsTestRun, "RTFileOpen/Close/Writeonly");
    420418
    421419    /*
     
    425423                                     RTFILE_O_CREATE | RTFILE_O_DENY_NONE | RTFILE_O_WRITE), VINF_SUCCESS);
    426424    RTTESTI_CHECK_RC(RTFileClose(hFile1), VINF_SUCCESS);
    427     PROFILE_FN(fsPerfOpenExistingOnceReadonly(g_szDeepDir),  g_nsTestRun, NULL, "RTFileOpen/Close/deep/readonly");
    428     PROFILE_FN(fsPerfOpenExistingOnceWriteonly(g_szDeepDir), g_nsTestRun, NULL, "RTFileOpen/Close/deep/writeonly");
     425    PROFILE_FN(fsPerfOpenExistingOnceReadonly(g_szDeepDir),  g_nsTestRun, "RTFileOpen/Close/deep/readonly");
     426    PROFILE_FN(fsPerfOpenExistingOnceWriteonly(g_szDeepDir), g_nsTestRun, "RTFileOpen/Close/deep/writeonly");
    429427
    430428    /* Manytree: */
     
    441439                                     RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_NONE | RTFILE_O_WRITE), VINF_SUCCESS);
    442440    RTFSOBJINFO ObjInfo = {0};
    443     PROFILE_FN(RTFileQueryInfo(hFile1, &ObjInfo,  RTFSOBJATTRADD_NOTHING), g_nsTestRun, NULL, "RTFileQueryInfo/NOTHING");
    444     PROFILE_FN(RTFileQueryInfo(hFile1, &ObjInfo,  RTFSOBJATTRADD_UNIX),    g_nsTestRun, NULL, "RTFileQueryInfo/UNIX");
     441    PROFILE_FN(RTFileQueryInfo(hFile1, &ObjInfo,  RTFSOBJATTRADD_NOTHING), g_nsTestRun, "RTFileQueryInfo/NOTHING");
     442    PROFILE_FN(RTFileQueryInfo(hFile1, &ObjInfo,  RTFSOBJATTRADD_UNIX),    g_nsTestRun, "RTFileQueryInfo/UNIX");
    445443
    446444    RTTESTI_CHECK_RC(RTFileClose(hFile1), VINF_SUCCESS);
     
    458456    RTFMODE const fEvenMode = (ObjInfo.Attr.fMode & ~RTFS_UNIX_ALL_ACCESS_PERMS) | RTFS_DOS_READONLY   | 0400;
    459457    RTFMODE const fOddMode  = (ObjInfo.Attr.fMode & ~(RTFS_UNIX_ALL_ACCESS_PERMS | RTFS_DOS_READONLY)) | 0640;
    460     PROFILE_FN(RTFileSetMode(hFile1, iIteration & 1 ? fOddMode : fEvenMode), g_nsTestRun, NULL, "RTFileSetMode");
     458    PROFILE_FN(RTFileSetMode(hFile1, iIteration & 1 ? fOddMode : fEvenMode), g_nsTestRun, "RTFileSetMode");
    461459
    462460    RTFileSetMode(hFile1, ObjInfo.Attr.fMode);
     
    494492
    495493    /* Benchmark it: */
    496     PROFILE_FN(RTFileSetTimes(hFile1, NULL, iIteration & 1 ? &Time1 : &Time2, NULL, NULL), g_nsTestRun, NULL, "RTFileSetTimes");
     494    PROFILE_FN(RTFileSetTimes(hFile1, NULL, iIteration & 1 ? &Time1 : &Time2, NULL, NULL), g_nsTestRun, "RTFileSetTimes");
    497495
    498496    RTTESTI_CHECK_RC(RTFileClose(hFile1), VINF_SUCCESS);
     
    518516
    519517    PROFILE_FN(RTPathQueryInfoEx(g_szDir, &ObjInfo,  RTFSOBJATTRADD_NOTHING,  RTPATH_F_ON_LINK), g_nsTestRun,
    520                NULL, "RTPathQueryInfoEx/NOTHING");
     518               "RTPathQueryInfoEx/NOTHING");
    521519    PROFILE_FN(RTPathQueryInfoEx(g_szDir, &ObjInfo,  RTFSOBJATTRADD_UNIX,     RTPATH_F_ON_LINK), g_nsTestRun,
    522                NULL, "RTPathQueryInfoEx/UNIX");
     520               "RTPathQueryInfoEx/UNIX");
    523521
    524522
     
    529527
    530528    PROFILE_FN(RTPathQueryInfoEx(g_szDeepDir, &ObjInfo,  RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK), g_nsTestRun,
    531                NULL, "RTPathQueryInfoEx/deep/NOTHING");
     529               "RTPathQueryInfoEx/deep/NOTHING");
    532530    PROFILE_FN(RTPathQueryInfoEx(g_szDeepDir, &ObjInfo,  RTFSOBJATTRADD_UNIX, RTPATH_F_ON_LINK), g_nsTestRun,
    533                NULL, "RTPathQueryInfoEx/deep/UNIX");
     531               "RTPathQueryInfoEx/deep/UNIX");
    534532
    535533    /* Manytree: */
     
    562560    RTFMODE const fEvenMode = (ObjInfo.Attr.fMode & ~RTFS_UNIX_ALL_ACCESS_PERMS) | RTFS_DOS_READONLY   | 0400;
    563561    RTFMODE const fOddMode  = (ObjInfo.Attr.fMode & ~(RTFS_UNIX_ALL_ACCESS_PERMS | RTFS_DOS_READONLY)) | 0640;
    564     PROFILE_FN(RTPathSetMode(g_szDir, iIteration & 1 ? fOddMode : fEvenMode), g_nsTestRun, NULL, "RTPathSetMode");
     562    PROFILE_FN(RTPathSetMode(g_szDir, iIteration & 1 ? fOddMode : fEvenMode), g_nsTestRun, "RTPathSetMode");
    565563    RTPathSetMode(g_szDir, ObjInfo.Attr.fMode);
    566564
     
    570568    RTTESTI_CHECK_RC(RTFileClose(hFile1), VINF_SUCCESS);
    571569
    572     PROFILE_FN(RTPathSetMode(g_szDeepDir, iIteration & 1 ? fOddMode : fEvenMode), g_nsTestRun, NULL, "RTPathSetMode/deep");
     570    PROFILE_FN(RTPathSetMode(g_szDeepDir, iIteration & 1 ? fOddMode : fEvenMode), g_nsTestRun, "RTPathSetMode/deep");
    573571    RTPathSetMode(g_szDeepDir, ObjInfo.Attr.fMode);
    574572
     
    623621    PROFILE_FN(RTPathSetTimesEx(g_szDir, iIteration & 1 ? &Time1 : &Time2, iIteration & 1 ? &Time2 : &Time1,
    624622                                NULL, NULL, RTPATH_F_ON_LINK),
    625                g_nsTestRun, NULL, "RTPathSetTimesEx");
     623               g_nsTestRun, "RTPathSetTimesEx");
    626624
    627625    /* Deep: */
     
    632630    PROFILE_FN(RTPathSetTimesEx(g_szDeepDir, iIteration & 1 ? &Time1 : &Time2, iIteration & 1 ? &Time2 : &Time1,
    633631                                NULL, NULL, RTPATH_F_ON_LINK),
    634                g_nsTestRun, NULL, "RTPathSetTimesEx/deep");
     632               g_nsTestRun, "RTPathSetTimesEx/deep");
    635633
    636634    /* Manytree: */
     
    674672    /* Shallow: */
    675673    strcat(strcpy(szPath, g_szDir), "-other");
    676     PROFILE_FN(RTPathRename(iIteration & 1 ? szPath : g_szDir, iIteration & 1 ? g_szDir : szPath, 0),
    677                g_nsTestRun, NULL, "RTPathRename");
     674    PROFILE_FN(RTPathRename(iIteration & 1 ? szPath : g_szDir, iIteration & 1 ? g_szDir : szPath, 0), g_nsTestRun, "RTPathRename");
    678675
    679676    /* Deep: */
     
    684681    strcat(strcpy(szPath, g_szDeepDir), "-other");
    685682    PROFILE_FN(RTPathRename(iIteration & 1 ? szPath : g_szDeepDir, iIteration & 1 ? g_szDeepDir : szPath, 0),
    686                g_nsTestRun, NULL, "RTPathRename/deep");
     683               g_nsTestRun, "RTPathRename/deep");
    687684
    688685    /* Manytree: */
     
    817814     * Profile.
    818815     */
    819     PROFILE_FN(fsPerfEnumEmpty(), g_nsTestRun, NULL, "RTDirOpen/Read/Close empty");
    820     PROFILE_FN(fsPerfEnumManyFiles(), g_nsTestRun, NULL, "RTDirOpen/Read/Close manyfiles");
    821 
     816    PROFILE_FN(fsPerfEnumEmpty(), g_nsTestRun, "RTDirOpen/Read/Close empty");
     817    PROFILE_FN(fsPerfEnumManyFiles(), g_nsTestRun, "RTDirOpen/Read/Close manyfiles");
    822818}
    823819
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