How gametechdev/presentmon works
Overall architecture and main components
• PresentMon Collection & Analysis Library (PresentData directory): This layer handles the low-level collection and analysis of ETW (Event Tracing for Windows) events. It is responsible for gathering raw performance data from graphics applications.
• PresentMon Console Application (PresentMon directory): A command-line tool built on top of the collection library to export CSV data and allow users to collect performance metrics.
• PresentMon Service (IntelPresentMon/PresentMonService within the IntelPresentMon directory): A background service that combines ETW event analysis with hardware telemetry (via vendor APIs like NVAPI, AMD Power Telemetry, etc.). It exposes data through the PresentMon API.
• PresentMon Capture Application (IntelPresentMon/AppCef): A GUI application that interfaces with the service. It displays real-time overlays, graphs, and readouts, providing a user-friendly interaction layer.
• Supporting Libraries and Tools: Other directories such as PresentMonAPI2, PresentMonAPIWrapper, FlashInjector, Interprocess, and related test and build files indicate additional components for API facilitation, injection of hooks, interprocess communication, and testing.
Interactions and data flow between components
• The ETW Collection Library (PresentData) acts as the foundation, receiving low-level graphics events.
• The Console Application and Service both build on this library. The service augments the ETW data with hardware telemetry, while the console application makes the raw or processed data available via CSV output.
• The Capture Application (GUI) communicates with the Service to retrieve real-time data and then renders overlays and interactive graphs.
• API/Wrapper components (e.g., PresentMonAPI2, PresentMonAPIWrapper) serve as interfaces for third-party applications or middleware to access the collected metrics.
• Tools (found in Tools directory) and tests (Tests, ULT, UnitTests) support build processes, automated validation, and additional visualizations.
Architectural patterns and design principles
• Modular design: The codebase is split into clear modules (collection, processing, API/service, GUI) with decoupled responsibilities.
• Layered architecture: Data collection based on ETW events forms the lowest level, with subsequent layers handling processing, telemetry integration, API exposure, and visualization.
• Service-oriented design: The PresentMon Service is a central component that aggregates telemetry and ETW data, exposing it for both the GUI application and external API users.
• Interprocess communication: Notice directories like Interprocess and InterprocessMock—indicating that shared memory, named pipes, or other IPC mechanisms are used to exchange data between components.
Essential details and elements to add
• Notes about external dependencies: for instance, vendor-specific APIs (NVAPI, AMD telemetry) versus Microsoft ETW.
• Optionally, indicate build and deployment tools at the periphery (BUILDING.md, vcpkg, etc.) to highlight the development tooling integration.
• Modal separation – background service versus interactive console/GUI – and highlight that the ETW data collection is central to the overall system operation.
Final advice to the principal software engineer
• Don’t hesitate to use annotations or callouts to explain how interprocess communication or integration with Windows (e.g., ETW, telemetry, and group membership “Performance Log Users”) works.