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.

185 lines
5.4 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. grphitem.h
  5. Abstract:
  6. <abstract>
  7. --*/
  8. #ifndef _GRPHITEM_H_
  9. #define _GRPHITEM_H_
  10. #include <inole.h>
  11. #include "isysmon.h"
  12. class CSysmonControl;
  13. //
  14. // Persistant data structure
  15. //
  16. typedef struct
  17. {
  18. COLORREF m_rgbColor;
  19. INT32 m_iWidth;
  20. INT32 m_iStyle;
  21. INT32 m_iScaleFactor;
  22. INT32 m_nPathLength;
  23. } GRAPHITEM_DATA3;
  24. typedef struct
  25. {
  26. double m_dMin;
  27. double m_dMax;
  28. double m_dAvg;
  29. FILETIME m_LastTimeStamp;
  30. } LOG_ENTRY_DATA, *PLOG_ENTRY_DATA;
  31. //
  32. // Graphitem Class
  33. //
  34. class CGraphItem : public ICounterItem
  35. {
  36. public:
  37. class CCounterNode* m_pCounter;
  38. class CInstanceNode* m_pInstance;
  39. class CGraphItem* m_pNextItem;
  40. PDH_COUNTER_INFO m_CounterInfo;
  41. HCOUNTER m_hCounter;
  42. double m_dScale;
  43. PLOG_ENTRY_DATA m_pLogData;
  44. BOOLEAN m_bUpdateLog;
  45. public:
  46. BOOLEAN m_fLocalMachine;
  47. BOOLEAN m_fGenerated;
  48. CGraphItem(CSysmonControl *pCtrl);
  49. ~CGraphItem(void);
  50. //IUnknown members
  51. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  52. STDMETHODIMP_(ULONG) AddRef(void);
  53. STDMETHODIMP_(ULONG) Release(void);
  54. // ICounterItem methods
  55. STDMETHODIMP put_Color(OLE_COLOR);
  56. STDMETHODIMP get_Color(OLE_COLOR*);
  57. STDMETHODIMP put_Width(INT);
  58. STDMETHODIMP get_Width(INT*) ;
  59. STDMETHODIMP put_LineStyle(INT) ;
  60. STDMETHODIMP get_LineStyle(INT*) ;
  61. STDMETHODIMP put_ScaleFactor(INT) ;
  62. STDMETHODIMP get_ScaleFactor(INT*) ;
  63. STDMETHODIMP get_Path(BSTR*) ;
  64. STDMETHODIMP get_Value(double*) ;
  65. STDMETHODIMP GetValue(double *pdValue, LONG *plStatus) ;
  66. STDMETHODIMP GetStatistics(double *pdMax, double *pdMin, double *pdAvg,
  67. LONG *plStatus) ;
  68. // methods not exposed by ICounterItem interface
  69. static HRESULT NullItemToStream(LPSTREAM pIStream, INT iVersMaj, INT iVersMin);
  70. HPEN Pen(void);
  71. HBRUSH Brush(void);
  72. double Scale(void) { return m_dScale; }
  73. HCOUNTER Handle(void) { return m_hCounter; }
  74. CInstanceNode *Instance(void) { return m_pInstance; }
  75. CCounterNode *Counter(void) { return m_pCounter; }
  76. CObjectNode *Object(void) { return m_pInstance->m_pObject; }
  77. CMachineNode *Machine(void) { return m_pInstance->m_pObject->m_pMachine; }
  78. CCounterTree *Tree(void) { return m_pInstance->m_pObject->m_pMachine->m_pCounterTree; }
  79. CGraphItem *Next(void);
  80. void Delete(BOOL bPropagateUp);
  81. BOOL IsRateCounter ( void );
  82. HRESULT LoadFromPropertyBag (
  83. IPropertyBag*,
  84. IErrorLog*,
  85. INT iIndex,
  86. INT iVersMaj,
  87. INT iVersMin,
  88. INT iSampleCount );
  89. HRESULT SaveToPropertyBag (
  90. IPropertyBag*,
  91. INT iIndex,
  92. BOOL bUserMode,
  93. INT iVersMaj,
  94. INT iVersMin );
  95. HRESULT SaveToStream(LPSTREAM pIStream, BOOL fWildCard, INT iVersMaj, INT iVersMin);
  96. HRESULT AddToQuery(HQUERY hQuery);
  97. HRESULT RemoveFromQuery();
  98. void ClearHistory( void );
  99. void UpdateHistory(BOOL bValidSample);
  100. PDH_STATUS HistoryValue(INT iIndex, double *pdValue, DWORD *pdwStatus);
  101. PDH_STATUS GetLogEntry( const INT iIndex, double *dMin, double *dMax, double *dAvg,
  102. DWORD *pdwStatus);
  103. PDH_STATUS GetLogEntryTimeStamp (
  104. const INT iIndex,
  105. LONGLONG& rLastTimeStamp,
  106. DWORD *pdwStatus);
  107. void SetLogEntry(
  108. const INT iIndex,
  109. const double dMin,
  110. const double dMax,
  111. const double dAvg);
  112. void SetLogEntryTimeStamp( const INT iIndex, const FILETIME& rLastTimeStamp );
  113. void SetLogStats(double dMin, double dMax, double dAvg)
  114. { m_dLogMin = dMin; m_dLogMax = dMax; m_dLogAvg = dAvg; }
  115. private:
  116. CSysmonControl *m_pCtrl;
  117. void InvalidatePen(void);
  118. void InvalidateBrush(void);
  119. void FormPath(LPTSTR pszPath, BOOL fWildCard);
  120. // Used by LoadFromPropertyBag
  121. void SetStatistics ( double dMax, double dMin, double dAvg, LONG lStatus );
  122. void SetHistoryValue ( INT iIndex, double dValue );
  123. HRESULT GetNextValue ( TCHAR*& pszNext, double& dValue );
  124. ULONG m_cRef;
  125. HPEN m_hPen;
  126. HBRUSH m_hBrush;
  127. COLORREF m_rgbColor;
  128. INT m_iWidth;
  129. INT m_iStyle; // No change in implementation
  130. INT m_iScaleFactor;
  131. double m_dLogMin;
  132. double m_dLogMax;
  133. double m_dLogAvg;
  134. PCImpIDispatch m_pImpIDispatch;
  135. PPDH_RAW_COUNTER m_pRawCtr;
  136. // Used by LoadFromPropertyBag
  137. double* m_pFmtCtr;
  138. double m_dFmtMin;
  139. double m_dFmtMax;
  140. double m_dFmtAvg;
  141. long m_lFmtStatus;
  142. };
  143. #endif