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

[docs] .NET 8 simplified dotnet-trace instructions #8436

Merged

Conversation

jonathanpeppers
Copy link
Member

Context: dotnet/diagnostics#4081
Context: dotnet/diagnostics#4090
Context: dotnet/runtime#88634
Context: dotnet/diagnostics#4337

Using the latest dotnet-trace tooling:

> dotnet tool list -g
Package Id                         Version                       Commands
--------------------------------------------------------------------------------------
dotnet-dsrouter                    7.0.447801                    dotnet-dsrouter
dotnet-gcdump                      7.0.447801                    dotnet-gcdump
dotnet-trace                       7.0.447801                    dotnet-trace

There is a simplified way to profile Android apps.

For an Android emulator:

> dotnet-dsrouter android-emu
Start an application on android emulator with one of the following environment variables set:
DOTNET_DiagnosticPorts=10.0.2.2:9000,nosuspend,connect
DOTNET_DiagnosticPorts=10.0.2.2:9000,suspend,connect
> adb shell setprop debug.mono.profile '10.0.2.2:9000,suspend,connect'
> dotnet-trace ps
3248  dotnet-dsrouter
> dotnet-trace collect -p 3248
...
[00:00:00:09]   Recording trace 3.2522   (MB)
Press <Enter> or <Ctrl+C> to exit...

For an Android device you will eventually be able to do dotnet-dsrouter android, except we found one issue.

Until dotnet/diagnostics#4337 is resolved, we can instead do:

> adb reverse tcp:9000 tcp:9001
> dotnet-dsrouter server-server -tcps 127.0.0.1:9001
> adb shell setprop debug.mono.profile '127.0.0.1:9000,suspend,connect'
> dotnet-trace ps
> dotnet-trace collect -p 3248

We can also now use dotnet-gcdump! Instead of dotnet-trace collect -p, you can simply do:

> dotnet-gcdump collect -p 3248

In both cases these tools know that the process ID is a dotnet-dsrouter process and to do the right thing.

Context: dotnet/diagnostics#4081
Context: dotnet/diagnostics#4090
Context: dotnet/runtime#88634
Context: dotnet/diagnostics#4337

Using the latest `dotnet-trace` tooling:

    > dotnet tool list -g
    Package Id                         Version                       Commands
    --------------------------------------------------------------------------------------
    dotnet-dsrouter                    7.0.447801                    dotnet-dsrouter
    dotnet-gcdump                      7.0.447801                    dotnet-gcdump
    dotnet-trace                       7.0.447801                    dotnet-trace

There is a simplified way to profile Android apps.

For an Android emulator:

    > dotnet-dsrouter android-emu
    Start an application on android emulator with one of the following environment variables set:
    DOTNET_DiagnosticPorts=10.0.2.2:9000,nosuspend,connect
    DOTNET_DiagnosticPorts=10.0.2.2:9000,suspend,connect
    > adb shell setprop debug.mono.profile '10.0.2.2:9000,suspend,connect'
    > dotnet-trace ps
    3248  dotnet-dsrouter
    > dotnet-trace collect -p 3248
    ...
    [00:00:00:09]   Recording trace 3.2522   (MB)
    Press <Enter> or <Ctrl+C> to exit...

For an Android device you will eventually be able to do `dotnet-dsrouter
android`, except we found one issue.

Until dotnet/diagnostics#4337 is resolved, we can instead do:

    > adb reverse tcp:9000 tcp:9001
    > dotnet-dsrouter server-server -tcps 127.0.0.1:9001
    > adb shell setprop debug.mono.profile '127.0.0.1:9000,suspend,connect'
    > dotnet-trace ps
    > dotnet-trace collect -p 3248

We can also now use `dotnet-gcdump`! Instead of `dotnet-trace collect
-p`, you can simply do:

    > dotnet-gcdump collect -p 3248

In both cases these tools *know* that the process ID is a
`dotnet-dsrouter` process and to do the right thing.
@jonathanpeppers jonathanpeppers merged commit accca4b into dotnet:main Oct 18, 2023
45 of 47 checks passed
@jonathanpeppers jonathanpeppers deleted the dotnet-trace-simplified branch October 18, 2023 16:30
grendello added a commit to grendello/xamarin-android that referenced this pull request Oct 19, 2023
* main:
  Bump to xamarin/monodroid@47bdaaa9 (dotnet#8433)
  [docs] .NET 8 simplified `dotnet-trace` instructions (dotnet#8436)
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants