First public contribution.
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32test\bench\t_fsrdirscan.cpp
21 #include "..\server\t_server.h"
22 #include "t_benchmain.h"
24 GLDEF_D RTest test(_L("File Server Benchmarks, DirScan"));
26 //----------------------------------------------------------------------------------------------
27 //! @SYMTestCaseID PBASE-T_FSRDIRSCAN-0274
30 //! @SYMTestCaseDesc This test case is measuring performance of the FAT implementation.
31 //! @SYMTestActions 0. Expects the files to exist in order to successful execution
32 //! 1. Time finding an entry in each directory with TFindFile
33 //! 2. Time finding an entry in each directory with RFile::Open
34 //! 3. Time finding an entry in each directory with TFindFile with multiple
35 //! clients accessing the directory
36 //! 4. Time finding an entry in each directory with RFile::Open with multiple
37 //! clients accessing the directory
38 //! 5. Time finding an entry in each directory with TFindFile with multiple
39 //! clients accessing different directories
40 //! 6. Time finding an entry in each directory with RFile::Open with multiple
41 //! clients accessing different directories
42 //! 7. Time finding *.txt entries in each directory with TFindFile::FindWildByPath()
43 //! 8. Time finding *.txt entries in each directory with TFindFile::FindWildByPath()
44 //! and different clients accessing the same directory
45 //! 9. Time finding *.txt entries in each directory with TFindFile::FindWildByPath()
46 //! and different clients accessing different directories
47 //! 10. Time finding ffff*.txt entries in each directory with TFindFile::FindWildByPath()
48 //! 11. Time finding ffff*.txt entries in each directory with TFindFile::FindWildByPath()
49 //! and different clients accessing the same directory
50 //! 12. Time finding ffff*.txt entries in each directory with TFindFile::FindWildByPath()
51 //! and different clients accessing different directories
52 //! 13. Time finding last.* entry in each directory with TFindFile::FindWildByPath()
53 //! 14. Time finding last.* entry in each directory with TFindFile::FindWildByPath()
54 //! and different clients accessing the same directory
55 //! 15. Time finding last.* entry in each directory with TFindFile::FindWildByPath()
56 //! and different clients accessing different directories
58 //! @SYMTestExpectedResults Finishes if the system behaves as expected, panics otherwise
59 //! @SYMTestPriority High
60 //! @SYMTestStatus Implemented
61 //----------------------------------------------------------------------------------------------
63 LOCAL_D RSemaphore client;
64 LOCAL_D const TInt KHeapSize = 0x4000;
65 LOCAL_D TBuf8<4096> buf;
67 LOCAL_D TDriveList gDriveList;
69 LOCAL_D TFileName gFindEntryDir;
70 LOCAL_D TBuf<100> gFindDir;
72 LOCAL_D TFileName gFindEntryDir2;
73 LOCAL_D TBuf<100> gFindDir2;
80 _LIT(KDirMultipleName2, "dir%d_%d\\");
82 /** Find entry in directory
85 LOCAL_C TInt FindEntryAccess2(TAny*)
88 TInt r = fs.Connect();
89 RTest test(_L("test 2"));
91 fs.SetSessionPath(gSessionPath);
98 r = fs.Entry(gFindEntryDir2, entry);
100 r = fs.Entry(gFindDir2,entry);
105 /** Starts a concurrent client session
107 @param aFunction Thread to be started twice
109 LOCAL_C void DoTest(TThreadFunction aFunction)
111 TBuf<20> buf = _L("Speedy");
112 buf.AppendNum(ThreadCount++);
113 TInt r = gSpeedy.Create(buf, aFunction, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
117 buf.AppendNum(ThreadCount++);
118 r = gSpeedyII.Create(buf, aFunction, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
121 gSpeedy.SetPriority(EPriorityLess);
122 gSpeedyII.SetPriority(EPriorityLess);
131 /** Starts a concurrent client session in different directories
133 @param aFunction Thread to be started
135 LOCAL_C void DoTest2(TThreadFunction aFunction)
137 TBuf<20> buf = _L("Speedy");
138 buf.AppendNum(ThreadCount++);
139 TInt r = gSpeedy.Create(buf, aFunction, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
143 buf.AppendNum(ThreadCount++);
144 r = gSpeedyII.Create(buf, FindEntryAccess2, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
147 gSpeedy.SetPriority(EPriorityLess);
148 gSpeedyII.SetPriority(EPriorityLess);
157 /** Kills the concurrent session
160 LOCAL_C void DoTestKill()
164 gSpeedy.Kill(KErrNone);
168 gSpeedyII.Kill(KErrNone);
173 /** Find entry in directory
176 LOCAL_C TInt FindEntryAccess(TAny*)
179 TInt r = fs.Connect();
180 RTest test(_L("test 2"));
182 r = fs.SetSessionPath(gSessionPath);
190 r = fs.Entry(gFindEntryDir,entry);
193 r = fs.Entry(gFindDir,entry);
198 /** Find last.txt with TFindFile and with two threads accessing the current directory
199 and looking for the same file
201 @param aN Number of files in the directory
202 @param aStep Test step
204 LOCAL_C void FindFileM1(TInt aN, TInt aStep)
213 TFindFile find(TheFs);
216 TTimeIntervalMicroSeconds timeTaken(0);
217 TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
219 if(aN <= gFilesLimit)
225 dirtemp.Format(KDirMultipleName2, 1, aN);
226 dir1.Append(dirtemp);
229 dirtemp.Format(KDirMultipleName2, 2, aN);
230 dir2.Append(dirtemp);
232 dirtemp.Format(KDirMultipleName2, 3, aN);
233 dir3.Append(dirtemp);
235 dir1.Append(KCommonFile);
236 dir2.Append(KCommonFile);
237 dir3.Append(KCommonFile);
242 gFindEntryDir = dir1;
243 DoTest(FindEntryAccess);
245 dir4.Format(KDirMultipleName, 1, aN);
246 startTime.HomeTime();
248 r = find.FindByPath(dir1, &dir4);
254 timeTaken = endTime.MicroSecondsFrom(startTime);
255 timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
261 dirtemp.Format(KDirMultipleName, 2, aN);
262 dir4.Append(dirtemp);
264 gFindEntryDir = dir2;
266 DoTest(FindEntryAccess);
268 startTime.HomeTime();
270 r = find.FindByPath(dir2, &dir4);
274 timeTaken = endTime.MicroSecondsFrom(startTime);
276 timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
282 dirtemp.Format(KDirMultipleName, 3, aN);
283 dir4.Append(dirtemp);
286 gFindEntryDir = dir3;
288 DoTest(FindEntryAccess);
290 startTime.HomeTime();
292 r = find.FindByPath(dir3, &dir4);
298 timeTaken = endTime.MicroSecondsFrom(startTime);
299 timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
303 PrintResult(aStep, 1, aN);
304 PrintResultTime(aStep, 2, timeTaken1);
305 PrintResultTime(aStep, 3, timeTaken2);
306 PrintResultTime(aStep, 4, timeTaken3);
309 /** Find last.txt by opening it and with two threads accessing the current directory
310 and looking for the same file
312 @param aN Number of files in the directory
313 @param aStep Test step
315 LOCAL_C void FindFileM2(TInt aN, TInt aStep)
326 TTimeIntervalMicroSeconds timeTaken(0);
328 TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
330 if(aN <= gFilesLimit)
336 dirtemp.Format(KDirMultipleName2, 1, aN);
337 dir1.Append(dirtemp);
340 dirtemp.Format(KDirMultipleName2, 2, aN);
341 dir2.Append(dirtemp);
343 dirtemp.Format(KDirMultipleName2, 3, aN);
344 dir3.Append(dirtemp);
346 dir1.Append(KCommonFile);
350 gFindEntryDir = dir1;
351 DoTest(FindEntryAccess);
355 startTime.HomeTime();
357 r = file.Open(TheFs,dir1,EFileShareAny|EFileWrite);
362 timeTaken = endTime.MicroSecondsFrom(startTime);
366 timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
372 dir2.Append(KCommonFile);
373 gFindEntryDir = dir2;
375 DoTest(FindEntryAccess);
379 startTime.HomeTime();
381 r = file.Open(TheFs, dir2, EFileShareAny|EFileWrite);
386 timeTaken = endTime.MicroSecondsFrom(startTime);
390 timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
396 dir3.Append(KCommonFile);
397 gFindEntryDir = dir3;
399 DoTest(FindEntryAccess);
403 startTime.HomeTime();
405 r = file.Open(TheFs, dir3, EFileShareAny|EFileWrite);
409 timeTaken = endTime.MicroSecondsFrom(startTime);
412 timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
417 PrintResult(aStep, 1, aN);
418 PrintResultTime(aStep, 2, timeTaken1);
419 PrintResultTime(aStep, 3, timeTaken2);
420 PrintResultTime(aStep, 4, timeTaken3);
423 /** Find last.txt with TFindFile and without any other process
425 @param aN Number of files in the directory
426 @param aStep Test step
428 LOCAL_C void FindFile1(TInt aN, TInt aStep)
437 TFindFile find(TheFs);
440 TTimeIntervalMicroSeconds timeTaken(0);
441 TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
443 if(aN <= gFilesLimit)
449 dirtemp.Format(KDirMultipleName2, 1, aN);
450 dir1.Append(dirtemp);
452 dirtemp.Format(KDirMultipleName2, 2, aN);
453 dir2.Append(dirtemp);
455 dirtemp.Format(KDirMultipleName2, 3, aN);
456 dir3.Append(dirtemp);
458 dir1.Append(KCommonFile);
459 dir2.Append(KCommonFile);
460 dir3.Append(KCommonFile);
462 r = TheFs.SetSessionPath(gSessionPath);
467 dir4.Format(KDirMultipleName, 1, aN);
469 startTime.HomeTime();
471 r = find.FindByPath(dir1, &dir4);
476 timeTaken = endTime.MicroSecondsFrom(startTime);
477 timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
482 dir4.Format(KDirMultipleName, 2, aN);
484 startTime.HomeTime();
486 r = find.FindByPath(dir2, &dir4);
491 timeTaken = endTime.MicroSecondsFrom(startTime);
492 timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
497 dir4.Format(KDirMultipleName, 3, aN);
499 startTime.HomeTime();
501 r = find.FindByPath(dir3, &dir4);
506 timeTaken = endTime.MicroSecondsFrom(startTime);
507 timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
511 PrintResult(aStep, 1, aN);
512 PrintResultTime(aStep, 2, timeTaken1);
513 PrintResultTime(aStep, 3, timeTaken2);
514 PrintResultTime(aStep, 4, timeTaken3);
517 /** Find last.txt by opening it and without any other process
519 @param aN Number of files in the directory
520 @param aStep Test step
522 LOCAL_C void FindFile2(TInt aN, TInt aStep)
533 TTimeIntervalMicroSeconds timeTaken(0);
534 TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
538 if(aN <= gFilesLimit)
544 dirtemp.Format(KDirMultipleName2, 1, aN);
545 dir1.Append(dirtemp);
547 dirtemp.Format(KDirMultipleName2, 2, aN);
548 dir2.Append(dirtemp);
550 dirtemp.Format(KDirMultipleName2, 3, aN);
551 dir3.Append(dirtemp);
553 dir1.Append(KCommonFile);
554 dir2.Append(KCommonFile);
555 dir3.Append(KCommonFile);
557 r = TheFs.SetSessionPath(gSessionPath);
562 startTime.HomeTime();
564 r = file.Open(TheFs,dir1,EFileShareAny|EFileWrite);
569 timeTaken = endTime.MicroSecondsFrom(startTime);
570 timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
576 startTime.HomeTime();
578 r = file.Open(TheFs, dir2, EFileShareAny|EFileWrite);
582 timeTaken = endTime.MicroSecondsFrom(startTime);
585 timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
590 startTime.HomeTime();
592 r = file.Open(TheFs, dir3, EFileShareAny|EFileWrite);
597 timeTaken = endTime.MicroSecondsFrom(startTime);
598 timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
603 PrintResult(aStep, 1, aN);
604 PrintResultTime(aStep, 2, timeTaken1);
605 PrintResultTime(aStep, 3, timeTaken2);
606 PrintResultTime(aStep, 4, timeTaken3);
609 /** Find last.txt with TFindFile and with two threads accessing the 2 directories
611 @param aN Number of files in the directory
612 @param aStep Test step
614 LOCAL_C void FindFileMD1(TInt aN, TInt aStep)
623 TFindFile find(TheFs);
626 TTimeIntervalMicroSeconds timeTaken(0);
627 TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
629 if(aN <= gFilesLimit)
635 dirtemp.Format(KDirMultipleName2, 1, aN);
636 dir1.Append(dirtemp);
638 dirtemp.Format(KDirMultipleName, 2, aN);
639 dir2.Append(dirtemp);
641 dirtemp.Format(KDirMultipleName, 3, aN);
642 dir3.Append(dirtemp);
645 dirtemp.Format(KDirMultipleName, 3, 300);
647 dir4.Append(dirtemp);
652 dir1.Append(KCommonFile);
653 dir2.Append(KCommonFile);
654 dir3.Append(KCommonFile);
655 dir4.Append(KCommonFile);
657 gFindEntryDir = dir1;
658 gFindEntryDir2 = dir4;
661 TheFs.SetSessionPath(gSessionPath);
663 dir4.Format(KDirMultipleName, 1, aN);
667 DoTest2(FindEntryAccess);
669 startTime.HomeTime();
670 r = find.FindByPath(dir1, &dir4);
676 timeTaken = endTime.MicroSecondsFrom(startTime);
677 timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
683 dirtemp.Format(KDirMultipleName, 2, aN);
684 dir4.Append(dirtemp);
688 DoTest2(FindEntryAccess);
689 dir4.Format(KDirMultipleName, 2, aN);
691 startTime.HomeTime();
693 r = find.FindByPath(dir2,&dir4);
696 timeTaken=endTime.MicroSecondsFrom(startTime);
698 timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
704 dirtemp.Format(KDirMultipleName, 3, aN);
705 dir4.Append(dirtemp);
710 DoTest2(FindEntryAccess);
711 dir4.Format(KDirMultipleName, 3, aN);
713 startTime.HomeTime();
715 r=find.FindByPath(dir3,&dir4);
721 timeTaken=endTime.MicroSecondsFrom(startTime);
722 timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
726 PrintResult(aStep, 1, aN);
727 PrintResultTime(aStep, 2, timeTaken1);
728 PrintResultTime(aStep, 3, timeTaken2);
729 PrintResultTime(aStep, 4, timeTaken3);
733 /** Find last.txt by opening the file and with two threads accessing the current
734 directory and other one
736 @param aN Number of files in the directory
737 @param aStep Test step
739 LOCAL_C void FindFileMD2(TInt aN, TInt aStep)
751 TTimeIntervalMicroSeconds timeTaken(0);
752 TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
756 if(aN <= gFilesLimit)
762 dirtemp.Format(KDirMultipleName2, 1, aN);
763 dir1.Append(dirtemp);
766 dirtemp.Format(KDirMultipleName2, 2, aN);
767 dir2.Append(dirtemp);
769 dirtemp.Format(KDirMultipleName2, 3, aN);
770 dir3.Append(dirtemp);
772 dir1.Append(KCommonFile);
773 gFindEntryDir = dir1;
776 dirtemp.Format(KDirMultipleName, 3, 300);
777 dir4.Append(dirtemp);
783 dir4.Append(KCommonFile);
784 gFindEntryDir2 = dir4;
786 DoTest2(FindEntryAccess);
790 startTime.HomeTime();
792 r = file.Open(TheFs,dir1,EFileShareAny|EFileWrite);
797 timeTaken = endTime.MicroSecondsFrom(startTime);
801 timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
807 dir2.Append(KCommonFile);
808 gFindEntryDir = dir2;
809 DoTest2(FindEntryAccess);
812 startTime.HomeTime();
814 r = file.Open(TheFs, dir2, EFileShareAny|EFileWrite);
818 timeTaken = endTime.MicroSecondsFrom(startTime);
822 timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
828 dir3.Append(KCommonFile);
829 gFindEntryDir = dir3;
830 DoTest2(FindEntryAccess);
833 startTime.HomeTime();
835 r = file.Open(TheFs, dir3, EFileShareAny|EFileWrite);
839 timeTaken=endTime.MicroSecondsFrom(startTime);
842 timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
847 PrintResult(aStep, 1, aN);
848 PrintResultTime(aStep, 2, timeTaken1);
849 PrintResultTime(aStep, 3, timeTaken2);
850 PrintResultTime(aStep, 4, timeTaken3);
853 /** The test finds an entry in each directory
854 Precondition: the drive is already filled with the right files
856 @param aSelector Configuration in case of manual execution
858 LOCAL_C TInt TestFindEntry(TAny* aSelector)
866 test.Printf(_L("#~TS_Title_%d,%d: Find entry last.txt, TFindFile\n"), gTestHarness, gTestCase);
869 while(i <= KMaxFiles)
871 if(i == 100 || i == 1000 || i == 5000 || i == 10000)
872 FindFile1(i, testStep++);
877 test.Printf(_L("#~TS_Title_%d,%d: Find entry last.txt, RFile::Open \n"), gTestHarness, gTestCase);
881 while(i <= KMaxFiles)
883 if(i == 100 || i == 1000 || i == 5000 || i == 10000)
884 FindFile2(i, testStep++);
892 /** The test finds an entry in each directory with multiple clients accessing the same directory
893 Precondition: the drive is already filled with the right files
895 @param aSelector Configuration in case of manual execution
897 LOCAL_C TInt TestFindEntryMultipleClients(TAny* aSelector)
904 test.Printf(_L("#~TS_Title_%d,%d: Find entry mult clients accessing same directory, TFindFile\n"), gTestHarness, gTestCase);
908 while(i <= KMaxFiles)
910 if(i == 100 || i==1000 || i==5000 || i==10000)
911 FindFileM1(i, testStep++);
916 test.Printf(_L("#~TS_Title_%d,%d: Find entry mult clients accessing same directory, RFile::Open \n"), gTestHarness, gTestCase);
920 while(i <= KMaxFiles)
922 if(i == 100 || i == 1000 || i == 5000 || i == 10000)
923 FindFileM2(i, testStep++);
931 /** The test finds an entry in each directory with multiple clients accessing different directories
932 Precondition: the drive is already filled with the right files
934 @param aSelector Configuration in case of manual execution
936 LOCAL_C TInt TestFindEntryMultipleClientsDD(TAny* aSelector)
943 test.Printf(_L("#~TS_Title_%d,%d: Find entry mult clients accessing dif directory, TFindFile\n"), gTestHarness, gTestCase);
947 while(i <= KMaxFiles)
949 if(i == 100 || i == 1000 || i == 5000 || i == 10000)
950 FindFileMD1(i, testStep++);
955 test.Printf(_L("#~TS_Title_%d,%d: Find entry mult clients accessing dir directory, RFile::Open \n"), gTestHarness, gTestCase);
959 while(i <= KMaxFiles)
961 if(i == 100 || i == 1000 || i == 5000 || i == 10000)
962 FindFileMD2(i, testStep++);
970 /** Find last.txt with TFindFile and with two threads accessing the 2 directories
972 @param aN Number of files in the directory
973 @param aWild Wildcard string to be used in the search
974 @param aStep Test step
976 LOCAL_C void FindFileWild1(TInt aN, const TDesC& aWild, TInt aStep)
986 TFindFile find(TheFs);
990 TTimeIntervalMicroSeconds timeTaken(0);
991 TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
993 if(aN <= gFilesLimit)
999 dir4.Format(KDirMultipleName2, 1, aN);
1002 dir4.Format(KDirMultipleName2, 2, aN);
1005 dir4.Format(KDirMultipleName2, 3, aN);
1010 dir4.Format(KDirMultipleName, 1, aN);
1011 startTime.HomeTime();
1013 r = find.FindWildByPath(aWild, &dir1, dir);
1018 timeTaken = endTime.MicroSecondsFrom(startTime);
1019 timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
1025 startTime.HomeTime();
1027 r = find.FindWildByPath(_L("*.txt"), &dir2, dir);
1031 timeTaken = endTime.MicroSecondsFrom(startTime);
1033 timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
1039 startTime.HomeTime();
1041 r = find.FindWildByPath(_L("*.txt"), &dir3, dir);
1045 timeTaken=endTime.MicroSecondsFrom(startTime);
1046 timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
1051 PrintResult(aStep, 1, aN);
1052 PrintResultTime(aStep, 2, timeTaken1);
1053 PrintResultTime(aStep, 3, timeTaken2);
1054 PrintResultTime(aStep, 4, timeTaken3);
1057 /** Find last.txt with TFindFile and with two threads accessing the 2 directories
1059 @param aN Number of files in the directory
1060 @param aWild Wildcard string to be used in the search
1061 @param aStep Test step
1063 LOCAL_C void FindFileWild2(TInt aN, const TDesC& aWild, TInt aStep)
1073 TFindFile find(TheFs);
1076 TTimeIntervalMicroSeconds timeTaken(0);
1077 TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
1081 if(aN <= gFilesLimit)
1083 dir1 = gSessionPath;
1084 dir2 = gSessionPath;
1085 dir3 = gSessionPath;
1087 dir4.Format(KDirMultipleName2, 1, aN);
1090 dir4.Format(KDirMultipleName2, 2, aN);
1093 dir4.Format(KDirMultipleName2, 3, aN);
1101 temp.Append(KCommonFile);
1103 gFindEntryDir = temp;
1104 DoTest(FindEntryAccess);
1106 startTime.HomeTime();
1108 r = find.FindWildByPath(aWild, &dir1, dir);
1115 timeTaken = endTime.MicroSecondsFrom(startTime);
1116 timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
1123 temp.Append(KCommonFile);
1125 gFindEntryDir = temp;
1128 DoTest(FindEntryAccess);
1130 startTime.HomeTime();
1132 r = find.FindWildByPath(aWild, &dir2, dir);
1136 timeTaken = endTime.MicroSecondsFrom(startTime);
1140 timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
1147 temp.Append(KCommonFile);
1149 gFindEntryDir = temp;
1150 DoTest(FindEntryAccess);
1152 startTime.HomeTime();
1154 r = find.FindWildByPath(aWild, &dir3, dir);
1161 timeTaken = endTime.MicroSecondsFrom(startTime);
1162 timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
1166 PrintResult(aStep, 1, aN);
1167 PrintResultTime(aStep, 2, timeTaken1);
1168 PrintResultTime(aStep, 3, timeTaken2);
1169 PrintResultTime(aStep, 4, timeTaken3);
1172 /** Find last.txt with TFindFile and with two threads accessing the 2 directories
1174 @param aN Number of files in the directory
1175 @param aWild Wildcard string to be used in the search
1176 @param aStep Test step
1178 LOCAL_C void FindFileWild3(TInt aN, const TDesC& aWild, TInt aStep)
1188 TFindFile find(TheFs);
1191 TTimeIntervalMicroSeconds timeTaken(0);
1192 TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
1196 if(aN <= gFilesLimit)
1198 dir1 = gSessionPath;
1199 dir2 = gSessionPath;
1200 dir3 = gSessionPath;
1202 dir4.Format(KDirMultipleName2, 1, aN);
1206 dir4.Format(KDirMultipleName, 3, 300);
1213 temp2.Append(KCommonFile);
1214 gFindEntryDir = temp2;
1216 temp2.Append(KCommonFile);
1217 gFindEntryDir2 = temp2;
1221 DoTest2(FindEntryAccess);
1223 dir4.Format(KDirMultipleName, 1, aN);
1224 startTime.HomeTime();
1226 r = find.FindWildByPath(aWild, &dir1, dir);
1233 timeTaken = endTime.MicroSecondsFrom(startTime);
1234 timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
1239 dir4.Format(KDirMultipleName2, 2, aN);
1243 temp.Append(KCommonFile);
1245 gFindEntryDir = temp;
1247 DoTest2(FindEntryAccess);
1249 startTime.HomeTime();
1251 r = find.FindWildByPath(aWild, &dir2, dir);
1258 timeTaken = endTime.MicroSecondsFrom(startTime);
1259 timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
1264 dir4.Format(KDirMultipleName2, 3, aN);
1268 temp.Append(KCommonFile);
1270 gFindEntryDir = temp;
1272 DoTest2(FindEntryAccess);
1274 startTime.HomeTime();
1276 r = find.FindWildByPath(aWild, &dir3, dir);
1283 timeTaken = endTime.MicroSecondsFrom(startTime);
1284 timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
1288 PrintResult(aStep, 1, aN);
1289 PrintResultTime(aStep, 2, timeTaken1);
1290 PrintResultTime(aStep, 3, timeTaken2);
1291 PrintResultTime(aStep, 4, timeTaken3);
1294 /** Times the system when looking for files with patterns
1296 @param aSelector Configuration in case of manual execution
1298 LOCAL_C TInt TestFileFindPattern(TAny* aSelector)
1303 Validate(aSelector);
1305 test.Printf(_L("#~TS_Title_%d,%d: Find *.txt, TFindFile::FindWildByPath() only 1 access to the directory \n"), gTestHarness, gTestCase);
1308 while(i <= KMaxFiles)
1310 if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1311 FindFileWild1(i,_L("*.txt"), testStep++);
1316 test.Printf(_L("#~TS_Title_%d,%d: Find *.txt, TFindFile::FindWildByPath() multiple clients accessing same directory\n"), gTestHarness, gTestCase);
1320 while(i <= KMaxFiles)
1322 if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1323 FindFileWild2(i,_L("*.txt"), testStep++);
1328 test.Printf(_L("#~TS_Title_%d,%d: Find *.txt, TFindFile::FindWildByPath() mult clients access dif directories\n"), gTestHarness, gTestCase);
1332 while(i <= KMaxFiles)
1334 if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1335 FindFileWild3(i,_L("*.txt"), testStep++);
1340 test.Printf(_L("#~TS_Title_%d,%d: Find ffff*.txt, TFindFile::FindWildByPath() only 1 access to the directory \n"), gTestHarness, gTestCase);
1344 while(i <= KMaxFiles)
1346 if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1347 FindFileWild1(i,_L("ffff*.txt"), testStep++);
1352 test.Printf(_L("#~TS_Title_%d,%d: Find ffff*.txt, TFindFile::FindWildByPath() mult clients access same directory\n"), gTestHarness, gTestCase);
1356 while(i <= KMaxFiles)
1358 if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1359 FindFileWild2(i,_L("ffff*.txt"), testStep++);
1364 test.Printf(_L("#~TS_Title_%d,%d: Find ffff*.txt, TFindFile::FindWildByPath() mult clients access dif directories\n"), gTestHarness, gTestCase);
1368 while(i <= KMaxFiles)
1370 if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1371 FindFileWild3(i,_L("ffff*.txt"), testStep++);
1377 test.Printf(_L("\nFind last.*, TFindFile\n"));
1378 test.Printf(_L("#~TS_Title_%d,%d: Find last.*, TFindFile::FindWildByPath() only 1 access to the directory \n"), gTestHarness, gTestCase);
1384 if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1385 FindFileWild1(i,_L("last.*"), testStep++);
1390 test.Printf(_L("#~TS_Title_%d,%d: Find last.*, TFindFile::FindWildByPath() mult clients access same directory\n"), gTestHarness, gTestCase);
1394 while(i <= KMaxFiles)
1396 if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1397 FindFileWild2(i,_L("last.*"), testStep++);
1402 test.Printf(_L("#~TS_Title_%d,%d: Find last.*, TFindFile::FindWildByPath() mult clients access dif directories\n"), gTestHarness, gTestCase);
1406 while(i <= KMaxFiles)
1408 if(i == 100 || i == 1000 || i == 5000 || i == 10000)
1409 FindFileWild3(i,_L("last.*"), testStep++);
1417 /** It goes automatically through all the options
1419 @param aSelector Configuration in case of manual execution
1421 LOCAL_C TInt TestAll(TAny* aSelector)
1423 Validate(aSelector);
1425 TestFindEntry(aSelector);
1426 TestFindEntryMultipleClients(aSelector);
1427 TestFindEntryMultipleClientsDD(aSelector);
1428 TestFileFindPattern(aSelector);
1436 GLDEF_C void CallTestsL()
1439 TInt r = client.CreateLocal(0);
1442 CSelectionBox* TheSelector = CSelectionBox::NewL(test.Console());
1444 // Each test case of the suite has an identifyer for parsing purposes of the results
1448 CreateDirWithNFiles(300, 3);
1449 PrintHeaders(1, _L("t_fsrdirscan. Directory scanning"));
1453 gSessionPath=_L("?:\\");
1454 TCallBack createFiles(TestFileCreate,TheSelector);
1455 TCallBack findFile(TestFindEntry,TheSelector);
1456 TCallBack findFileMC(TestFindEntryMultipleClients,TheSelector);
1457 TCallBack findFileMCDD(TestFindEntryMultipleClientsDD,TheSelector);
1458 TCallBack findFilePattern(TestFileFindPattern,TheSelector);
1459 TheSelector->AddDriveSelectorL(TheFs);
1460 TheSelector->AddLineL(_L("Create all files"),createFiles);
1461 TheSelector->AddLineL(_L("Find filename"),findFile);
1462 TheSelector->AddLineL(_L("Find with mult clients same directory"),findFileMC);
1463 TheSelector->AddLineL(_L("Find with mult clients dif directories"),findFileMCDD);
1464 TheSelector->AddLineL(_L("All using glob patterns"),findFilePattern);
1469 TestAll(TheSelector);
1473 test.Printf(_L("#~TestEnd_%d\n"), gTestHarness);