Imagination PowerVR SDK Blog

[Android & PVRTrace] Cannot record a trace

pvrtrace
pvrhub

#1

Hi,



I tried the rooted and non rooted approach to record a trace on disk.

I’m gonna focus on the non rooted approach as it’s the one closest to work.

The trace file is created, it has a size of 192B and is useless as It doesn’t record the trace (basically it writes just the header of the file).



What am I doing wrong ?



I have the following “pvrtrace.cfg” file in “/sdcard”:

[host]
EglLibraryPath = /system/lib/libEGL.so
Es1LibraryPath = /system/lib/libGLESv1_CM.so
Es2LibraryPath = /system/lib/libGLESv2.so

[record]
TraceFile = /sdcard/record.pvrt
RecordData = 1
StartFrame = 0
EndFrame = 9999
SaveFrameBuffer = 0
SaveFileToDisk = 1
Network = 0
DebugInfo = 1


And I have the following logcat messages:
12-04 15:30:20.992 I/PVRTrace(I)﹕ The current working directory is /
12-04 15:30:20.992 I/PVRTrace(I)﹕ Config file found: /sdcard/pvrtrace.cfg
12-04 15:30:20.992 I/PVRTrace(I)﹕ Config File HostEs1LibPath: /system/lib/libGLESv1_CM.so
12-04 15:30:20.992 I/PVRTrace(I)﹕ Config File HostEs2LibPath: /system/lib/libGLESv2.so
12-04 15:30:20.992 I/PVRTrace(I)﹕ Config File HostEs3LibPath:
12-04 15:30:20.992 I/PVRTrace(I)﹕ Processes excluded from recording: com.powervr.PVRHub
12-04 15:30:20.992 I/PVRTrace(I)﹕ Opening trace file to record: /sdcard/record.pvrt
12-04 15:30:21.031 D/dalvikvm﹕ No JNI_OnLoad found in /system/lib/libEGL_PVRTRACE.so 0x40ce8798, skipping init
12-04 15:30:21.031 D/dalvikvm﹕ No JNI_OnLoad found in /system/lib/libGLESv2_PVRTRACE.so 0x40ce8798, skipping init
12-04 15:30:21.031 D/dalvikvm﹕ No JNI_OnLoad found in /system/lib/libPVRTrace.so 0x40ce8798, skipping init


The trace file "/sdcard/record.pvrt" contains:
PVRTrace??
3.2@2654748PAndroidLinux 3.0.31-fh-04822-gdd7b078-dirty #113 SMP PREEMPT Mon Nov 25 15:50:53com.test.app'!?????????????


My device:
Android: 4.0.3 (aka API 15)
Kernel: Linux localhost 3.0.31-fh-04822-gdd7b078-dirty #113 SMP PREEMPT Mon Nov 25 15:50:53 PST 2013 armv7l GNU/Linux
CPU: omap 4470
GPU: POWERVR_SGX544_112
GPU driver: Version SGX_DDK_Android sgxddk 19 1.9.RC2@2139099 (release) omap4430_android, System Version String SGX revision = 1.1.2


FYI:
I've followed the official docs of PVRTrace and this post https://www.imgtec.com/index.php/powervr-developers/pvrtrace-and-rootless-recording-on-android

#2

Hi,



This error looks to me like an issue with permissions writing to the SD card. Does your app have permissions to write to the SD card?



Just add to the AndroidManifest.xml:





Cheers,

Guillem


#3

I have set :











The sd card permission is right as the file is created (192B) and I have around 2GB left on the sd card.


#4

Any idea ?


#5

Hi,



As a test, can you set the “TraceFile =” pvrtrace.cfg flag to point to your application’s /data/data/ directory?



Thanks,

Joe


#6

Hi,



Have you made any progress with this? A colleague spotted something unusual in your log.

12-04 15:30:21.031 D/dalvikvm﹕ No JNI_OnLoad found in /system/lib/libEGL_PVRTRACE.so 0x40ce8798, skipping init

You should not be linking to libEGL_PVRTRACE.so in this location. It seems like you may be statically loading the .so incorrectly. Your static linking code should be something like:

System.load("/data/data/[appNameHere]/lib/libEGL_PVRTRACE.so");



Can you review your code and let us know if this the cause of the problem?



Thanks,

Joe


#7

Hi Joe,



It seems that the approach you are suggesting is the one for non-rooted devices (as .so are packages in the app). I tried it and it doesn’t help.



01-14 17:44:35.539 D/dalvikvm﹕ Trying to load lib /data/data/[myAppPackage]/lib/libPVRTrace.so 0x40ce95e0

01-14 17:44:35.546 I/PVRTrace(I)﹕ The current working directory is /

01-14 17:44:35.546 I/PVRTrace(I)﹕ Config file found: /sdcard/pvrtrace.cfg

01-14 17:44:35.546 I/PVRTrace(I)﹕ Config File HostEs1LibPath: /data/data/[myAppPackage]/lib/libGLESv1_CM_PVRTRACE.so

01-14 17:44:35.546 I/PVRTrace(I)﹕ Config File HostEs2LibPath: /data/data/[myAppPackage]/lib/libGLESv2.so

01-14 17:44:35.546 I/PVRTrace(I)﹕ Config File HostEs3LibPath:

01-14 17:44:35.546 I/PVRTrace(I)﹕ Processes excluded from recording: com.powervr.PVRHub

01-14 17:44:35.546 I/PVRTrace(I)﹕ Opening trace file to record: /sdcard/[myAppPackage].pvrt

01-14 17:44:35.554 D/dalvikvm﹕ Added shared lib /data/data/[myAppPackage]/lib/libPVRTrace.so 0x40ce95e0

01-14 17:44:35.554 D/dalvikvm﹕ No JNI_OnLoad found in /data/data/[myAppPackage]/lib/libPVRTrace.so 0x40ce95e0, skipping init

01-14 17:44:35.554 D/dalvikvm﹕ Trying to load lib /data/data/[myAppPackage]/lib/libEGL_PVRTRACE.so 0x40ce95e0

01-14 17:44:35.554 D/dalvikvm﹕ Added shared lib /data/data/[myAppPackage]/lib/libEGL_PVRTRACE.so 0x40ce95e0

01-14 17:44:35.554 D/dalvikvm﹕ No JNI_OnLoad found in /data/data/[myAppPackage]/lib/libEGL_PVRTRACE.so 0x40ce95e0, skipping init

01-14 17:44:35.554 D/dalvikvm﹕ Trying to load lib /data/data/[myAppPackage]/lib/libGLESv1_CM_PVRTRACE.so 0x40ce95e0

01-14 17:44:35.554 D/dalvikvm﹕ Added shared lib /data/data/[myAppPackage]/lib/libGLESv1_CM_PVRTRACE.so 0x40ce95e0

01-14 17:44:35.554 D/dalvikvm﹕ No JNI_OnLoad found in /data/data/[myAppPackage]/lib/libGLESv1_CM_PVRTRACE.so 0x40ce95e0, skipping init

01-14 17:44:35.554 D/dalvikvm﹕ Trying to load lib /data/data/[myAppPackage]/lib/libGLESv2_PVRTRACE.so 0x40ce95e0

01-14 17:44:35.554 D/dalvikvm﹕ Added shared lib /data/data/[myAppPackage]/lib/libGLESv2_PVRTRACE.so 0x40ce95e0

01-14 17:44:35.554 D/dalvikvm﹕ No JNI_OnLoad found in /data/data/[myAppPackage]/lib/libGLESv2_PVRTRACE.so 0x40ce95e0, skipping init




And for you information here are the list of files in /data/data/[myAppPackage]/lib



127|root@android:/data/data/[myAppPackage]/lib # ls -al

-rwxr-xr-x system system 17484 2014-02-14 16:56 libEGL_PVRTRACE.so

-rwxr-xr-x system system 29772 2014-02-14 17:56 libGLESv1_CM_PVRTRACE.so

-rwxr-xr-x system system 46156 2014-02-14 17:56 libGLESv2_PVRTRACE.so

-rwxr-xr-x system system 820764 2014-02-14 17:56 libPVRTrace.so




Those .so I usedare the one for “Android_armeabi-v7a”. Which is as far as I know the right architecture of my device.


#8

Hi,



I cant see any errors or warnings from the PVRTrace libraries in your logs (FYI, the “No JNI_OnLoad” messages can be ignored). Can you clarify what problem you’re hitting with your current setup? Is the PVRT file not being generated, or is it just very small (like you’d mentioned previously)?



Thanks,

Joe


#9

As mentioned previously, the file is very small (192 bytes) and so contains nothing useful (it even crashes PVRTracePlayback).

To me it sounds like the file is prepared, the header is written but for what ever reason PVRTrace gives up and don’t record/save traces to the file.


#10

Hi,



Usually when the header is the only part written to the file, it means library linking has failed for some reason, or the application has hit a bug in the recorder libraries. When trace recording is enabled, does your application render anything to the screen, or does it lock up/crash?



Can you share an example APK with us (preferably one without the recorder libraries, and other with them compiled in)? If you need somewhere to upload the files to, please file a ticket here so we can share FTP credentials with you.



Thanks,

Joe