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.

93 lines
1.7 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. tracelib.h
  5. Abstract:
  6. Private headers for user-mode trace library
  7. Author:
  8. 15-Aug-2000 JeePang
  9. Revision History:
  10. --*/
  11. #ifndef _TRACELIB_H_
  12. #define _TRACELIB_H_
  13. #define EtwpNtStatusToDosError(Status) ((ULONG)((Status == STATUS_SUCCESS)?ERROR_SUCCESS:RtlNtStatusToDosError(Status)))
  14. #if defined(_IA64_)
  15. #include <ia64reg.h>
  16. #endif
  17. //
  18. // GetCycleCounts
  19. //
  20. // Since we do not want to make a kernel mode transition to get the
  21. // thread CPU Times, we settle for just getting the CPU Cycle counts.
  22. // We use the following macros from BradW to get the CPU cycle count.
  23. // This method may be inaccurate if the clocks are not synchronized
  24. // between processors.
  25. //
  26. #if defined(_X86_)
  27. __inline
  28. LONGLONG
  29. EtwpGetCycleCount(
  30. )
  31. {
  32. __asm{
  33. RDTSC
  34. }
  35. }
  36. #elif defined(_AMD64_)
  37. #define EtwpGetCycleCount() ReadTimeStampCounter()
  38. #elif defined(_IA64_)
  39. #define EtwpGetCycleCount() __getReg(CV_IA64_ApITC)
  40. #else
  41. #error "perf: a target architecture must be defined."
  42. #endif
  43. #define SMALL_BUFFER_SIZE 4096
  44. #define PAGESIZE_MULTIPLE(x) \
  45. (((ULONG)(x) + ((SMALL_BUFFER_SIZE)-1)) & ~((ULONG)(SMALL_BUFFER_SIZE)-1))
  46. PVOID
  47. EtwpMemReserve(
  48. IN SIZE_T Size
  49. );
  50. PVOID
  51. EtwpMemCommit(
  52. IN PVOID Buffer,
  53. IN SIZE_T Size
  54. );
  55. ULONG
  56. EtwpMemFree(
  57. IN PVOID Buffer
  58. );
  59. HANDLE
  60. EtwpCreateFile(
  61. LPCWSTR lpFileName,
  62. DWORD dwDesiredAccess,
  63. DWORD dwShareMode,
  64. DWORD dwCreationDisposition,
  65. DWORD dwCreateFlags
  66. );
  67. NTSTATUS
  68. EtwpGetCpuSpeed(
  69. OUT DWORD* CpuNum,
  70. OUT DWORD* CpuSpeed
  71. );
  72. #endif // _TRACELIB_H_