I don't know how feasible/hard it would be, but a lot of people are on Windows and would surely appreciate support for their platform. For me it's mostly about getting profiler snapshots from people using Gradle (the tool I work on) and most of our users are on Windows.
I am a Windows user myself, and I would love to have a profiler with an equivalent functionality. However, I don't see how async-profiler can support Windows with a reasonable amount of effort. The problem is Windows does not have a concept of POSIX signals nor API similar to perf_event_open in Linux.
In theory it is possible to create an alternative profiling engine for Windows, but this would require introducing a new platform abstraction layer, reimplementing much of the existing code using Windows API, and maintaining all this stuff in future. Currently I'm not ready to sign up for this job myself, but I'll be glad to accept contributions if someone wishes to support async-profiler on Windows.
@apangin, can Performance Counters be alternative?
@imanushin No, it's an unrelated technology.
In fact, the problem is not in the technology. It is possible to create a similar tool for Windows, but it will use quite different mechanism. Also, since Windows is not POSIX, the major part of the project will need to be rewritten: threads, timers, signals, I/O - all that stuff.
For profiling to work on Windows, the JVM would need to report the unwind info to Windows.
For dynamically generated code, this is done using RtlAddGrowableFunctionTable
If JVMTI has access to the info that the JVM machine code emitter produces or can figure it out somehow, maybe by inspecting the machine code or because frame pointers are enabled, etc. it could report this to Windows and then the OS ETW Stack Walker will be able to walk the stack.
Ideally someone would fix the JVM to do this on Windows all the time, or at least when profiling is enabled (however that is determined in the JVM of choice) then extra machinery will not be needed.
For reference on how to do this in this tool or in the JVM, one could follow this commit that does essentially that for V8:
https://github.com/v8/v8/blob/3cda21de77d098a612eadf44d504b188a599c5f0/src/unwinding-info-win64.cc
Would the Windows Subsystem for Linux (WSL or WSL2) be an option here? It's a full Linux kernel in the latter case.
Just FYI, I do some work to port async-profiler on Windows. However, no time estimates or working prototype yet.
How are you porting it? Will you be reporting the ranges to Windows as I described above? That work will be great to also have in the JVM so everyone can benefit.
any update?
The recent 2021.2 EAP release of IDEA seems to contain an initial release.
I was able to profile on AdoptOpenJDK 11, but not on 8.
@TarasTielkes yes, it is announced in EAP2: https://blog.jetbrains.com/idea/2021/06/intellij-idea-2021-2-eap-2/#profiler
Please give it a try!
@gorrus way ahead of you :) I've been eagerly awaiting this for the last months, after watching the presentation by @KirillTim
Since our main products are all still bound to Java 8, https://youtrack.jetbrains.com/issue/IDEA-270240 is my main impediment towards using it in daily work
Is there a way to try out async profiler for Windows without using IDEA?
@wolfs JetBrains fork is here: https://github.com/JetBrains/async-profiler. Looks like the actual Windows parts are closed source.
Most helpful comment
Just FYI, I do some work to port async-profiler on Windows. However, no time estimates or working prototype yet.