Skip to content

Conversation

speednoisemovement
Copy link
Contributor

@speednoisemovement speednoisemovement commented Sep 17, 2025

Currently, summary timings are emitted at the end of operations. Each operation that needs to be timed has to instantiate a stopwatch when it begins, and writes the time provided by the stopwatch when it ends. This can cause nested operations to double-count elapsed time.

This change introduces two functional changes:

  • Nested steps are now visually displayed as children of their parent step
  • Only top-level steps contribute to the total time calculation

To allow for this, we need to track the operation from the beginning instead of just reporting at the end. Any block of code can now be timed by wrapping it in a Record-OperationTime call.

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand the self-time vs total time. I get that an interior node will need a view of the summation of the sub-times, but why is the self-time useful there? That is, why not just have a singular value? What does the second timing give us?

@speednoisemovement
Copy link
Contributor Author

speednoisemovement commented Sep 17, 2025

What does the second timing give us?

Makes it obvious what we're not capturing elsewhere. For example, it's clear that Build-SDK is just a wrapper, but more than 50% of Build-ExperimentalSDK isn't otherwise timed. I did write this before I saw that the nesting only goes 1 level deep at the moment, so maybe it's overkill, but I do think it has value. Up to you!

@compnerd
Copy link
Member

What does the second timing give us?

Makes it obvious what we're not capturing elsewhere. For example, it's clear that Build-SDK is just a wrapper, but more than 50% of Build-ExperimentalSDK isn't otherwise timed. I did write this before I saw that the nesting only goes 1 level deep at the moment, so maybe it's overkill, but I do think it has value. Up to you!

I think that we should try to keep this simple for now. The additional complexity can be added when needed.

@speednoisemovement
Copy link
Contributor Author

What does the second timing give us?

Makes it obvious what we're not capturing elsewhere. For example, it's clear that Build-SDK is just a wrapper, but more than 50% of Build-ExperimentalSDK isn't otherwise timed. I did write this before I saw that the nesting only goes 1 level deep at the moment, so maybe it's overkill, but I do think it has value. Up to you!

I think that we should try to keep this simple for now. The additional complexity can be added when needed.

Done

@compnerd
Copy link
Member

@swift-ci please smoke test

@compnerd compnerd enabled auto-merge September 19, 2025 16:49
@compnerd compnerd merged commit 76f44fe into swiftlang:main Sep 19, 2025
3 checks passed
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.

2 participants