[Native] Migrate timing logging to printf#12153
Open
simonrozsival wants to merge 5 commits into
Open
Conversation
Use #12140 printf helpers for shared timing diagnostics while preserving MonoVM std::format behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 70f63eb7-6599-414c-a947-d860705aa0fa
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates shared native timing logging for CoreCLR/NativeAOT to the printf-style helpers introduced in #12140, while keeping MonoVM’s existing std::format-based timing output behind XA_HOST_MONOVM.
Changes:
- Switch
Timing::do_log()(managed timing records) tolog_writef()for CoreCLR/NativeAOT while preserving MonoVM’sstd::formatpath. - Migrate several FastTiming diagnostics (buffer growth, clock failures, unknown kinds, invalid indices) to
log_warnf()for CoreCLR/NativeAOT, preserving MonoVM’s existing logging path.
Show a summary per file
| File | Description |
|---|---|
| src/native/common/include/runtime-base/timing.hh | Use log_writef() for CoreCLR/NativeAOT managed timing record formatting; keep MonoVM on std::format. |
| src/native/common/include/runtime-base/timing-internal.hh | Use log_warnf() for CoreCLR/NativeAOT FastTiming diagnostics under compile-time guards; keep MonoVM behavior unchanged. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 70f63eb7-6599-414c-a947-d860705aa0fa
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 70f63eb7-6599-414c-a947-d860705aa0fa
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 70f63eb7-6599-414c-a947-d860705aa0fa
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 70f63eb7-6599-414c-a947-d860705aa0fa
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Continue the printf-style logging migration introduced by #12140 in the shared native timing infrastructure.
The timing headers are used by MonoVM, CoreCLR, and NativeAOT. All three runtimes now use the same printf-style path for variable timing diagnostics rather than maintaining MonoVM-only
std::formatbranches.Base/dependency: #12140 must merge first. This PR targets
dev/simonrozsival/nativeaot-printf-loggingso its diff contains only the timing migration.Part of #12139.
Scope
Only two shared timing headers change:
src/native/common/include/runtime-base/timing.hhsrc/native/common/include/runtime-base/timing-internal.hhThese files do not overlap #12141, #12142, #12145, #12148, #12150, or #12155.
Changes
Managed timing records
std::formatresult inTiming::do_log()withlog_writef()for every runtime;message; elapsed: seconds:milliseconds::nanosecondsfield order;unsigned long longvalues matching%llu.Fast timing diagnostics
Migrate variable diagnostics to
log_warnf()for every runtime:CLOCK_MONOTONIC_RAWerrors;Constant warning messages continue using the existing non-formatting
string_viewoverload.Behavior preserved
Runtime behavior
Measured impact
Representative Android arm64 Release objects compiled before the MonoVM path was unified:
internal-pinvokes-clr.cc.ohost.cc.oCoreCLR's representative object drops from 58 formatting symbols to zero. NativeAOT's representative object still contains formatting symbols from other included functionality, but the timing call sites migrated here no longer instantiate them.
Non-goals
Validation
git diff --check;21ff66b26.