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.

96 lines
3.3 KiB

  1. #ifndef _PSTAT_INCLUDED_
  2. #define _PSTAT_INCLUDED_
  3. //
  4. //
  5. // MAX_CESRS - maximum number of event selection registers
  6. // This is a softwate limit. NoCESR is the runtime value.
  7. // MAX_EVENTS - maximum number of active performance counter registers.
  8. // This is a softwate limit. NoCounters is the runtime value.
  9. //
  10. // Note - We could define these values as processor independent and
  11. // use a maximum denominator.
  12. // Mostly to limit the size of data structures and arrays based
  13. // on these values, we are defining
  14. #if defined(_X86_)
  15. #define MAX_EVENTS 2 // sw: max number of active perf. counters.
  16. #define MAX_CESRS 2 // sw: max number of event selection registers.
  17. #else // !_X86_
  18. // include _IA64_ ...
  19. #define MAX_EVENTS 4 // sw: max number of active perf. counters.
  20. #define MAX_CESRS 4 // sw: max number of event selection registers.
  21. #endif // !_X86_
  22. #define MAX_THUNK_COUNTERS 64
  23. #define MAX_PROCESSORS 32
  24. #define PSTAT_READ_STATS CTL_CODE (FILE_DEVICE_UNKNOWN, 0, METHOD_NEITHER, FILE_ANY_ACCESS)
  25. #define PSTAT_SET_CESR CTL_CODE (FILE_DEVICE_UNKNOWN, 1, METHOD_NEITHER, FILE_ANY_ACCESS)
  26. #define PSTAT_HOOK_THUNK CTL_CODE (FILE_DEVICE_UNKNOWN, 2, METHOD_NEITHER, FILE_ANY_ACCESS)
  27. #define PSTAT_REMOVE_HOOK CTL_CODE (FILE_DEVICE_UNKNOWN, 3, METHOD_NEITHER, FILE_ANY_ACCESS)
  28. #define PSTAT_QUERY_EVENTS CTL_CODE (FILE_DEVICE_UNKNOWN, 4, METHOD_NEITHER, FILE_ANY_ACCESS)
  29. #define PSTAT_QUERY_EVENTS_INFO CTL_CODE (FILE_DEVICE_UNKNOWN, 5, METHOD_NEITHER, FILE_ANY_ACCESS)
  30. #define OFFSET(type, field) ((LONG_PTR)(&((type *)0)->field))
  31. //
  32. //
  33. //
  34. typedef struct {
  35. ULONGLONG Counters[MAX_EVENTS];
  36. ULONG EventId[MAX_EVENTS];
  37. ULONGLONG TSC;
  38. ULONG reserved;
  39. // FIXFIX - Thierry - 01/2000:
  40. // To virtualize these counters, we should use ULONGLONG types and not polymorphic types.
  41. ULONG_PTR SpinLockAcquires;
  42. ULONG_PTR SpinLockCollisions;
  43. ULONG_PTR SpinLockSpins;
  44. ULONG_PTR Irqls;
  45. ULONGLONG ThunkCounters[MAX_THUNK_COUNTERS];
  46. } PSTATS, *pPSTATS;
  47. typedef struct {
  48. ULONG EventId;
  49. BOOLEAN Active;
  50. BOOLEAN UserMode;
  51. BOOLEAN KernelMode;
  52. BOOLEAN EdgeDetect;
  53. ULONG AppReserved;
  54. ULONG reserved;
  55. } SETEVENT, *PSETEVENT;
  56. typedef struct {
  57. PUCHAR SourceModule;
  58. ULONG_PTR ImageBase;
  59. PUCHAR TargetModule;
  60. PUCHAR Function;
  61. ULONG TracerId;
  62. } HOOKTHUNK, *PHOOKTHUNK;
  63. typedef struct {
  64. ULONG EventId;
  65. KPROFILE_SOURCE ProfileSource;
  66. ULONG DescriptionOffset;
  67. ULONG SuggestedIntervalBase;
  68. UCHAR Buffer[];
  69. } EVENTID, *PEVENTID;
  70. typedef struct _EVENTS_INFO {
  71. ULONG Events;
  72. ULONG TokenMaxLength;
  73. ULONG DescriptionMaxLength;
  74. ULONG OfficialTokenMaxLength;
  75. ULONG OfficialDescriptionMaxLength;
  76. } EVENTS_INFO, *PEVENTS_INFO;
  77. #if defined(ExAllocatePool)
  78. #undef ExAllocatePool
  79. #endif
  80. #define ExAllocatePool(Type,Size) ExAllocatePoolWithTag((Type),(Size),'ttsp')
  81. #endif /* _PSTAT_INCLUDED */