-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Update provider_compute_event_enable_mask so EventSouces with no keywords show up by default #75248
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
src/native/eventpipe/ep-provider.c
Outdated
@@ -145,11 +145,13 @@ provider_compute_event_enable_mask ( | |||
if (session_provider) { | |||
int64_t session_keyword = ep_session_provider_get_keywords (session_provider); | |||
EventPipeEventLevel session_level = ep_session_provider_get_logging_level (session_provider); | |||
// EventSources always set 0xF00000000000 to signify no keywords | |||
int64_t session_mask = ~0xF00000000000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than do this filtering at the point of use, how about we filter these keyword bits at the point we are initializing the event in provider_add_event?
Rats, I missed when this change went in. I may be unaware of constraints Sung was under when he did that, but this change you have here looks like a much better approach. |
If they did that they would already be seeing weird behavior under ETW. Its possible someone does it and never uses their EventSource with ETW, but the odds of that seem low enough that I am willing to risk inconveniencing them. |
Is there documentation that needs to be updated with this change? |
@mikelle-rogers no documentation needed, this is making things work as already documented |
1ee4973
to
d0a91c5
Compare
I found out via failing tests that -1 as a keyword is special and we can't modify it, so I added that check |
@davmason are you going to backport this PR to 7 and 6? |
@adamsitnik do you know of any customers that are asking for it? I'm happy to go through the process but the servicing bar requires a customer blocked on it |
@davmason From my perspective I wonder if this related to microsoft/perfview#1718
@tmds ? |
Yes, that looks like the same issue. Trying to collect EventSources using the environment variables is broken. You can work around by either using dotnet-trace to collect instead, or setting keywords to 0xFFFFFFFF for any EventSources you want events from. If we have people asking for the fix just point them to me and I can start the servicing process |
Then this would be me as I want to publish a new BenchmarkDotNet version with the I need the BDN events to be able to tell when given benchmark iteration started and finished to be able to implement detection of regression on top of it. This year I am aiming at adding a BDN feature where the user just specifies the benchmark that has regressed between .NET releases, BDN runs it with profiler attached, loads the trace file using Trace Event, filters it based on the events to selected time frame and then uses Trace Event to diff the traces and just tell the user where the regression is. |
I'm happy to take it to servicing if that is the best outcome, but the next servicing date is in January so no fixes would be available until then. I suspect it will work better for you to find a workaround Are you able to use the diagnostics client instead of the environment variables? https://learn.microsoft.com/en-us/dotnet/core/diagnostics/diagnostics-client-library There is already a workaround in that library and you wouldn't have to wait on any servicing fixes, the client and runtime support attaching to your own process and attaching at startup, so it should work for most scenarios |
…ords show up by default (dotnet#75248) Update ep-provider.c
…Pipe sessions (#75248) (#77811) * Update provider_compute_event_enable_mask so EventSouces with no keywords show up by default (#75248) Update ep-provider.c * Update ep-provider.c * Update src/native/eventpipe/ep-provider.c Co-authored-by: Juan Hoyos <juan.hoyos@microsoft.com> Co-authored-by: Juan Hoyos <juan.hoyos@microsoft.com>
Fixes dotnet/diagnostics#3298
EventSource uses bits 44-47 of the keywords to store data about sessions:
runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs
Lines 5071 to 5073 in 01d1c8c
And we set them all to 1 by default in the manifest:
runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs
Lines 3428 to 3439 in 01d1c8c
This means that when we compute whether an event should be enabled we won't turn on EventSource events by default, since the event keywords are non-zero
0xF00000000000
:runtime/src/native/eventpipe/ep-provider.c
Line 152 in 01d1c8c
We have a workaround in the DiagnosticClient introduced here: dotnet/diagnostics#1091, but any other way of enabling EventPipe (env vars, other clients, etc) will still have this issue.
This fix lets the default EventSource keyword act as if it were 0 for all sessions.
This does have two compat issues
0x20000000000
so we are very close to that number. I don't think we have a choice regardless of this change though, due to EventSource treating those bits as reserved.