RecyclerWatsonTelemetry.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #ifndef NTBUILD
  6. #define RECORD_TIMESTAMP(Field)
  7. #define INC_TIMESTAMP_FIELD(Field)
  8. #define AUTO_TIMESTAMP(Field)
  9. #else // CHAKRA_FULL
  10. namespace Memory
  11. {
  12. /*
  13. * Telemetry timestamp macros
  14. *
  15. * To record a particular timestamp, use RECORD_TIMESTAMP. This overwrites the previous timestamp.
  16. * To have auto-start/end events logged, use the AUTO_TIMESTAMP macro.
  17. */
  18. class AutoTimestamp
  19. {
  20. public:
  21. AutoTimestamp(FILETIME * startTimestamp, FILETIME * endTimestamp) : endTimestamp(endTimestamp)
  22. {
  23. ::GetSystemTimeAsFileTime(startTimestamp);
  24. }
  25. ~AutoTimestamp()
  26. {
  27. ::GetSystemTimeAsFileTime(endTimestamp);
  28. }
  29. private:
  30. FILETIME * endTimestamp;
  31. };
  32. #define RECORD_TIMESTAMP(Field) ::GetSystemTimeAsFileTime(&telemetryBlock->Field);
  33. #define INC_TIMESTAMP_FIELD(Field) telemetryBlock->Field++;
  34. #define AUTO_TIMESTAMP(Field) Memory::AutoTimestamp timestamp_##Field(&telemetryBlock->Field##StartTime, &telemetryBlock->Field##EndTime);
  35. struct RecyclerWatsonTelemetryBlock
  36. {
  37. FILETIME initialCollectionStartTime;
  38. DWORDLONG initialCollectionStartProcessUsedBytes;
  39. FILETIME currentCollectionStartTime;
  40. DWORDLONG currentCollectionStartProcessUsedBytes;
  41. FILETIME concurrentMarkFinishTime;
  42. FILETIME disposeStartTime;
  43. FILETIME disposeEndTime;
  44. FILETIME externalWeakReferenceObjectResolveStartTime;
  45. FILETIME externalWeakReferenceObjectResolveEndTime;
  46. FILETIME currentCollectionEndTime;
  47. FILETIME lastCollectionEndTime;
  48. DWORD exhaustiveRepeatedCount;
  49. };
  50. };
  51. #endif