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.

97 lines
3.1 KiB

  1. /*++
  2. Copyright (C) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. classmap.h
  5. Abstract:
  6. the perfobject ID is combination of the perf counter ID and
  7. the perf counter type. This is necessary to support counter
  8. definitions that use the counter ID for the numerator and denominator
  9. values (e.g. a counter and it's base value.)
  10. --*/
  11. //***************************************************************************
  12. //
  13. // class CClassMapInfo
  14. //
  15. //***************************************************************************
  16. #ifndef _CLASSMAP_H_
  17. #define _CLASSMAP_H_
  18. #include "utils.h"
  19. typedef __int64 PerfObjectId;
  20. #define CM_MAKE_PerfObjectId(ctr,type) (PerfObjectId)(((__int64)(ctr)) | (((__int64)type << 32) & 0xFFFFFFFF00000000))
  21. class CClassMapInfo
  22. {
  23. private:
  24. // friend clss declarations
  25. friend class CNt5PerfProvider;
  26. friend class CNt5Refresher;
  27. friend class PerfHelper;
  28. friend class CPerfObjectAccess;
  29. // cached class definition object from CIMOM
  30. IWbemClassObject *m_pClassDef;
  31. LPWSTR m_pszClassName; // name of this class
  32. BOOL m_bSingleton; // true if this class has 1 and only 1 instance
  33. BOOL m_bCostly; // true when the costly qualifier is present in the obj def
  34. DWORD m_dwObjectId; // perf object ID corresponding to this class
  35. LONG m_lRefCount; // count of objects that are using this instance
  36. // saved handles to properties that are in every class of a
  37. // performance class object
  38. LONG m_dwNameHandle;
  39. LONG m_dwPerfTimeStampHandle;
  40. LONG m_dw100NsTimeStampHandle;
  41. LONG m_dwObjectTimeStampHandle;
  42. LONG m_dwPerfFrequencyHandle;
  43. LONG m_dw100NsFrequencyHandle;
  44. LONG m_dwObjectFrequencyHandle;
  45. // These entries make up the table of saved handles to the properties
  46. // belonging to this class.
  47. DWORD m_dwNumProps; // number of properties in the class
  48. PerfObjectId *m_pdwIDs; // array of PerfCounterTitleIndex values
  49. DWORD *m_pdwHandles; // array of handles to each of the properties
  50. DWORD *m_pdwTypes; // array of perf counter type values
  51. // internal sort function to arrange handles in order of the
  52. // perf counter ID so as to facilitate a binary table search
  53. //
  54. // NOTE: Consider a better search routine base on table size
  55. void SortHandles();
  56. public:
  57. CClassMapInfo();
  58. ~CClassMapInfo();
  59. // loads a new object and caches the necessary information
  60. BOOL Map( IWbemClassObject *pObj );
  61. // creates a new copy from an existing Class Map
  62. CClassMapInfo *CreateDuplicate();
  63. LONG AddRef() {return ++m_lRefCount;} // increment reference counter
  64. LONG Release() {return --m_lRefCount;} // decrement reference counter
  65. // looks up the ID in the table and returns the corresponding
  66. // handle to the property
  67. LONG GetPropHandle(PerfObjectId dwId);
  68. // returns information about the class
  69. DWORD GetObjectId() { return m_dwObjectId; }
  70. BOOL IsSingleton() { return m_bSingleton; }
  71. BOOL IsCostly() { return m_bCostly; }
  72. };
  73. #endif // _CLASSMAP_H_