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.

132 lines
2.1 KiB

  1. /*++
  2. Copyright (c) 1997 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. // The extra header bytes and actual log entries go here.
  46. //
  47. // BYTE ExtraHeaderBytes[ExtraBytesInHeader];
  48. // BYTE Entries[LogSize][EntrySize];
  49. //
  50. } TRACE_LOG, *PTRACE_LOG;
  51. //
  52. // Log header signature.
  53. //
  54. #define TRACE_LOG_SIGNATURE ((DWORD)'gOlT')
  55. #define TRACE_LOG_SIGNATURE_X ((DWORD)'golX')
  56. //
  57. // This macro maps a TRACE_LOG pointer to a pointer to the 'extra'
  58. // data associated with the log.
  59. //
  60. #define TRACE_LOG_TO_EXTRA_DATA(log) (PVOID)( (log) + 1 )
  61. //
  62. // Manipulators.
  63. //
  64. PTRACE_LOG
  65. CreateTraceLog(
  66. IN LONG LogSize,
  67. IN LONG ExtraBytesInHeader,
  68. IN LONG EntrySize
  69. );
  70. VOID
  71. DestroyTraceLog(
  72. IN PTRACE_LOG Log
  73. );
  74. LONG
  75. WriteTraceLog(
  76. IN PTRACE_LOG Log,
  77. IN PVOID Entry
  78. );
  79. VOID
  80. ResetTraceLog(
  81. IN PTRACE_LOG Log
  82. );
  83. #if defined(__cplusplus)
  84. } // extern "C"
  85. #endif // __cplusplus
  86. #endif // _TRACELOG_H_