Skip to content

Cleanup more EventSource calls in SPC to work better with illinker - #40539

Merged
marek-safar merged 4 commits into
dotnet:masterfrom
marek-safar:TplEventSource
Oct 9, 2020
Merged

marek-safar merged 4 commits into
dotnet:masterfrom
marek-safar:TplEventSource

Conversation

@marek-safar

Copy link
Copy Markdown
Contributor
  • Adds missing IsEnabled guard
  • Tweak the logic to be detectable by linker

- Adds missing IsEnabled guard
- Tweak the logic to be detectable by linker
@Dotnet-GitSync-Bot

Copy link
Copy Markdown
Collaborator

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@marek-safar
marek-safar requested a review from eerhardt August 7, 2020 17:17
lock (continuations) { }
int continuationCount = continuations.Count;

bool etwIsEnabled = log.IsEnabled();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are we concerned that IsEnabled() may have changed in-between the above check and now? I assume that is why the existing code is written the way it was.

cc @stephentoub

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was actually looking at the existing cases and we are pretty inconsistent on this

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not store this Boolean at the top of the method, where it was storing log in a variable?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I assume that is why the existing code is written the way it was.

Yes. The goal was to avoid output the subsequent events if and only if the starting event was written.

// we will still flow it to ScheduleAndStart() were it will check the status before running
// We check here to avoid faulty logs that contain a join event to an operation that was already set as completed.
if (!continuationTask.IsCanceled && TplEventSource.Log.IsEnabled())
if (TplEventSource.Log.IsEnabled() && !continuationTask.IsCanceled)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does the linker not handle something && false should just be false?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It does, it just didn't look right to me to do the call and then scrap it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don’t think I understand, to do what call? This was checking a property.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep but why to check the property if it's needed only when tracing is enabled. I don't feel strongly about this and could revert to the original logic event though continuationTask.IsCanceled is probably most of time false

@eerhardt

eerhardt commented Aug 7, 2020

Copy link
Copy Markdown
Member

How much savings are you seeing with this change? I didn't dig deep into this area originally, because it looked like the savings were not significant vs the risk for potential behavior change.

@marek-safar

Copy link
Copy Markdown
Contributor Author

Not a lot (few kB) but that's because there are still few cases which bring EventSource

@eerhardt eerhardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These changes look good to me. Thanks.

@marek-safar

Copy link
Copy Markdown
Contributor Author

Timeouts are unrelated, merging

@marek-safar
marek-safar merged commit ea75ac6 into dotnet:master Oct 9, 2020
@marek-safar
marek-safar deleted the TplEventSource branch October 9, 2020 17:00
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants