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.

208 lines
6.3 KiB

  1. /*++
  2. Copyright (c) 2000-2002 Microsoft Corporation
  3. Module Name:
  4. timetrace.h
  5. Abstract:
  6. This module contains public declarations and definitions for tracing
  7. and debugging the timing of request processing.
  8. Author:
  9. Michael Courage (mcourage) 8-Mar-2000
  10. Revision History:
  11. --*/
  12. #ifndef _TIMETRACE_H_
  13. #define _TIMETRACE_H_
  14. //
  15. // This defines the entry written to the trace log.
  16. //
  17. typedef struct _TIME_TRACE_LOG_ENTRY
  18. {
  19. ULONGLONG TimeStamp;
  20. HTTP_CONNECTION_ID ConnectionId;
  21. HTTP_REQUEST_ID RequestId;
  22. USHORT Action;
  23. USHORT Processor;
  24. } TIME_TRACE_LOG_ENTRY, *PTIME_TRACE_LOG_ENTRY;
  25. //
  26. // Action codes.
  27. //
  28. // N.B. These codes must be contiguous, starting at zero. If you update
  29. // this list, you must also update the corresponding array in
  30. // ul\ulkd\time.c.
  31. //
  32. #define TIME_ACTION_CREATE_CONNECTION 0
  33. #define TIME_ACTION_CREATE_REQUEST 1
  34. #define TIME_ACTION_ROUTE_REQUEST 2
  35. #define TIME_ACTION_COPY_REQUEST 3
  36. #define TIME_ACTION_SEND_RESPONSE 4
  37. #define TIME_ACTION_SEND_COMPLETE 5
  38. #define TIME_ACTION_COUNT 6
  39. #define TIME_TRACE_LOG_SIGNATURE MAKE_SIGNATURE('TmLg')
  40. //
  41. // Manipulators.
  42. //
  43. PTRACE_LOG
  44. CreateTimeTraceLog(
  45. IN LONG LogSize,
  46. IN LONG ExtraBytesInHeader
  47. );
  48. VOID
  49. DestroyTimeTraceLog(
  50. IN PTRACE_LOG pLog
  51. );
  52. VOID
  53. WriteTimeTraceLog(
  54. IN PTRACE_LOG pLog,
  55. IN HTTP_CONNECTION_ID ConnectionId,
  56. IN HTTP_REQUEST_ID RequestId,
  57. IN USHORT Action
  58. );
  59. #if ENABLE_TIME_TRACE
  60. #define CREATE_TIME_TRACE_LOG( ptr, size, extra ) \
  61. (ptr) = CreateTimeTraceLog( (size), (extra) )
  62. #define DESTROY_TIME_TRACE_LOG( ptr ) \
  63. do \
  64. { \
  65. DestroyTimeTraceLog( ptr ); \
  66. (ptr) = NULL; \
  67. } while (FALSE, FALSE)
  68. #define WRITE_TIME_TRACE_LOG( plog, cid, rid, act ) \
  69. WriteTimeTraceLog( \
  70. (plog), \
  71. (cid), \
  72. (rid), \
  73. (act) \
  74. )
  75. #else // !ENABLE_TIME_TRACE
  76. #define CREATE_TIME_TRACE_LOG( ptr, size, extra ) NOP_FUNCTION
  77. #define DESTROY_TIME_TRACE_LOG( ptr ) NOP_FUNCTION
  78. #define WRITE_TIME_TRACE_LOG( plog, cid, rid, act ) NOP_FUNCTION
  79. #endif // ENABLE_TIME_TRACE
  80. #define TRACE_TIME( cid, rid, act ) \
  81. WRITE_TIME_TRACE_LOG( \
  82. g_pTimeTraceLog, \
  83. (cid), \
  84. (rid), \
  85. (act) \
  86. )
  87. //
  88. // This defines the entry written to the appool time trace log.
  89. //
  90. typedef struct _APP_POOL_TIME_TRACE_LOG_ENTRY
  91. {
  92. ULONGLONG TimeStamp;
  93. PVOID Context1; // For PUL_APP_POOL_OBJECT
  94. PVOID Context2; // For PUL_APP_POOL_PROCESS
  95. USHORT Action; // One of the below
  96. USHORT Processor;
  97. } APP_POOL_TIME_TRACE_LOG_ENTRY, *PAPP_POOL_TIME_TRACE_LOG_ENTRY;
  98. //
  99. // Action codes.
  100. //
  101. // N.B. Do not forget to update !ulkd.atimelog if you update this.
  102. //
  103. #define APP_POOL_TIME_ACTION_CREATE_APPOOL 0
  104. #define APP_POOL_TIME_ACTION_MARK_APPOOL_ACTIVE 1
  105. #define APP_POOL_TIME_ACTION_MARK_APPOOL_INACTIVE 2
  106. #define APP_POOL_TIME_ACTION_CREATE_PROCESS 3
  107. #define APP_POOL_TIME_ACTION_DETACH_PROCESS 4
  108. #define APP_POOL_TIME_ACTION_DETACH_PROCESS_COMPLETE 5
  109. #define APP_POOL_TIME_ACTION_DESTROY_APPOOL 6
  110. #define APP_POOL_TIME_ACTION_DESTROY_APPOOL_PROCESS 7
  111. #define APP_POOL_TIME_ACTION_LOAD_BAL_CAPABILITY 8
  112. #define APP_POOL_TIME_ACTION_COUNT 9
  113. #define APP_POOL_TIME_TRACE_LOG_SIGNATURE MAKE_SIGNATURE('TaLg')
  114. //
  115. // Manipulators.
  116. //
  117. PTRACE_LOG
  118. CreateAppPoolTimeTraceLog(
  119. IN LONG LogSize,
  120. IN LONG ExtraBytesInHeader
  121. );
  122. VOID
  123. DestroyAppPoolTimeTraceLog(
  124. IN PTRACE_LOG pLog
  125. );
  126. VOID
  127. WriteAppPoolTimeTraceLog(
  128. IN PTRACE_LOG pLog,
  129. IN PVOID Context1,
  130. IN PVOID Context2,
  131. IN USHORT Action
  132. );
  133. #if ENABLE_APP_POOL_TIME_TRACE
  134. #define CREATE_APP_POOL_TIME_TRACE_LOG( ptr, size, extra ) \
  135. (ptr) = CreateAppPoolTimeTraceLog( (size), (extra) )
  136. #define DESTROY_APP_POOL_TIME_TRACE_LOG( ptr ) \
  137. do \
  138. { \
  139. DestroyAppPoolTimeTraceLog( ptr ); \
  140. (ptr) = NULL; \
  141. } while (FALSE, FALSE)
  142. #define WRITE_APP_POOL_TIME_TRACE_LOG( c1, c2, act ) \
  143. WriteAppPoolTimeTraceLog( \
  144. (g_pAppPoolTimeTraceLog), \
  145. (c1), \
  146. (c2), \
  147. (act) \
  148. )
  149. #else // !ENABLE_APP_POOL_TIME_TRACE
  150. #define CREATE_APP_POOL_TIME_TRACE_LOG( ptr, size, extra ) NOP_FUNCTION
  151. #define DESTROY_APP_POOL_TIME_TRACE_LOG( ptr ) NOP_FUNCTION
  152. #define WRITE_APP_POOL_TIME_TRACE_LOG( c1, c2, act ) NOP_FUNCTION
  153. #endif // ENABLE_APP_POOL_TIME_TRACE
  154. #endif // _TIMETRACE_H_