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.

133 lines
3.5 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. memlog.h
  5. Abstract:
  6. in memory logging facility
  7. Author:
  8. Charlie Wickham (charlwi) 17-Mar-1997
  9. Revision History:
  10. --*/
  11. #ifndef _MEMLOG_
  12. #define _MEMLOG_
  13. /* Prototypes */
  14. /* End Prototypes */
  15. #ifdef MEMLOGGING
  16. typedef struct _MEMLOG_ENTRY {
  17. LARGE_INTEGER SysTime;
  18. USHORT Type;
  19. USHORT LineNo;
  20. ULONG_PTR Arg1;
  21. ULONG_PTR Arg2;
  22. } MEMLOG_ENTRY, *PMEMLOG_ENTRY;
  23. //
  24. // Do not change the order of
  25. //
  26. // MemLogReceivedPacket,
  27. // MemLogReceivedPacket1,
  28. //
  29. // MemLogMissedIfHB,
  30. // MemLogMissedIfHB1,
  31. //
  32. // MemLogFailingIf,
  33. // MemLogFailingIf1,
  34. //
  35. // MEMLOG4 relies on MemLogFailingIf1 = MemLogFailingIf + 1, etc
  36. //
  37. typedef enum _MEMLOG_TYPES {
  38. MemLogInitLog = 1,
  39. MemLogInitHB,
  40. MemLogHBStarted,
  41. MemLogHBStopped,
  42. MemLogHBDpcRunning,
  43. MemLogWaitForDpcFinish,
  44. MemLogMissedIfHB,
  45. MemLogMissedIfHB1,
  46. MemLogFailingIf,
  47. MemLogFailingIf1,
  48. MemLogSendHBWalkNode,
  49. MemLogCheckHBWalkNode,
  50. MemLogCheckHBNodeReachable,
  51. MemLogCheckHBMissedHB,
  52. MemLogSendingHB,
  53. MemLogNodeDown,
  54. MemLogSetDpcEvent,
  55. MemLogNoNetID,
  56. MemLogOnlineIf,
  57. MemLogSeqAckMismatch,
  58. MemLogNodeUp,
  59. MemLogReceivedPacket,
  60. MemLogReceivedPacket1,
  61. MemLogDpcTimeSkew,
  62. MemLogHBPacketSend,
  63. MemLogHBPacketSendComplete,
  64. MemLogPoisonPktReceived,
  65. MemLogOuterscreen,
  66. MemLogNodeDownIssued,
  67. MemLogRegroupFinished,
  68. MemLogInconsistentStates,
  69. MemLogOutOfSequence,
  70. MemLogInvalidSignature,
  71. MemLogSignatureSize,
  72. MemLogNoSecurityContext,
  73. MemLogPacketSendFailed
  74. } MEMLOG_TYPES;
  75. extern ULONG MemLogEntries;
  76. extern ULONG MemLogNextLogEntry;
  77. extern PMEMLOG_ENTRY MemLog;
  78. extern KSPIN_LOCK MemLogLock;
  79. #define _MEMLOG( _type, _arg1, _arg2 ) \
  80. { \
  81. KIRQL MemLogIrql; \
  82. if ( MemLogEntries ) { \
  83. KeAcquireSpinLock( &MemLogLock, &MemLogIrql ); \
  84. KeQuerySystemTime( &MemLog[ MemLogNextLogEntry ].SysTime ); \
  85. MemLog[ MemLogNextLogEntry ].Type = _type; \
  86. MemLog[ MemLogNextLogEntry ].LineNo = __LINE__; \
  87. MemLog[ MemLogNextLogEntry ].Arg1 = _arg1; \
  88. MemLog[ MemLogNextLogEntry ].Arg2 = _arg2; \
  89. if ( ++MemLogNextLogEntry == MemLogEntries ) \
  90. MemLogNextLogEntry = 0; \
  91. MemLog[ MemLogNextLogEntry ].Type = 0; \
  92. KeReleaseSpinLock( &MemLogLock, MemLogIrql ); \
  93. } \
  94. }
  95. #else // MEMLOGGING
  96. #define _MEMLOG( _type, _arg1, _arg2 )
  97. #endif // MEMLOGGING
  98. #define MEMLOG( _type, _arg1, _arg2 ) \
  99. { \
  100. _MEMLOG( _type, _arg1, _arg2 ); \
  101. }
  102. #define MEMLOG4( _type, _arg3, _arg4 , _arg1, _arg2 ) \
  103. { \
  104. _MEMLOG( _type + 1, _arg3, _arg4 ); \
  105. _MEMLOG( _type, _arg1, _arg2 ); \
  106. }
  107. #endif /* _MEMLOG_ */
  108. /* end memlog.h */