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.

147 lines
3.0 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1992.
  5. //
  6. // File: STAT.HXX
  7. //
  8. // Contents: Statistics support.
  9. //
  10. // Classes: CStat -- Basic statistics object
  11. //
  12. // History: 23-May-91 KyleP Created
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #ifdef DISPLAY_INCLUDES
  17. #pragma message( "#include <" __FILE__ ">..." )
  18. #endif
  19. class CKeyBuf;
  20. //+---------------------------------------------------------------------------
  21. //
  22. // Class: CStat (stat)
  23. //
  24. // Purpose: Basic statistics object
  25. //
  26. // Interface: CStat - Constructor
  27. //
  28. // History: 24-May-91 KyleP Created.
  29. //
  30. //----------------------------------------------------------------------------
  31. class CStat
  32. {
  33. public:
  34. CStat();
  35. void ClearCount();
  36. void Add(unsigned long Item);
  37. int Count() const;
  38. double Mean() const;
  39. double SDev() const;
  40. unsigned long Total() const;
  41. unsigned long Min() const;
  42. unsigned long Max() const;
  43. void Print(FILE * stm,
  44. char * szName = "",
  45. int fHeader = 0,
  46. unsigned int Div = 8);
  47. private:
  48. int _count;
  49. unsigned long _sigma;
  50. unsigned long _sigmaSquared;
  51. unsigned long _min;
  52. unsigned long _max;
  53. };
  54. //+---------------------------------------------------------------------------
  55. //
  56. // Class: CDistrib (stat)
  57. //
  58. // Purpose: Shows statistical distributions
  59. //
  60. // Interface:
  61. //
  62. // History: 07-May-91 KyleP Created.
  63. //
  64. //----------------------------------------------------------------------------
  65. class CDistrib
  66. {
  67. public:
  68. CDistrib(unsigned int cBuckets, unsigned long min,
  69. unsigned long max);
  70. CDistrib(unsigned int cBuckets, unsigned long min,
  71. unsigned long * aMaxBucket);
  72. ~CDistrib();
  73. void Add(unsigned long Item);
  74. void Print(FILE * stm);
  75. private:
  76. unsigned int _cBuckets;
  77. unsigned long * _aBucket;
  78. unsigned long * _aMaxBucket;
  79. unsigned long _min;
  80. unsigned long _maxcount;
  81. };
  82. //+-------------------------------------------------------------------------
  83. //
  84. // Class: CPopularKeys
  85. //
  86. // Purpose: Keep track of n most popular keys
  87. //
  88. // History: 14-May-93 KyleP Created
  89. //
  90. //--------------------------------------------------------------------------
  91. class CPopularKeys
  92. {
  93. public:
  94. CPopularKeys( int cKeep = 15 );
  95. ~CPopularKeys();
  96. void Add( CKeyBuf const & key, unsigned long cWid );
  97. void Print(FILE * stm);
  98. private:
  99. int _cKeep;
  100. unsigned long * _acWid;
  101. CKeyBuf * _aKey;
  102. };