Source code of Windows XP (NT5)
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.

96 lines
1.4 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. All rights reserved.
  4. Module Name:
  5. testsm.cxx
  6. Abstract:
  7. Test the main perf counters.
  8. Author:
  9. Albert Ting (AlbertT) 17-Dec-1996
  10. Revision History:
  11. --*/
  12. #include "precomp.hxx"
  13. #pragma hdrstop
  14. #include <stdio.h>
  15. #include "sharemem.hxx"
  16. typedef struct DATA {
  17. INT i;
  18. INT j;
  19. INT k;
  20. BYTE b;
  21. } *PDATA;
  22. VOID
  23. DataUp(
  24. PDATA pData
  25. );
  26. INT
  27. __cdecl
  28. main(
  29. INT argc,
  30. CHAR* argv[]
  31. )
  32. {
  33. UINT uSizeDisposition;
  34. PDATA pData;
  35. INT i,j;
  36. for( i=0; i< 0x1000; ++i )
  37. {
  38. TShareMem ShareMem( sizeof( DATA ),
  39. TEXT( "TestData" ),
  40. TShareMem::kCreate | TShareMem::kReadWrite,
  41. NULL,
  42. &uSizeDisposition );
  43. if( ShareMem.bValid( ))
  44. {
  45. printf( "uSizeDisposition = 0x%x ( 0x%x )\n",
  46. uSizeDisposition,
  47. sizeof( DATA ));
  48. for( j = 0; j< 0x200 ; ++j )
  49. {
  50. {
  51. TShareMemLock<DATA> SML( ShareMem, &pData );
  52. DataUp( pData );
  53. }
  54. Sleep( 10 );
  55. }
  56. }
  57. }
  58. printf( "Done.\n" );
  59. Sleep( INFINITE );
  60. return 0;
  61. }
  62. VOID
  63. DataUp(
  64. PDATA pData
  65. )
  66. {
  67. printf( "%x %x %x %x\n",
  68. pData->i++,
  69. pData->j++,
  70. pData->k++,
  71. pData->b++ );
  72. }