dbgprofp.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /*++
  2. Copyright (c) 2013 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. dbgprofp.h
  9. Abstract:
  10. This header contains internal definitions for the debugger's profiling
  11. support.
  12. Author:
  13. Evan Green 14-Sep-2013
  14. --*/
  15. //
  16. // ------------------------------------------------------------------- Includes
  17. //
  18. //
  19. // ---------------------------------------------------------------- Definitions
  20. //
  21. //
  22. // ------------------------------------------------------ Data Type Definitions
  23. //
  24. /*++
  25. Structure Description:
  26. This structure defines a profiler data list entry. It stores the data sent
  27. by the profiler.
  28. Members:
  29. ListEntry - Stores pointers to the next and previous data packets in the
  30. list of profiler data.
  31. Processor - Stores the processor number this data came in from.
  32. Flags - Stores a set of flags describing the properties of this data entry.
  33. Offset - Stores the consumer's current offset into the data for
  34. convenience.
  35. DataSize - Stores the size of the data array, in bytes.
  36. Data - Stores an array of profiler data.
  37. --*/
  38. typedef struct _PROFILER_DATA_ENTRY {
  39. LIST_ENTRY ListEntry;
  40. ULONG Processor;
  41. ULONG Flags;
  42. ULONG Offset;
  43. ULONG DataSize;
  44. BYTE *Data;
  45. } PROFILER_DATA_ENTRY, *PPROFILER_DATA_ENTRY;
  46. //
  47. // -------------------------------------------------------------------- Globals
  48. //
  49. //
  50. // -------------------------------------------------------- Function Prototypes
  51. //
  52. //
  53. // Common functions
  54. //
  55. VOID
  56. DbgrpDestroyProfilerDataList (
  57. PLIST_ENTRY ListHead
  58. );
  59. /*++
  60. Routine Description:
  61. This routine destroys a profiler data list. It does not destroy the head
  62. of the list.
  63. Arguments:
  64. ListHead - Supplies a pointer to the head of the list that is to be
  65. destroyed.
  66. Return Value:
  67. None.
  68. --*/
  69. //
  70. // Thread profiling functions
  71. //
  72. INT
  73. DbgrpInitializeThreadProfiling (
  74. PDEBUGGER_CONTEXT Context
  75. );
  76. /*++
  77. Routine Description:
  78. This routine initializes support for thread profiling.
  79. Arguments:
  80. Context - Supplies a pointer to the debugger context.
  81. Return Value:
  82. 0 on success.
  83. Returns an error code on failure.
  84. --*/
  85. VOID
  86. DbgrpDestroyThreadProfiling (
  87. PDEBUGGER_CONTEXT Context
  88. );
  89. /*++
  90. Routine Description:
  91. This routine destroys any structures used for thread profiling.
  92. Arguments:
  93. Context - Supplies a pointer to the application context.
  94. Return Value:
  95. None.
  96. --*/
  97. VOID
  98. DbgrpProcessThreadProfilingData (
  99. PDEBUGGER_CONTEXT Context,
  100. PPROFILER_DATA_ENTRY ProfilerData
  101. );
  102. /*++
  103. Routine Description:
  104. This routine processes a profiler notification that the debuggee sends to
  105. the debugger. The routine should collect the profiler data and return as
  106. quickly as possible.
  107. Arguments:
  108. Context - Supplies a pointer to the application context.
  109. ProfilerData - Supplies a pointer to the newly allocated data. This routine
  110. will take ownership of that allocation.
  111. Return Value:
  112. None.
  113. --*/
  114. INT
  115. DbgrpDispatchThreadProfilerCommand (
  116. PDEBUGGER_CONTEXT Context,
  117. PSTR *Arguments,
  118. ULONG ArgumentCount
  119. );
  120. /*++
  121. Routine Description:
  122. This routine handles a thread profiler command.
  123. Arguments:
  124. Context - Supplies a pointer to the application context.
  125. Arguments - Supplies an array of strings containing the arguments.
  126. ArgumentCount - Supplies the number of arguments in the Arguments array.
  127. Return Value:
  128. 0 on success.
  129. Returns an error code on failure.
  130. --*/