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.

49 lines
1.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996.
  5. //
  6. // File: B E N C H M R K . H
  7. //
  8. // Contents: Benchmark class.
  9. //
  10. // Notes:
  11. //
  12. // Author: billbe 13 Oct 1997
  13. //
  14. //---------------------------------------------------------------------------
  15. #pragma once
  16. const WCHAR c_sznEmpty[] = {'\0'};
  17. class CBenchmark
  18. {
  19. public:
  20. CBenchmark();
  21. ~CBenchmark();
  22. void Start(PCWSTR sznDescription);
  23. void Stop();
  24. double DblBenchmarkSeconds()
  25. {
  26. return m_i64TotalTime / static_cast<double>(m_i64Frequency);
  27. }
  28. PCWSTR SznDescription(){return m_sznDescription ? m_sznDescription : c_sznEmpty;}
  29. PCWSTR SznBenchmarkSeconds(unsigned short usPrecision);
  30. private:
  31. __int64 m_i64Frequency;
  32. PWSTR m_sznDescription;
  33. __int64 m_i64StartTime;
  34. __int64 m_i64TotalTime;
  35. BOOL m_fStarted;
  36. BOOL m_fSupported;
  37. WCHAR m_sznSeconds[50];
  38. };
  39. extern "C" void timer_start();
  40. extern "C" void timer_stop();
  41. extern "C" PCWSTR timer_secs();
  42. EXTERN_C double timer_time();