Skip to content

[Runtime] Add tracing for section scans. #66377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2023

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented Jun 6, 2023

Section scans (for metadata, protocols, etc.) can be costly. This change adds tracing calls to those scans so we can more easily see how much time is spent in these scans and where they're initiated.

This adds an os_signpost implementation controlled by SWIFT_STDLIB_TRACING, and a default empty implementation for when that's disabled.

rdar://110266743

@mikeash mikeash requested a review from al45tair June 6, 2023 18:37
@mikeash
Copy link
Contributor Author

mikeash commented Jun 6, 2023

@swift-ci please test

@al45tair
Copy link
Contributor

al45tair commented Jun 7, 2023

/Users/ec2-user/jenkins/workspace/swift-PR-macos/branch-main/swift/stdlib/public/runtime/Tracing.h:62:5: error: '_os_signpost_emit_with_name_impl' is only available on iOS 12.0 or newer [-Werror,-Wunguarded-availability-new]
    os_signpost_interval_end(ScanLog, signpostID, SWIFT_LOG_SECTION_SCAN,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I think this needs some availability checks.

@mikeash
Copy link
Contributor Author

mikeash commented Jun 7, 2023

We check a representative symbol for NULL instead, but of course the compiler doesn't know that. The signpost stuff in the concurrency runtime disables the availability warnings, I'll do the same here.

@mikeash mikeash force-pushed the section-scan-signposts branch from 8ab85e0 to 8d0fa6f Compare June 7, 2023 13:58
@mikeash
Copy link
Contributor Author

mikeash commented Jun 7, 2023

@swift-ci please test

@mikeash
Copy link
Contributor Author

mikeash commented Jun 8, 2023

@swift-ci please smoke test

@mikeash
Copy link
Contributor Author

mikeash commented Jun 13, 2023

I keep forgetting to look at the failures until after they expire.

@mikeash
Copy link
Contributor Author

mikeash commented Jun 13, 2023

@swift-ci please smoke test

@mikeash
Copy link
Contributor Author

mikeash commented Jun 13, 2023

Finally got it:

[ RUN      ] BackwardDeployProtocol.ConditionalConformance
stderr>>> CRASHED: SIGSEGV
the test crashed unexpectedly
[     FAIL ] BackwardDeployProtocol.ConditionalConformance

We must not be tolerating NULL somewhere we need to.

@mikeash mikeash force-pushed the section-scan-signposts branch from 8d0fa6f to e8f334b Compare June 13, 2023 20:56
@mikeash
Copy link
Contributor Author

mikeash commented Jun 13, 2023

@swift-ci please test and merge

Section scans (for metadata, protocols, etc.) can be costly. This change adds tracing calls to those scans so we can more easily see how much time is spent in these scans and where they're initiated.

This adds an os_signpost implementation controlled by SWIFT_STDLIB_TRACING, and a default empty implementation for when that's disabled.

rdar://110266743
@mikeash mikeash force-pushed the section-scan-signposts branch from e8f334b to 110f428 Compare June 14, 2023 16:07
@mikeash
Copy link
Contributor Author

mikeash commented Jun 14, 2023

@swift-ci please test and merge

@swift-ci swift-ci merged commit 12b1843 into swiftlang:main Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants