Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
3.5 KiB

  1. //+------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1993.
  5. //
  6. // File: bm_filio.hxx
  7. //
  8. // Contents: test class definition
  9. //
  10. // Classes: CFileIOTest
  11. //
  12. // Functions:
  13. //
  14. // History: 03-June-94 t-vadims Created
  15. //
  16. //--------------------------------------------------------------------------
  17. #ifndef _BM_FILIO_HXX_
  18. #define _BM_FILIO_HXX_
  19. #include <bm_base.hxx>
  20. #define MAX_REPS 100 // max repetions on write/read
  21. #define MAX_READS 100 // maximum number of total diferent reads/writes
  22. // considering reps and diferent size
  23. #define AM_NORMAL 0
  24. #define AM_ASYNC 1
  25. #define AM_MAPPED 2
  26. class CFileIOTest : public CTestBase
  27. {
  28. public:
  29. virtual TCHAR *Name ();
  30. virtual SCODE Setup (CTestInput *input);
  31. virtual SCODE Run ();
  32. virtual SCODE Report (CTestOutput &OutputFile);
  33. virtual SCODE Cleanup ();
  34. private:
  35. inline BOOL IsAsyncMode();
  36. inline BOOL IsMappedMode();
  37. inline BOOL IsNormalMode();
  38. void InitTimings();
  39. ULONG m_ulIterations;
  40. // Regular file read/write timings
  41. ULONG m_ulOpenFileW[TEST_MAX_ITERATIONS];
  42. ULONG m_ulWrite[MAX_READS][TEST_MAX_ITERATIONS];
  43. ULONG m_ulWriteTotal[TEST_MAX_ITERATIONS];
  44. ULONG m_ulClose1[TEST_MAX_ITERATIONS];
  45. ULONG m_ulOpenFileR[TEST_MAX_ITERATIONS];
  46. ULONG m_ulRead[MAX_READS][TEST_MAX_ITERATIONS];
  47. ULONG m_ulReadTotal[TEST_MAX_ITERATIONS];
  48. ULONG m_ulSeek[MAX_READS][TEST_MAX_ITERATIONS];
  49. ULONG m_ulSeekTotal[TEST_MAX_ITERATIONS];
  50. ULONG m_ulClose2[TEST_MAX_ITERATIONS];
  51. //Additonal timings for file-mapped io
  52. ULONG m_ulCreateFileMappingW[TEST_MAX_ITERATIONS];
  53. ULONG m_ulMapViewW[TEST_MAX_ITERATIONS];
  54. ULONG m_ulCloseMap1[TEST_MAX_ITERATIONS];
  55. ULONG m_ulUnmapView1[TEST_MAX_ITERATIONS];
  56. ULONG m_ulFlush1[TEST_MAX_ITERATIONS];
  57. ULONG m_ulCreateFileMappingR[TEST_MAX_ITERATIONS];
  58. ULONG m_ulMapViewR[TEST_MAX_ITERATIONS];
  59. ULONG m_ulCloseMap2[TEST_MAX_ITERATIONS];
  60. ULONG m_ulUnmapView2[TEST_MAX_ITERATIONS];
  61. ULONG m_ulFlush2[TEST_MAX_ITERATIONS];
  62. ULONG m_ulTotal[2][TEST_MAX_ITERATIONS];
  63. BYTE *m_pbData; // data to be written to file
  64. TCHAR m_pszFile[MAX_PATH]; // file name
  65. TCHAR m_pszReadMode[15]; // read mode (RANDOM/SEQUENTIAL)
  66. TCHAR m_pszAccessMode[15]; // access mode (NORMAL/ASYNC/MAPPED)
  67. ULONG m_flStandardCreateFlags;// file creation flags for CreateFile
  68. // (FILE_FLAG_WRITE_THROUGH or 0)
  69. ULONG m_flAccessMode; // file acess mode AM_ASYNC, AM_MAPPED or AM_NORMAL
  70. ULONG m_iStartSize; // start size of data to be written
  71. ULONG m_iEndSize; // end size of data
  72. ULONG m_ulTotalSize; // total size of the file
  73. ULONG m_iRepeatFactor; // Number of writes for each size.
  74. ULONG m_ulNumSizes; // number of diferent write sizes
  75. BOOL m_bSequentialRead; // flage for Sequential and Random read
  76. BOOL m_bFlush; // is flush on??
  77. LPMALLOC m_piMalloc; // point to task malloc interface
  78. };
  79. inline BOOL CFileIOTest::IsAsyncMode(void)
  80. {
  81. return (m_flAccessMode == AM_ASYNC) ;
  82. }
  83. inline BOOL CFileIOTest::IsMappedMode(void)
  84. {
  85. return (m_flAccessMode == AM_MAPPED) ;
  86. }
  87. inline BOOL CFileIOTest::IsNormalMode(void)
  88. {
  89. return (m_flAccessMode == AM_NORMAL) ;
  90. }
  91. #endif