Closed jp7677 closed 1 month ago
Seems to work fine, although i am a bit unsure if info
should also log this Enter
bit? Nice for catching time spent in a function for sure, but do we need it for info
logging?
Seems to work fine, although i am a bit unsure if
info
should also log thisEnter
bit? Nice for catching time spent in a function for sure, but do we need it forinfo
logging?
The idea was to catch situations where a crash occurred within an nvapi call. In that case we obviously don't log an exit code, so those function calls were invisible in the former logs. But I agree, if we have a trace level, putting logging of entering a function behind the trace level sounds sensible.
I have to split and clean up the commits, but functionally/code wise this is fine imho. Probably a bit overkill but you never know when all the details might become useful.
FYI, I initially I looked at integrating fmt
(https://github.com/fmtlib/fmt) for the formatting of the trace statements. Adding it to the project is rather simple, just three headers (fmt/core.h
, fmt/format.h
, fmt/format-inl.h
) and a compile flag (-DFMT_HEADER_ONLY
) to indicate header only. But eventually I discarded that idea because of the burden of a new external dependency and it also requires pointers to be wrapped (https://fmt.dev/latest/api.html#_CPPv4I0EN3fmt3ptrEPKv1T), so actual trace statements wouldn't be that shorter.
How much we could achieve with just C++20 std::format
and some custom formatters? Or is Proton Runtime's compiler too old to support this?
How much we could achieve with just C++20
std::format
and some custom formatters? Or is Proton Runtime's compiler too old to support this?
I wasn't keen to try out :), also dunno about MSVC support (GitLab CI).
Seems to be running fine with this. Takes a bit getting used to, but it will be a LOT easier to spot functions that uses too much time, and see if some weird parameters is passed. 👍
~just briefly tested and for actual tracing we should also log all input parameters (wine like, thus only primitives and pointer addresses). Have to think about how to do this elegantly without wasting cycles when tracing is disabled.~
Closes #180
cc: @SveSop