facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.18k stars 24.32k forks source link

systrace doesn't include JS or native modules thread info #26032

Closed evelant closed 1 year ago

evelant commented 5 years ago

I'm using systrace via the process detailed in the documentation. In my trace results there is no useful JS thread or native modules thread info. This makes it more or less useless for profiling my app.

React native version:

System:
    OS: macOS 10.14.6
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 791.28 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 8.11.3 - ~/.nvm/versions/node/v8.11.3/bin/node
    Yarn: 1.17.3 - ~/.yarn/bin/yarn
    npm: 6.10.1 - ~/.nvm/versions/node/v8.11.3/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
  IDEs:
    Android Studio: 3.4 AI-183.5429.30.34.5452501
    Xcode: 10.3/10G8 - /usr/bin/xcodebuild
  npmPackages:
    @react-native-community/cli: ^2.9.0 => 2.9.0 
    react: 16.9.0 => 16.9.0 
    react-native: ^0.60.5 => 0.60.5 
  npmGlobalPackages:
    create-react-native-app: 2.0.2
    react-native-macos-cli: 2.0.1

Steps To Reproduce

  1. Take a systrace profile per the documentation
  2. Open profile and note that the JS and native modules threads don't contain useful information like they do in the documentation example

Describe what you expected to happen: JS and native modules threads appear in the systrace as per the documentation. See the following screenshots of my trace -- the JS and native modules information is missing. There is mqt_js and mqt_native_mod in the trace but they don't contain any meaningful data like the documentation example. This trace definitely contains some heavy JS work but it appears like it isn't recorded.

image

image

image

Snack, code example, screenshot, or link to a repository: Example trace: https://www.dropbox.com/s/n0ig26bctwq359k/trace.html?dl=0

react-native-bot commented 5 years ago

It looks like you are using an older version of React Native. Please update to the latest release, v0.60 and verify if the issue still exists.

The "Resolution: Old Version" label will be removed automatically once you edit your original post with the results of running `react-native info` on a project using the latest release.
evelant commented 5 years ago

I updated to latest react native. Problem still persists, there is no useful information about the js or native modules threads like is shown in the documentation. A trace file can be found here: https://www.dropbox.com/s/n0ig26bctwq359k/trace.html?dl=0

react-native-bot commented 5 years ago

Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?

👉 Click here if you want to take another look at the Bug Report issue template.

evelant commented 5 years ago

The issue does conform to the template...?

evelant commented 5 years ago

Anything I can do here? The bot seems to have erroneously confined my issue to the dustbin.

stale[bot] commented 4 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

evelant commented 4 years ago

This issue never got examined. I think it got ignored because the bot flagged it as needs more information even though I provided the info. Needs discussion.

bartzy commented 4 years ago

I'm experiencing the same problem. I think this is related to the fact that FB has its own closed-source implementation of systrace that doesn't have these issues so it's not a priority (see https://github.com/react-native-community/discussions-and-proposals/issues/69#issuecomment-446115060).

vineyardbovines commented 4 years ago

Any updates here? This is a big issue on our end.

evelant commented 4 years ago

This is still an issue on latest RN 0.61.5. Symptoms are exactly the same.

System:
    OS: macOS 10.15.3
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 133.43 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.10.0 - ~/.nvm/versions/node/v12.10.0/bin/node
    Yarn: 1.19.2 - ~/.yarn/bin/yarn
    npm: 6.13.7 - ~/dev/TaskHero/node_modules/.bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      Android NDK: 21.0.6113669
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.6010548
    Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
  npmPackages:
    @react-native-community/cli: ^4.1.0 => 4.1.0
    react: 16.9.0 => 16.9.0
    react-native: github:AndrewMorsillo/react-native#0.61-stable-th-custom => 0.61.5
axe-fb commented 4 years ago

For the JS information, are you using JSC or Hermes ? JSC profiling had broken a while ago, and now that we are supporting Hermes, we have that information in the Hermes sampling profiler, which is not yet integrated into Systrace. The native modules have as much information as you have added trace markers in your code.

To solve this issue, i would recommend adding trace markers to JS and native modules to see how long the communication takes.

evelant commented 4 years ago

I am using JSC. Hermes is unfortunately not an option (at least for now) due to lack of Proxy support. My app relies heavily on mobx-state-tree which requires Proxy.

I don't quite understand what you mean by the native modules having as much information as I have added trace markers. None of the native code in my app was written by me, it's all react-native internal or npm modules. If you compare the screenshot in the issue above to the screenshot of the expected output from the docs you can see that the expected tracing information is missing from mqt_native_modules.

Can you provide a bit more detail about how I would go about adding the trace markers you're referring to? I apologize if that may seem like an obvious thing but I have little to no experience with native android code. My app has no custom native code, all native code is internal to react-native or from npm modules.

stale[bot] commented 4 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

loopiezlol commented 4 years ago

can confirm this still happens with Hermes on react 0.62

evelant commented 4 years ago

This is still an issue 1 year later. As far as I can see there are no working profiling tools for react-native Android at the moment and haven't been for a couple years. This is really painful for my team, we have customers reporting performance issues on Android but have no way to diagnose and solve them other than trial and error. Only chrome profiler appears to work but as we all know that doesn't offer a picture of what's really happening, only a somewhat relative measurement of perf against itself using v8 with debug mode caveats. @axe-fb can you offer any guidance about the state of performance profiling for RN Android?

netlemur commented 4 years ago

can confirm this still happens on 0.63.3 – with or without Hermes.

DrRefactor commented 3 years ago

Issue also happens on V8.

zbycz commented 3 years ago

JS thread still not recorded:

image

Would it be possible to realase the facebook's internal systrace tool, which is capable of showing the data?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

DrRefactor commented 1 year ago

unstale

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 7 days with no activity.