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

Perfetto integration #8899

Open
wants to merge 64 commits into
base: main
Choose a base branch
from
Open

Perfetto integration #8899

wants to merge 64 commits into from

Conversation

grendello
Copy link
Member

@grendello grendello commented Apr 24, 2024

Perfetto is a tracing/profiling system integrated into Android, that allows
application performance tracing within the context of entire operating system. This allows one to
see the full picture of how application performs within the larger environment, taking into account
contexts like GPU rendering time, windowing system compositing time, time spent sleeping in a thread etc.

.NET for Android includes support for recording several kinds of performace measurements using Perfetto:

  • Managed method invocation time
  • Class instantiation time
  • Assembly load time

These events are recorded together with other measurements supported by Perfetto itself and can be visualized
using the Perfetto UI (an offline in-browser JavaScript application). The UI also
supports converting the collected traces into other formats, including nettrace.

Perfetto support is not included in the .NET for Android runtime by default, since its inclusion increases
the runtime and APK size. In order to enable Perfetto support, it is necessary to set the "private" _AndroidEnablePerfetto
MSBuild property to true.

With that property set, the application can be used as usual, with Perfetto trace recording enabled at any
chosen point in time, using mechanisms external to .NET for Android and the application. The mechanisms are
described in detail on the following web pages:

  1. Quickstart: Record traces on Android
  2. Capture a system trace on a device

After recording the trace using whichever method, location of the trace file to download from device (e.g.
using adb pull)
can be determined by looking at the logcat output captured from the device. The location is logged by Android
component called Traceur, and looks similar to the entry below:

05-13 17:25:17.186  3705  9320 V Traceur : Saving perfetto trace to /data/local/traces/trace-raven-AP1A.240405.002-2024-05-13-17-25-16.perfetto-trace

grendello and others added 30 commits April 4, 2024 13:27
Changes: https://discourse.llvm.org/t/llvm-18-1-0-released/77448
Changes: https://discourse.llvm.org/t/llvm-18-1-1-released/77540
Changes: https://discourse.llvm.org/t/18-1-2-released/77821
Changes: https://discourse.llvm.org/t/18-1-3-released/78136

Changes interesting for us:

   * AArch64 backend
      * Added support for Cortex-A520, Cortex-A720 and Cortex-X4 CPUs.
      * Assembler/disassembler support has been added for 2023 architecture extensions.
      * Support has been added for Stack Clash Protection. During function frame creation
         and dynamic stack allocations, the compiler will issue memory accesses at regular
         intervals so that a guard area at the top of the stack can’t be skipped over.
   * x86 backend
       * The i128 type now matches GCC and clang’s __int128 type. This mainly benefits external
          projects such as Rust which aim to be binary compatible with C, but also fixes code
          generation where LLVM already assumed that the type matched and called into libgcc
          helper functions.

**Full Changelog**: xamarin/xamarin-android-binutils@L_17.0.6-7.2.1...L_18.1.3-8.0.0
Bumps [external/Java.Interop](https://github.com/xamarin/java.interop) from `651de42` to `e1c7832`.
- [Commits](xamarin/java.interop@651de42...e1c7832)

---
updated-dependencies:
- dependency-name: external/Java.Interop
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the list of submodules that dependabot ignores when checking for
updates.  Repos which are no longer valid have been removed and recently
added xxhash repos have been added to this list.
* main:
  Bump to dotnet/installer@0bfd2dd757 9.0.100-preview.4.24208.2 (#8862)
  [ci] Update dependabot ignore list (#8864)
  Bump external/Java.Interop from `651de42` to `e1c7832` (#8836)
  Bumps LLVM to v18.1.3 and XA utils version to 8.0.0 (#8852)
* main:
  Don't use azureedge.net CDN (#8846)
Neither runtime nor other native libraries are built yet
Some libs build already. monodroid still not built.
* main:
  Bump to dotnet/installer@7380c301c1 9.0.100-preview.4.24215.2 (#8874)
  [Mono.Android] Commit baseline PublicAPI files for API-35 (#8840)
  Add a unit test to check environment processing (#8856)
* main:
  Bump external/xamarin-android-tools from `37d79c9` to `05f9a90` (#8869)
  Bump external/Java.Interop from `e1c7832` to `06214ff` (#8878)
...remove unused p/invoke + associated code (`monodroid_store_package_name`)
...fix endless recursion caused by a typo in `Util::ends_with` overload
...fix p/invoke include generation script
...update p/invoke dispatcher accordingly
To include `libxamarin-native-tracing.so`, one has to request it by
setting the `$(_AndroidEnableNativeStackTracing)` MSBuild property
to `true`
Using `std::source_location` we can now report on, well, source location
without having to resort to C macros.
* main:
  Bump to xamarin/xamarin-android-binutils@758d2e7 (#8885)
  [Mono.Android] Bind API-VanillaIceCream Beta 1 (#8891)
  [AndroidToolTask] Log tool output as error  (#8861)
  [Xamarin.Android.Build.Tasks] Remove "Xamarin" from messages (#8884)
  [Mono.Android] Bind API-VanillaIceCream Developer Preview 2 (#8741)
  Bump to dotnet/installer@22ffa42d6c 9.0.100-preview.4.24221.5 (#8887)
* main:
  Bump to xamarin/monodroid@a5742221b3 (#8893)
  Remove MonoArchive_BaseUri from Configurables.cs (#8890)
* main:
  [docs] Reorganize public Documentation (#8889)
  Bump external/Java.Interop from `06214ff` to `6cfa78c` (#8879)
  Localized file check-in by OneLocBuild Task (#8894)
  $(AndroidPackVersionSuffix)=preview.5; net9 is 34.99.0.preview.5 (#8896)
* main:
  [build] Bump $(AndroidNetPreviousVersion) to 34.0.95 (#8898)
* main:
  Update README (#8913)
  Bumps to xamarin/java.interop@4e893bf (#8924)
  Bump to dotnet/installer@fa261b952d 9.0.100-preview.5.24253.16 (#8921)
  [Mono.Android] Dispose of the `RunnableImplementor` on error (#8907)
  Bump NDK to r26d (#8868)
Events are recorded under the correct package name, organized in
a track per event class.  Some names are added as debug
annotations (assembly and image name) since they're not available when
the event starts and the event name must be the same at the beginning
and at finish.
* main:
  [docs] Add "Getting Started" docs (#8934)
  [Xamarin.Android.Build.Tests] Fix ActionBarSherlock URL (#8926)
Still can't figure out why some events show up in the trace only once,
during first session after device reboot.
* main:
  It's ".NET for Android", not ".NET Android" (#8933)
* main:
  [trimming] fix custom applications for `TrimMode=full` (#8936)
* main:
  [build] bump to `$(AndroidNetPreviousVersion)` 34.0.113 (#8943)
Base automatically changed from dev/grendel/native-tracing to main May 16, 2024 14:08
* main:
  [Mono.Android] AndroidMessageHandler should follow HTTP-308 redirects (#8951)
  [Microsoft.Android.Templates] Add icons to templates (#8883)
  [native] Native call tracing infra + native build system overhaul (#8857)
  [build] fix code-flow from dotnet/installer, .NET 9.0.100-preview.5.24262.2 (#8949)
  [ci] Re-enable to push to dotnet9 feed (#8950)
  LEGO: Merge pull request 8952
  [ci] Improve maestro artifact publishing (#8945)
* main:
  Localized file check-in by OneLocBuild Task (#8974)
  Bump to xamarin/xamarin-android-binutils@97b574b (#8969)
  [Mono.Android] Bind API-VanillaIceCream Beta 2 (#8948)
  [ci] Update OneLocBuildToken (#8973)
  [s360] Ignore irrelevant lz4+Python warnings (#8962)
  LEGO: Merge pull request 8971
  Localized file check-in by OneLocBuild Task (#8963)
  [ci] Use long version for maestro publishing (#8964)
  Localized file check-in by OneLocBuild Task (#8957)
  LEGO: Merge pull request 8958
* main:
  [ci] Update .NET version installed for MAUI tests (#8995)
  [ci] Run "Push Internal" job on AzurePipelines-EO pool (#8991)
  [Xamarin.Android.Build.Tasks] LLVM Marshal Methods by Default, Take 2 (#8925)
  $(AndroidPackVersionSuffix)=preview.6; net9 is 34.99.0.preview.6 (#8989)
  [ci] Update path for generated `*.include.*` files (#8980)
  Bump to xamarin/xamarin-android-tools@da2c33e (#8984)
  Bump to xamarin/java.interop@f935001 (#8985)
  Bump to xamarin/monodroid@93ab95e18 (#8959)
  Force loc task pool image to windows (#8983)
  [git] Re-format `.gitmodules` (#8978)
* main:
  [GitHub] Keep GH issue templates up to date. (#8942)
@grendello grendello changed the title Dev/grendel/perfetto integration Perfetto integration Jun 4, 2024
@grendello grendello marked this pull request as ready for review June 4, 2024 10:56
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

Successfully merging this pull request may close these issues.

None yet

3 participants