Unable to get JS function names in HermesSamplingProfiler
- Dominant language
- JavaScript
- Stars
- 11.3k
- Forks
- 859
- Avg merge
- 1h 30m
- Merged PRs (30d)
- 3
Description
I have been trying to use HermesSamplingProfiler for the release builds in order to get function execution flamechart. But for some reason , some of the JS function names are missing in the trace.
Repro - https://github.com/demon-sword/sampleAppProfiling
This is a sample App which is using react-native-release-profiler(https://github.com/margelo/react-native-release-profiler) which internally uses HermesSamplingProfiler to generate the trace.
```
startProfiling()
function App(): React.JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
const backgroundStyle = {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};
return (
{
stopProfiling(true)
}}/>
);
}
```
[sampling-profiler-trace-1.cpuprofile.txt](https://github.com/user-attachments/files/15525281/sampling-profiler-trace-1.cpuprofile.txt)
As you can see in the image that there is only App component is available in the trace. Nothing About Component1 in the trace and there are some empty blocks in the trace as well.
The things I have tried -:
1. Class components
2. Functional Components
3. Exporting components by default
4. Adding displayNames to components
5. Tried with Arrow function components as well
6. Disabling minification of js bundle.
7. Tried on nightly as well
React Native version: 0.74.1
OS: Android
## Steps To Reproduce
1. Create a release build with the given repo.
2. Run the build and click on stopprofiling button on the screen.
3. A trace will be saved in the downloads folder.
4. open the trace in speedscope.com
Contributor guide
Assessment
This issue has not been assessed yet.