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.

42 lines
1.0 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 CHAR c_sznEmpty[] = {'\0'};
  17. class CBenchmark
  18. {
  19. public:
  20. CBenchmark();
  21. ~CBenchmark();
  22. void Start(PCSTR sznDescription);
  23. void Stop();
  24. double DblBenchmarkSeconds()
  25. {
  26. return m_i64TotalTime / static_cast<double>(m_i64Frequency);
  27. }
  28. PCSTR SznDescription(){return m_sznDescription ? m_sznDescription : c_sznEmpty;}
  29. PCSTR SznBenchmarkSeconds(unsigned short usPrecision);
  30. private:
  31. __int64 m_i64Frequency;
  32. PSTR m_sznDescription;
  33. __int64 m_i64StartTime;
  34. __int64 m_i64TotalTime;
  35. BOOL m_fStarted;
  36. BOOL m_fSupported;
  37. CHAR m_sznSeconds[50];
  38. };