Changeset 76801 in vbox for trunk/src/VBox/ValidationKit/utils
- Timestamp:
- Jan 14, 2019 7:18:24 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/fs/FsPerf.cpp
r76796 r76801 87 87 * Always does an even number of tree iterations. 88 88 */ 89 #define PROFILE_MANYTREE_FN(a_szPath, a_fnCall, a_cEstimationIterations, a_cNsTarget, a_szDesc 1, a_szDesc2) \89 #define PROFILE_MANYTREE_FN(a_szPath, a_fnCall, a_cEstimationIterations, a_cNsTarget, a_szDesc) \ 90 90 do { \ 91 91 /* Estimate how many iterations we need to fill up the given timeslot: */ \ … … 124 124 } \ 125 125 uint64_t const cNsElapsed = RTTimeNanoTS() - nsStart; \ 126 if (a_szDesc1 != NULL) \ 127 RTTestIValueF(cNsElapsed, RTTESTUNIT_NS, a_szDesc1, cCalls); \ 128 RTTestIValueF(cNsElapsed / cCalls, RTTESTUNIT_NS_PER_OCCURRENCE, a_szDesc2); \ 126 RTTestIValueF(cNsElapsed / cCalls, RTTESTUNIT_NS_PER_OCCURRENCE, a_szDesc); \ 129 127 } while (0) 130 128 … … 428 426 /* Manytree: */ 429 427 char szPath[RTPATH_MAX]; 430 PROFILE_MANYTREE_FN(szPath, fsPerfOpenExistingOnceReadonly(szPath), 1, g_nsTestRun, NULL,"RTFileOpen/Close/manytree/readonly");428 PROFILE_MANYTREE_FN(szPath, fsPerfOpenExistingOnceReadonly(szPath), 1, g_nsTestRun, "RTFileOpen/Close/manytree/readonly"); 431 429 } 432 430 … … 534 532 char szPath[RTPATH_MAX]; 535 533 PROFILE_MANYTREE_FN(szPath, RTPathQueryInfoEx(szPath, &ObjInfo, RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK), 536 1, g_nsTestRun, NULL,"RTPathQueryInfoEx/manytree/NOTHING");534 1, g_nsTestRun, "RTPathQueryInfoEx/manytree/NOTHING"); 537 535 PROFILE_MANYTREE_FN(szPath, RTPathQueryInfoEx(szPath, &ObjInfo, RTFSOBJATTRADD_UNIX, RTPATH_F_ON_LINK), 538 1, g_nsTestRun, NULL,"RTPathQueryInfoEx/manytree/UNIX");536 1, g_nsTestRun, "RTPathQueryInfoEx/manytree/UNIX"); 539 537 } 540 538 … … 574 572 char szPath[RTPATH_MAX]; 575 573 PROFILE_MANYTREE_FN(szPath, RTPathSetMode(szPath, iIteration & 1 ? fOddMode : fEvenMode), 1, g_nsTestRun, 576 NULL,"RTPathSetMode/manytree");574 "RTPathSetMode/manytree"); 577 575 DO_MANYTREE_FN(szPath, RTPathSetMode(szPath, ObjInfo.Attr.fMode)); 578 576 } … … 636 634 PROFILE_MANYTREE_FN(szPath, RTPathSetTimesEx(szPath, iIteration & 1 ? &Time1 : &Time2, iIteration & 1 ? &Time2 : &Time1, 637 635 NULL, NULL, RTPATH_F_ON_LINK), 638 1, g_nsTestRun, NULL,"RTPathSetTimesEx/manytree");636 1, g_nsTestRun, "RTPathSetTimesEx/manytree"); 639 637 } 640 638 … … 684 682 685 683 /* Manytree: */ 686 PROFILE_MANYTREE_FN(szPath, fsPerfRenameMany(szPath, iIteration), 2, g_nsTestRun, NULL,"RTPathRename/manytree");684 PROFILE_MANYTREE_FN(szPath, fsPerfRenameMany(szPath, iIteration), 2, g_nsTestRun, "RTPathRename/manytree"); 687 685 } 688 686 … … 814 812 * Profile. 815 813 */ 816 PROFILE_FN(fsPerfEnumEmpty(), g_nsTestRun, "RTDirOpen/Read/Close empty");814 PROFILE_FN(fsPerfEnumEmpty(), g_nsTestRun, "RTDirOpen/Read/Close empty"); 817 815 PROFILE_FN(fsPerfEnumManyFiles(), g_nsTestRun, "RTDirOpen/Read/Close manyfiles"); 818 816 } 819 817 820 818 819 void fsPerfMkDirRmDir(void) 820 { 821 RTTestISub("mkdir/rmdir"); 822 823 /* Non-existing directories: */ 824 RTTESTI_CHECK_RC(RTDirRemove(InEmptyDir(RT_STR_TUPLE("no-such-dir"))), VERR_FILE_NOT_FOUND); 825 RTTESTI_CHECK_RC(RTDirRemove(InEmptyDir(RT_STR_TUPLE("no-such-dir" RTPATH_SLASH_STR "no-such-file"))), VERR_PATH_NOT_FOUND); 826 RTTESTI_CHECK_RC(RTDirCreate(InEmptyDir(RT_STR_TUPLE("no-such-dir" RTPATH_SLASH_STR "no-such-file")), 0755, 0), VERR_PATH_NOT_FOUND); 827 828 /* Already existing directories and files: */ 829 RTTESTI_CHECK_RC(RTDirCreate(InEmptyDir(RT_STR_TUPLE(".")), 0755, 0), VERR_ALREADY_EXISTS); 830 RTTESTI_CHECK_RC(RTDirCreate(InEmptyDir(RT_STR_TUPLE("..")), 0755, 0), VERR_ALREADY_EXISTS); 831 832 /* Remove directory with subdirectories: */ 833 RTTESTI_CHECK_RC(RTDirRemove(InDir(RT_STR_TUPLE("."))), VERR_DIR_NOT_EMPTY); 834 835 /* Create a directory and remove it: */ 836 RTTESTI_CHECK_RC(RTDirCreate(InDir(RT_STR_TUPLE("subdir-1")), 0755, 0), VINF_SUCCESS); 837 RTTESTI_CHECK_RC(RTDirRemove(g_szDir), VINF_SUCCESS); 838 839 /* Create a file and try remove it or create a directory with the same name: */ 840 RTFILE hFile1; 841 RTTESTI_CHECK_RC_RETV(RTFileOpen(&hFile1, InDir(RT_STR_TUPLE("file18")), 842 RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_NONE | RTFILE_O_WRITE), VINF_SUCCESS); 843 RTTESTI_CHECK_RC(RTFileClose(hFile1), VINF_SUCCESS); 844 RTTESTI_CHECK_RC(RTDirRemove(g_szDir), VERR_NOT_A_DIRECTORY); 845 RTTESTI_CHECK_RC(RTDirCreate(g_szDir, 0755, 0), VERR_ALREADY_EXISTS); 846 RTTESTI_CHECK_RC(RTDirCreate(InDir(RT_STR_TUPLE("file18" RTPATH_SLASH_STR "subdir")), 0755, 0), VERR_PATH_NOT_FOUND); 847 848 849 /* 850 * Profile alternately creating and removing a bunch of directories. 851 */ 852 for (;;) 853 { 854 /* Create a bunch: */ 855 856 /* Remove the bunch: */ 857 858 /* Check if we got time for another round: */ 859 break; 860 } 861 } 862 863 821 864 void fsPerfRm(void) 822 865 { 823 866 RTTestISub("rm"); 824 867 868 /* Non-existing files. */ 825 869 RTTESTI_CHECK_RC(RTFileDelete(InEmptyDir(RT_STR_TUPLE("no-such-file"))), VERR_FILE_NOT_FOUND); 826 870 RTTESTI_CHECK_RC(RTFileDelete(InEmptyDir(RT_STR_TUPLE("no-such-dir" RTPATH_SLASH_STR "no-such-file"))), VERR_PATH_NOT_FOUND); 871 872 /* Directories: */ 873 #ifdef RT_OS_WINDOWS 874 RTTESTI_CHECK_RC(RTFileDelete(InEmptyDir(RT_STR_TUPLE("."))), VERR_ACCESS_DENIED); 875 #else 876 RTTESTI_CHECK_RC(RTFileDelete(InEmptyDir(RT_STR_TUPLE("."))), VERR_IS_A_DIRECTORY); 877 #endif 827 878 828 879 /* Shallow: */ … … 1010 1061 if (RT_SUCCESS(rc)) 1011 1062 { 1063 //g_fManyFiles = false; 1064 1012 1065 /* Do tests: */ 1013 1066 if (g_fManyFiles) … … 1023 1076 fsPerfRename(); 1024 1077 vsPerfDirEnum(); 1025 /// @todo fsPerfMkDir 1026 /// @todo fsPerfRmDir1078 #endif 1079 fsPerfMkDirRmDir(); 1027 1080 /// @todo fsPerfRead 1028 1081 /// @todo fsPerfWrite 1029 1082 /// @todo fsPerfSeek 1030 1083 /// @todo fsPerfChSize 1031 #endif1032 1084 fsPerfRm(); /* must come last as it deletes manyfiles and manytree */ 1033 1085 }
Note:
See TracChangeset
for help on using the changeset viewer.