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.

95 lines
2.2 KiB

  1. /**************************************************************************\
  2. *
  3. * Copyright (c) 2000 Microsoft Corporation
  4. *
  5. * Module Name:
  6. *
  7. * perfother.cpp
  8. *
  9. * Abstract:
  10. *
  11. * Contains all the tests for anything 'miscellaneous'.
  12. *
  13. \**************************************************************************/
  14. #include "perftest.h"
  15. float Other_Graphics_Create_FromHwnd_PerCall(Graphics *g, HDC hdc)
  16. {
  17. UINT iterations;
  18. float seconds;
  19. if (g)
  20. {
  21. StartTimer();
  22. do {
  23. Graphics g(ghwndMain);
  24. } while (!EndTimer());
  25. g->Flush(FlushIntentionSync);
  26. GetTimer(&seconds, &iterations);
  27. }
  28. else
  29. {
  30. StartTimer();
  31. do {
  32. HDC hdc = GetDC(ghwndMain);
  33. ReleaseDC(ghwndMain, hdc);
  34. } while (!EndTimer());
  35. GdiFlush();
  36. GetTimer(&seconds, &iterations);
  37. }
  38. return(iterations / seconds / KILO); // Kilo-calls per second
  39. }
  40. float Other_Graphics_Create_FromScreenHdc_PerCall(Graphics *gScreen, HDC hdcScreen)
  41. {
  42. UINT iterations;
  43. float seconds;
  44. if (!gScreen) return(0);
  45. HDC hdc = GetDC(ghwndMain);
  46. StartTimer();
  47. do {
  48. Graphics g(hdc);
  49. ASSERT(g.GetLastStatus() == Ok);
  50. } while (!EndTimer());
  51. GetTimer(&seconds, &iterations);
  52. ReleaseDC(ghwndMain, hdc);
  53. return(iterations / seconds / KILO); // Kilo-calls per second
  54. }
  55. ////////////////////////////////////////////////////////////////////////////////
  56. // Add tests for this file here. Always use the 'T' macro for adding entries.
  57. // The parameter meanings are as follows:
  58. //
  59. // Parameter
  60. // ---------
  61. // 1 UniqueIdentifier - Must be a unique number assigned to no other test
  62. // 2 Priority - On a scale of 1 to 5, how important is the test?
  63. // 3 Function - Function name
  64. // 4 Comment - Anything to describe the test
  65. Test OtherTests[] =
  66. {
  67. T(5000, 1, Other_Graphics_Create_FromHwnd_PerCall , "Kcalls/s"),
  68. T(5001, 1, Other_Graphics_Create_FromScreenHdc_PerCall , "Kcalls/s"),
  69. };
  70. INT OtherTests_Count = sizeof(OtherTests) / sizeof(OtherTests[0]);