Open squeek502 opened 1 year ago
Potential additions (belongs into new issue, if not implemented here):
I'd love to see this merged once conflicts are resolved. Sorry to bother you, but any thoughts, @andrewrk?
I think windows has hardware counters, doesn't it? If so then I think a windows version should use them.
If anyone can point me to a concrete example of how the relevant information can be obtained on Windows (like "here's C++ code that prints out the number of cache misses in a program"), I'd take a look. I can't make heads or tails of any of the documentation/information around it.
My best guess right now is that the answer is effectively, "windows does not have [relevant/useful] hardware counters." With possibly a caveat around Intel processors, specifically.
My best guess right now is that the answer is effectively, "windows does not have [relevant/useful] hardware counters." With possibly a caveat around Intel processors, specifically.
ETW are using them. Would be this blog post sufficient? https://adamsitnik.com/Hardware-Counters-ETW/ based on https://github.com/microsoft/perfview/blob/main/documentation/TraceEvent/TraceEventLibrary.md.
Otherwise, I would use this tool, which includes an sophisticated analyzer https://tinyurl.com/etwtracing.
Probably the most simple way is to use WPR and WPA as explained in https://learn.microsoft.com/en-us/windows-hardware/test/wpt/event-tracing-for-windows.
UPDATE: found the lib https://learn.microsoft.com/en-us/windows/win32/api/perflib/ and some more info https://learn.microsoft.com/en-us/windows/win32/perfctrs/using-the-perflib-functions-to-consume-counter-data.
Building for MacOS proved successful, but running it only yielded a memory leak and and a couple new lines were printed to the terminal before I had to ^C it.
Any updates @squeek502 ?
Not currently planning on working on this much more. As mentioned in the OP, this is mostly meant as a proof-of-concept. If others want to take it further they are more than welcome to.
I've been hitting something like https://github.com/andrewrk/poop/issues/43 or other stdout/stderr/process spawning related issues often when trying to use poop
(especially on Windows), so I've not been using it much personally.
This is something of a proof-of-concept. The idea is to include the perf measurements when they are available, but when they're not, only wall time and maxrss are measured and shown. The method of achieving this used in this PR could probably use some work, this is just what I came up with first.
Screenshot from Windows:
(benefits from https://github.com/ziglang/zig/pull/16294 to fix the colors)
Note: I've only tested it on Windows, so I may have broken Linux inadvertently. EDIT: Yep, I broke Linux--will fix that.