Example of how to capture CPU counters with ETW on Windows, perf on Linux or kperf on Apple.
Using ETW needs somewhat recently updated Windows 10 or 11. Not sure about exact version.
Currently tested on:
- etw on Qualcomm Snapdragon X Elite, Windows 11, arm64
- etw on AMD Zen 3, Windows 11 (with virtualization enabled in BIOS)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // example of using Windows Preview Handler | |
| // https://learn.microsoft.com/en-us/windows/win32/shell/preview-handlers | |
| #define COBJMACROS | |
| #define WIN32_LEAN_AND_MEAN | |
| #include <windows.h> | |
| #include <shlwapi.h> | |
| #include <shellapi.h> | |
| #include <shobjidl.h> |
Have you ever struggled with writing your Makefile manually or dealing with your projects without depending on a specific IDE? If so, this article is for you to break your chains.
Picture this: a Makefile that adapts to your project like a chameleon, requiring only a few parameter tweaks to fit most of your needs. Gone are the days of wrestling with convoluted build scripts or spending hours integrating external libraries. With this Makefile in your arsenal, you'll conquer the build process with ease and finesse.
Who is this article for?
- If you have a GNU Linux development environment.
- If you are using GNU compilers such as
g++. - If you don't depend on any IDE for project configurations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| MIT License | |
| Copyright 2022 acceleration3 | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * | |
| * MIT License | |
| * | |
| * Copyright (c) 2017-2022 Cody Tilkins | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal | |
| * in the Software without restriction, including without limitation the rights | |
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // The DockBuilder API is still marked as experimental, include Dear ImGui's internal header to pull the functions in: | |
| #include "imgui_internal.h" | |
| // [...] | |
| // Beginning of main loop | |
| // 1. DockBuilder functions only need to run once to take effect. | |
| // This state variable will let us check for the first frame of the app. | |
| static bool firstLoop = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma once | |
| // Modern C++ wrapper for libloaderapi, see theme_hacks.hpp for usage | |
| // after https://github.com/bblanchon/dllhelper aka "How to GetProcAddress like a boss 😎" | |
| // with added return type safety if the function ptr is null | |
| // -> returns a default 'RetType()' value, ie false, null etc (line 31) | |
| #include <libloaderapi.h> | |
| namespace raz::hacks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Unknwn.h> | |
| #include <Windows.h> | |
| #include <ntstatus.h> | |
| #include <winternl.h> | |
| #include <wrl\implements.h> | |
| #include <comutil.h> | |
| #include <dcomp.h> | |
| #include <dwmapi.h> | |
| #include <dxgi1_3.h> | |
| #include <d3d11_2.h> |
NewerOlder