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.

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