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.

110 lines
2.7 KiB

  1. /*++
  2. Copyright (c) 1998-2001 Microsoft Corporation
  3. Module Name:
  4. pipelinep.h
  5. Abstract:
  6. This module contains private declarations for the pipeline package.
  7. These are kept in a separate file to make them accessible by the
  8. ULKD kernel debuggger extension.
  9. Author:
  10. Keith Moore (keithmo) 10-Jun-1998
  11. Revision History:
  12. --*/
  13. #ifndef _PIPELINEP_H_
  14. #define _PIPELINEP_H_
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. //
  19. // Per-thread data we keep for the pipeline worker threads.
  20. //
  21. typedef struct _UL_PIPELINE_THREAD_DATA
  22. {
  23. HANDLE ThreadHandle;
  24. PVOID pThreadObject;
  25. #if DBG
  26. ULONG QueuesHandled;
  27. ULONG WorkItemsHandled;
  28. #endif
  29. } UL_PIPELINE_THREAD_DATA, *PUL_PIPELINE_THREAD_DATA;
  30. //
  31. // The UL_PIPELINE_RARE structure contains rarely used data. The data
  32. // in this structure is typically accessed only during pipeline creation
  33. // and termination. This structure located immediately after the
  34. // UL_PIPELINE data.
  35. //
  36. typedef struct _UL_PIPELINE_RARE
  37. {
  38. //
  39. // The UL_PIPELINE structure is carefully aligned on a cache-line
  40. // boundary. To do this, we allocate a block of memory slightly
  41. // larger than necessary and round up to the next cache-line.
  42. // Therefore, the block of memory allocated is not necessarily the
  43. // one actually used. The following field points to the actual
  44. // block of allocated memory.
  45. //
  46. PVOID pAllocationBlock;
  47. //
  48. // Per-thread data for the worker threads goes here. The number of
  49. // items in this array is:
  50. //
  51. // ( ThreadsPerCpu * UlNumberOfProcessors )
  52. //
  53. // UL_PIPELINE_THREAD_DATA ThreadData[ANYSIZE_ARRAY];
  54. //
  55. } UL_PIPELINE_RARE, *PUL_PIPELINE_RARE;
  56. //
  57. // Macro for calculating the memory size required for a pipeline given
  58. // the number of queues and the number of worker threads.
  59. //
  60. #define PIPELINE_LENGTH( queues, threads ) \
  61. ( sizeof(UL_PIPELINE) \
  62. - sizeof(UL_PIPELINE_QUEUE) \
  63. + sizeof(UL_PIPELINE_RARE) \
  64. + ( (ULONG)(queues) * sizeof(UL_PIPELINE_QUEUE) ) \
  65. + ( (ULONG)(threads) * sizeof(UL_PIPELINE_THREAD_DATA) ) )
  66. //
  67. // Macros for mapping a UL_PIPELINE pointer to the corresponding
  68. // UL_PIPELINE_RARE and UL_PIPELINE_THREAD_DATA structures.
  69. //
  70. #define PIPELINE_TO_RARE_DATA( pipeline ) \
  71. ( (PUL_PIPELINE_RARE)( &(pipeline)->Queues[(pipeline)->QueueCount] ) )
  72. #define PIPELINE_TO_THREAD_DATA( pipeline ) \
  73. (PUL_PIPELINE_THREAD_DATA)( PIPELINE_TO_RARE_DATA( pipeline ) + 1 )
  74. #ifdef __cplusplus
  75. }; // extern "C"
  76. #endif
  77. #endif // _PIPELINEP_H_