Skip to content

Conversation

@psiddh
Copy link
Contributor

@psiddh psiddh commented Dec 22, 2025

Enhances existing EXECUTORCH_ANDROID_PROFILING with runtime control API.
Replaces hardcoded profiling with flexible, production-ready implementation.

New Capabilities:

  • Runtime profiling control via ETDump.enableProfiling()/disableProfiling()
  • Configurable output paths (no root access required)
  • Programmatic data access with getETDumpData()
  • Zero performance overhead when profiling is disabled
  • Single APK deployment (enable/disable at runtime)

Implementation:

  • Add ETDump.java: Public Java API for profiling control
  • Add executorch_jni_etdump.cpp: JNI implementation with global ETDumpManager
  • Modify jni_layer.cpp: Integrate ETDump with Module loading
  • Modify CMakeLists.txt: Enhance EXECUTORCH_ANDROID_PROFILING flag

Backward Compatible:

  • Same build flag (EXECUTORCH_ANDROID_PROFILING)
  • Default behavior: profiling disabled (zero overhead)
  • Users who already enable profiling get new features automatically

Usage:
// Build with: -DEXECUTORCH_ANDROID_PROFILING=ON

ETDump.enableProfiling("/sdcard/profile.etdump"); Module module = Module.load("model.pte"); module.forward(inputs); ETDump.writeETDump(); ETDump.disableProfiling();

Summary

[PLEASE REMOVE] See CONTRIBUTING.md's Pull Requests for ExecuTorch PR guidelines.

[PLEASE REMOVE] If this PR closes an issue, please add a Fixes #<issue-id> line.

[PLEASE REMOVE] If this PR introduces a fix or feature that should be the upcoming release notes, please add a "Release notes: " label. For a list of available release notes labels, check out CONTRIBUTING.md's Pull Requests.

Test plan

Test Command: EXECUTORCH_ANDROID_PROFILING=ON sh scripts/build_android_library.sh

@pytorch-bot
Copy link

pytorch-bot bot commented Dec 22, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/16359

Note: Links to docs will display an error until the docs builds have been completed.

❌ 7 New Failures, 5 Unrelated Failures

As of commit 24ee8a9 with merge base 479791d (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 22, 2025
@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@Gasoonjia
Copy link
Contributor

Mind hint me about the relationship between Android ETDump and devtool one? Basically it is our ETDump + an Android Wrapper if I understand corrent?

@psiddh
Copy link
Contributor Author

psiddh commented Dec 23, 2025

Mind hint me about the relationship between Android ETDump and devtool one? Basically it is our ETDump + an Android Wrapper if I understand corrent?

Yes Android ET Dump is simply a wrapper , Core ETDump + High level Android Dump helper APIs , making it very flexible for Android apps to profile dynamically

@psiddh psiddh force-pushed the et_dump branch 2 times, most recently from fc48173 to 1c67290 Compare December 23, 2025 02:31
  Enhances existing EXECUTORCH_ANDROID_PROFILING with runtime control API.
  Replaces hardcoded profiling with flexible, production-ready implementation.

  New Capabilities:
  - Runtime profiling control via ETDump.enableProfiling()/disableProfiling()
  - Configurable output paths
  - Programmatic data access with getETDumpData()
  - Zero performance overhead when profiling is disabled
  - Single APK deployment (enable/disable at runtime)

  Implementation:
  - Add ETDump.java: Public Java API for profiling control
  - Add executorch_jni_etdump.cpp: JNI implementation with global ETDumpManager
  - Modify jni_layer.cpp: Integrate ETDump with Module loading
  - Modify CMakeLists.txt: Enhance EXECUTORCH_ANDROID_PROFILING flag

  Backward Compatible:
  - Same build flag (EXECUTORCH_ANDROID_PROFILING)
  - Default behavior: profiling disabled (zero overhead)
  - Users who already enable profiling get new features automatically

  Usage:
    // Build with: -DEXECUTORCH_ANDROID_PROFILING=ON

    ETDump.enableProfiling("/sdcard/profile.etdump");
    Module module = Module.load("model.pte");
    module.forward(inputs);
    ETDump.writeETDump();
    ETDump.disableProfiling();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants