VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

Anyone can see why it's slow on Android? Compiled for PC(x86) it runs pretty fast, but on Android only ~2500 cycles per second(with a clock that's 4.77MHz(8086)). So in 1 second, only 2500 out of ~4770000 cycles can be emulated? That sounds ridiculous, is there something going wrong(PC x86 2.0GHz vs 1.0GHz+ Android LG-P710)?

Is there any good way to profile(getting gmon.out) from my Android device without much trouble, on Windows?

Last edited by superfury on 2017-03-21, 00:16. Edited 1 time in total.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 2, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've modified the code to use the normal RTC clock instead of plain SDL_getTicks to keep time on Android, but for some reason, it's still running VERY slow: only up to 2749 cycles/second. It should only delay (using SDL_Delay(0); ) when it notices that the current time is to be updated(current time>=emulated time). Switching to a 1000Hz rate makes it run at 5% with 40/50 cycles/second, according to measurement? Does anyone knows of a method to see what it's actually doing and why the application is so slow? The CPU it's running on is a Qualcomm MSM8225 Dual-core 1 GHz Cortex-A5 at 1GHz with a Adreno 203 GPU and 788MB RAM, according to http://phone-debate.com/phones/lg/1014/optimus-l7-ii-p710 . Still I don't see any reason why it should be this terribly slow. It's running at 100% speed on a 4.0GHz quad-core Intel i7. At ~40% speed on a 2.0GHz dual-core x86 CPU I'm using on my laptop. So the phone(Android) version should run at about 5-10% speed, which it doesn't for some reason? Why is the Android version so ridiculously slow? Anyone knows what might be causing this? It's using SDL_Delay(1) essentially every time it notices it's to wait for a next time point to execute. Is this incorrect? Or should it use SDL_Delay(0) instead on Android to archieve proper speed?

Edit: Changing the calls to use nanosleep(with 0 nanoseconds) improves speed to 4749 cycles/second instead? So it's running at 0.099% speed of a 8086? So it's almost running at 0.1% speed now? Only 1000 seconds(16 minutes and 40 seconds) to emulate one whole second accurately:P Anyone knows how to speed it up further on this slow device? It's still terribly slow compared to it's PC counterparts(with the same source code).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 2 of 2, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've managed to get it compiling by adjusting the Android makefiles(Android(_static).mk) to add the proper search paths. It now compiles, but no dmon.out file is generated after executing and closing (by minimizing using the home button and terminating the app by opening the task list and swiping it off the screen).

Edit: It didn't produce any gmon.out yet. I've just found out that the atexit(&SDL_Quit) was registered after the cleanup function for the profiler(atexit(&moncleanup)), thus never allowing it to fire, when used. This has been moved up to work properly in all cases(as well as all termination of the application being handled by exit(0) calls, instead of directly calling SDL_Quit.

Edit: Just tried it again after recompiling and installing: No gmon.out is generated on the LG-P710. It's got a Qualcomm MSM8225 Dual-core 1 GHz Cortex-A5 processor in it. According to https://www.arm.com/products/processors/corte … a/cortex-a5.php it's a ARMv7-A CPU. According to it's android_ndk_perf.py file this should be a armeabi-v7a CPU?

It says the supported devices are:

## Set of tested devices that are known to support perf. SUPPORTED_DEVICES = set([ 'mantaray', # Nexus 10 'nakasi', # […]
Show full quote

## Set of tested devices that are known to support perf.
SUPPORTED_DEVICES = set([
'mantaray', # Nexus 10
'nakasi', # Nexus 7 (2012)
])

So that's a 1,7 GHz Dualcore Cortex-A15 CPU(Nexus 10) and 1: 1,2 GHz Quadcore NVIDIA Tegra 3 T30L 2: 1,5 GHz Quadcore Qualcomm Snapdragon S4 Pro(Nexus 7) CPUs that are supported. Does this mean my device supports this profiling method? I still don't see any gmon.out being generated on either disk?

I'm using the compiled version(run ndk-build in the folder where it's repository is at(android-ndk-r12b\sources\android-ndk)). Both compile without problems as far as I can see? I've run it and terminated the application the usual way(pressing home until the tasks show, then swiping the app off the screen to terminate it). Why am I not getting a gmon.out in the SDCard root directory(or UniPCemu directory or external SD card root)?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io