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

Fix EventPipe on Android CoreClr. #112270

Merged

Conversation

lateralusX
Copy link
Member

EventPipe CMake was causing issues when building CoreClr due to creating two versions of ep-shared-config.h with different set of variables when targeting iOS/tvOS/Android. Both include paths ended up being added and together with EventPipe's unity build, this caused issues since the wrong ep-shared-config.h was picked up, incorrect enabled default listeners as result of having wrong values for FEATURE_PERFTRACING_DISABLE_DEFAULT_LISTEN_PORT and
FEATURE_PERFTRACING_PAL_TCP. Mono doesn't
have this issue since it only creates one ep-shared-config.h.

Commit makes sure we only setup on ep-shared-config.h and eventpipe libraries adds the include folder to its library targets.

Commit also adds support to set DOTNET_DiagnosticPorts as part of building Android sample to simplify enable/disable diagnostics, similar to how Mono Android sample works.

Couple of smaller adjustments to ApkBuilder.

EventPipe CMake was causing issues when building CoreClr due to creating two versions of ep-shared-config.h with different set of variables when targeting iOS/tvOS/Android. Both include paths ended up being added and together with EventPipe's unity build, this caused issues since the wrong ep-shared-config.h was picked up, incorrect enabled default listeners as result of having wrong values for FEATURE_PERFTRACING_DISABLE_DEFAULT_LISTEN_PORT and
 FEATURE_PERFTRACING_PAL_TCP. Mono doesn't
have this issue since it only creates one ep-shared-config.h.

Commit makes sure we only setup on ep-shared-config.h and eventpipe libraries adds the include folder to its library targets.

Commit also adds support to set DOTNET_DiagnosticPorts as part of building Android sample to simplify enable/disable diagnostics, similar to how Mono Android sample works.

Couple of smaller adjustments to ApkBuilder.
@lateralusX lateralusX force-pushed the lateralusX/fix-eventpipe-coreclr-android branch from bfeec11 to 77b9c7a Compare February 7, 2025 12:50
@steveisok steveisok requested review from jkoritzinsky and a team February 7, 2025 12:53
// NOTE, using DOTNET_DiagnosticPorts requires app build using AndroidAppBuilder and RuntimeComponents to include 'diagnostics_tracing' component
#ifdef DIAGNOSTIC_PORTS
setenv ("DOTNET_DiagnosticPorts", DIAGNOSTIC_PORTS, true);
#endif
Copy link
Member

Choose a reason for hiding this comment

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

Do we need the same for AppleAppBuilder?

Copy link
Member Author

@lateralusX lateralusX Feb 7, 2025

Choose a reason for hiding this comment

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

You mean for NAOT on iOS? Not sure if that has been enabled yet. But once we do, then we could add this for iOS inline with what we do on Mono.

Copy link
Member

Choose a reason for hiding this comment

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

(NativeAOT for iOS shipped since .NET 8; CoreCLR for iOS Simulator landed on main last month)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I know, but what I don't know if NATO + iOS also includes EventPipe support, do you know?

Copy link
Member Author

@lateralusX lateralusX Feb 7, 2025

Choose a reason for hiding this comment

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

For the CoreCLR for iOS Simulator I believe we should do similar work to make sure EventPipe is build using right flags + include similar support in AppleAppBuilder, but we could do that as a separate PR.

Copy link
Member

Choose a reason for hiding this comment

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

Yes I know, but what I don't know if NATO + iOS also includes EventPipe support, do you know?

Yes, it does, in theory...although I am not sure if it ever worked or if it was tested. The GC heap events were not wired so I never bothered to use it.

Copy link
Member

@jkoritzinsky jkoritzinsky left a comment

Choose a reason for hiding this comment

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

Eventpipe infra changes look good to me

@steveisok steveisok merged commit 54ce2c4 into dotnet:main Feb 7, 2025
157 of 159 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants