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.

276 lines
6.1 KiB

  1. /*++
  2. Copyright (c) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. schedt.h
  5. Abstract:
  6. defines for psched's tracing support
  7. Author:
  8. Rajesh Sundaram (rajeshsu)
  9. Revision History:
  10. --*/
  11. #ifndef _SCHEDTRACE_
  12. #define _SCHEDTRACE_
  13. typedef VOID (*SCHEDTRACE_THRESH_PROC)( PVOID Context);
  14. #define TRACE_BUFFER_SIZE 1000 * 1024
  15. #define TRACE_STRING_LENGTH 127
  16. #define MAX_RECORD_DATA 200
  17. #define TRACE_PREAMBLE 0xdeadbeef
  18. // Record types
  19. #define RECORD_TSTRING 1
  20. #define RECORD_RECV 2
  21. #define RECORD_PKT 3
  22. #define RECORD_SCHED 4
  23. #define RECORD_COMPONENT_SPECIFIC 5
  24. #define RECORD_SEND 6
  25. #define RECORD_OID 7
  26. // Receive actions (must be kept in sync with kdps)
  27. #define ENTER (ULONG)1
  28. #define NO_RESOURCES (ULONG)2
  29. #define LOW_RESOURCES (ULONG)3
  30. #define INDICATING (ULONG)4
  31. #define RETURNED (ULONG)5
  32. #define NOT_OURS (ULONG)6
  33. #define OURS (ULONG)7
  34. #define RETURNING (ULONG)8
  35. #define TRANSFERRING (ULONG)9
  36. #define NOT_READY (ULONG)10
  37. // Receive events (must be kept in sync with kdps)
  38. #define CL_RECV_PACKET (ULONG)1
  39. #define MP_RETURN_PACKET (ULONG)2
  40. #define CL_RECV_IND (ULONG)3
  41. #define CL_RECV_COMPL (ULONG)4
  42. #define MP_XFER_DATA (ULONG)5
  43. #define CL_XFER_COMPL (ULONG)6
  44. // Send actions
  45. #define MP_SEND (ULONG) 1
  46. #define MP_CO_SEND (ULONG) 2
  47. #define DUP_PACKET (ULONG) 3
  48. #define DROP_PACKET (ULONG) 4
  49. #define CL_SEND_COMPLETE (ULONG) 5
  50. // Packet actions (must be kept in sync with kdps)
  51. #define SUBMIT (ULONG)1
  52. #define SEND (ULONG)2
  53. #define SEND_COMPLETE (ULONG)3
  54. #define DROP (ULONG)4
  55. #define CO_SEND (ULONG)5
  56. // Scheduler actions (must be kept in sync with kdps)
  57. #define PKT_ENQUEUE (ULONG)1
  58. #define PKT_DEQUEUE (ULONG)2
  59. #define PKT_CONFORMANCE (ULONG)3
  60. #define PKT_DISCARD (ULONG)4
  61. // ID for Scheduler modules
  62. // Note! LAST_LOG_ID should be at the very
  63. // end. The add-in components use IDs that
  64. // begin from LAST_LOG_ID
  65. #define TBC_CONFORMER (ULONG)1
  66. #define SHAPER (ULONG)2
  67. #define DRR_SEQUENCER (ULONG)3
  68. #define LAST_LOG_ID (ULONG)4
  69. typedef struct _TraceRecordString {
  70. LONG Preamble;
  71. SHORT RecordType;
  72. LARGE_INTEGER Now;
  73. UCHAR StringStart[TRACE_STRING_LENGTH];
  74. } TRACE_RECORD_STRING;
  75. #define TRACE_OID_MP_SETINFORMATION 1
  76. #define TRACE_OID_MP_QUERYINFORMATION 2
  77. #define TRACE_OID_SET_REQUEST_COMPLETE 3
  78. #define TRACE_OID_QUERY_REQUEST_COMPLETE 4
  79. typedef struct _TraceRecordOid {
  80. LONG Preamble;
  81. SHORT RecordType;
  82. LARGE_INTEGER Now;
  83. ULONG Oid;
  84. ULONG Local;
  85. ULONG Action;
  86. ULONG PTState;
  87. ULONG MPState;
  88. PVOID Adapter;
  89. ULONG Status;
  90. } TRACE_RECORD_OID;
  91. typedef struct _TraceRecordRecv{
  92. LONG Preamble;
  93. SHORT RecordType;
  94. LARGE_INTEGER Now;
  95. ULONG Event;
  96. ULONG Action;
  97. PVOID Adapter;
  98. PNDIS_PACKET Packet1;
  99. PNDIS_PACKET Packet2;
  100. } TRACE_RECORD_RECV;
  101. typedef struct _TraceRecordSend {
  102. LONG Preamble;
  103. SHORT RecordType;
  104. LARGE_INTEGER Now;
  105. ULONG Event;
  106. ULONG Action;
  107. PVOID Adapter;
  108. PNDIS_PACKET Packet1;
  109. PNDIS_PACKET Packet2;
  110. PVOID Vc;
  111. } TRACE_RECORD_SEND;
  112. typedef struct _TraceRecordPkts{
  113. LONG Preamble;
  114. SHORT RecordType;
  115. LARGE_INTEGER Now;
  116. ULONG CallingFunction;
  117. PVOID VC;
  118. PNDIS_PACKET Packet;
  119. ULONG PacketLength;
  120. ULONG Action;
  121. LONGLONG AbsoluteTime;
  122. } TRACE_RECORD_PKT;
  123. typedef struct _TraceRecordSched{
  124. LONG Preamble;
  125. SHORT RecordType;
  126. LARGE_INTEGER Now;
  127. ULONG SchedulerComponent;
  128. ULONG Action;
  129. PVOID VC;
  130. PNDIS_PACKET Packet;
  131. ULONG PacketLength;
  132. ULONG Priority;
  133. LONGLONG ArrivalTime;
  134. LONGLONG ConformanceTime;
  135. ULONG PacketsInComponent;
  136. ULONG BytesInComponent;
  137. } TRACE_RECORD_SCHED;
  138. typedef struct _TraceRecordComponentSpecific{
  139. LONG Preamble;
  140. SHORT RecordType;
  141. LARGE_INTEGER Now;
  142. ULONG SchedulerComponent;
  143. ULONG Length;
  144. UCHAR Data[MAX_RECORD_DATA];
  145. } TRACE_RECORD_COMPONENT_SPECIFIC;
  146. VOID DbugOid(
  147. ULONG Action,
  148. ULONG Local,
  149. ULONG PTState,
  150. ULONG MPState,
  151. PVOID Adapter,
  152. ULONG Oid,
  153. ULONG Status
  154. );
  155. VOID
  156. DbugSchedString(char *format, ...);
  157. VOID
  158. DbugRecv(
  159. ULONG Event,
  160. ULONG Action,
  161. PVOID Adapter,
  162. PNDIS_PACKET Packet1,
  163. PNDIS_PACKET Packet2
  164. );
  165. VOID
  166. DbugSend(
  167. ULONG Event,
  168. ULONG Action,
  169. PVOID Adapter,
  170. PVOID Vc,
  171. PNDIS_PACKET Packet1,
  172. PNDIS_PACKET Packet2
  173. );
  174. VOID
  175. DbugSchedPkts(
  176. ULONG CallingFunction,
  177. PVOID VC,
  178. PNDIS_PACKET Packet,
  179. ULONG Action,
  180. ULONG PacketLength
  181. );
  182. VOID
  183. DbugSched(
  184. ULONG SchedulerComponent,
  185. ULONG Action,
  186. PVOID VC,
  187. PNDIS_PACKET Packet,
  188. ULONG PacketLength,
  189. ULONG Priority,
  190. LONGLONG ArrivalTime,
  191. LONGLONG ConformanceTime,
  192. ULONG PacketsInComponent,
  193. ULONG BytesInComponent
  194. );
  195. VOID
  196. DbugComponentSpecificRec(
  197. ULONG SchedulerComponent,
  198. PVOID Data,
  199. ULONG Length
  200. );
  201. VOID
  202. DbugTraceSetThreshold(
  203. ULONG Threshold,
  204. PVOID Context,
  205. SCHEDTRACE_THRESH_PROC ThreshProc
  206. );
  207. VOID
  208. DbugReadTraceBuffer(
  209. PUCHAR Buffer,
  210. ULONG BytesToRead,
  211. PULONG BytesRead
  212. );
  213. NTSTATUS
  214. WriteRecord(
  215. UCHAR * Record,
  216. ULONG Bytes
  217. );
  218. VOID
  219. SchedInitialize(ULONG BufferSize);
  220. VOID SchedDeInitialize();
  221. ULONG
  222. SchedtGetBufferSize();
  223. ULONG
  224. SchedtGetBytesUnread();
  225. #endif _SCHEDTRACE_