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.

139 lines
2.2 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. tracelog.h
  5. Abstract:
  6. This module contains public declarations and definitions for creating
  7. trace logs.
  8. A trace log is a fast, in-memory, thread safe activity log useful
  9. for debugging certain classes of problems. They are especially useful
  10. when debugging reference count bugs.
  11. Note that the creator of the log has the option of adding "extra"
  12. bytes to the log header. This can be useful if the creator wants to
  13. create a set of global logs, each on a linked list.
  14. Author:
  15. Keith Moore (keithmo) 30-Apr-1997
  16. Revision History:
  17. --*/
  18. #ifndef _TRACELOG_H_
  19. #define _TRACELOG_H_
  20. #if defined(__cplusplus)
  21. extern "C" {
  22. #endif // __cplusplus
  23. typedef struct _TRACE_LOG {
  24. //
  25. // Signature.
  26. //
  27. LONG Signature;
  28. //
  29. // The total number of entries available in the log.
  30. //
  31. LONG LogSize;
  32. //
  33. // The index of the next entry to use.
  34. //
  35. LONG NextEntry;
  36. //
  37. // The byte size of each entry.
  38. //
  39. LONG EntrySize;
  40. //
  41. // Pointer to the start of the circular buffer.
  42. //
  43. PUCHAR LogBuffer;
  44. //
  45. // Filler to keep the log entries aligned on a 16-byte boundary.
  46. // (Makes it much easier to interpret the log from within a debugger.)
  47. //
  48. LONG Filler[3];
  49. //
  50. // The extra header bytes and actual log entries go here.
  51. //
  52. // BYTE ExtraHeaderBytes[ExtraBytesInHeader];
  53. // BYTE Entries[LogSize][EntrySize];
  54. //
  55. } TRACE_LOG, *PTRACE_LOG;
  56. //
  57. // Log header signature.
  58. //
  59. #define TRACE_LOG_SIGNATURE ((ULONG)'gOlT')
  60. #define TRACE_LOG_SIGNATURE_X ((ULONG)'golX')
  61. //
  62. // This macro maps a TRACE_LOG pointer to a pointer to the 'extra'
  63. // data associated with the log.
  64. //
  65. #define TRACE_LOG_TO_EXTRA_DATA(log) (PVOID)( (log) + 1 )
  66. //
  67. // Manipulators.
  68. //
  69. PTRACE_LOG
  70. CreateTraceLog(
  71. IN LONG LogSize,
  72. IN LONG ExtraBytesInHeader,
  73. IN LONG EntrySize
  74. );
  75. VOID
  76. DestroyTraceLog(
  77. IN PTRACE_LOG Log
  78. );
  79. VOID
  80. WriteTraceLog(
  81. IN PTRACE_LOG Log,
  82. IN PVOID Entry
  83. );
  84. VOID
  85. ResetTraceLog(
  86. IN PTRACE_LOG Log
  87. );
  88. #if defined(__cplusplus)
  89. } // extern "C"
  90. #endif // __cplusplus
  91. #endif // _TRACELOG_H_