Skip to content
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

TraceEvent - CaptureState API does not seem to work when using keywords that have not already been enabled in the session #2132

Open
ivberg opened this issue Nov 25, 2024 · 0 comments

Comments

@ivberg
Copy link
Contributor

ivberg commented Nov 25, 2024

TraceEvent - CaptureState API does not seem to work when using keywords that have not already been enabled in the session.

Repro:

  1. Enable a provider with keywords
public const long MICROSOFT_KEYWORD_MEASURES = 0x0000400000000000;
public static readonly Guid Microsoft_ML_ONNXRuntime_Provider = new Guid("3a26b1ff-7484-7484-7484-15261f42614d"); // Microsoft.ML.ONNXRuntime
session.EnableProvider(Microsoft_ML_ONNXRuntime_Provider, TraceEventLevel.Verbose, MICROSOFT_KEYWORD_MEASURES);
  1. Call CaptureState with a different set of keywords
const ulong ORTTraceLoggingKeyword_Session = 0x1;
session.CaptureState(Microsoft_ML_ONNXRuntime_Provider, ORTTraceLoggingKeyword_Session);
  1. CaptureState will appear to succeed but the CaptureState events are not triggered. It appears that the session needs to have the keyword set before

This does not seem to be a limitation of say xperf, which will trigger the captureState regardless using the same settings of CaptureState()
xperf -capturestate SessionName 3a26b1ff-7484-7484-7484-15261f42614d:1:5

Workaround: In EnableProvider() set the same keywords as CaptureState()
Suggested fix: Query the session and provider first and merge & enable the keywords required for CaptureState() prior to calling ETW EnableTraceEx2()

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

No branches or pull requests

1 participant