android / performance-samples

Samples to show APIs and best practices in Performance on Android
https://d.android.com/topic/performance/overview
Apache License 2.0
1.27k stars 214 forks source link

TestRunner: java.lang.IllegalStateException: Perfetto tracing failed to start. #249

Closed maryyMa closed 1 year ago

maryyMa commented 1 year ago

I just download the samples and run the FullyDrawnStartupBenchmark ,but failed. I dont know why.

08-18 17:50:51.147 14874 14899 E TestRunner: failed: startup(com.example.macrobenchmark.startup.FullyDrawnStartupBenchmark)
08-18 17:50:51.148 14874 14899 E TestRunner: ----- begin exception -----
08-18 17:50:51.157 14874 14899 E TestRunner: java.lang.IllegalStateException: Perfetto tracing failed to start.
08-18 17:50:51.157 14874 14899 E TestRunner: Please report a bug, and include a logcat capture of the test run and failure.
08-18 17:50:51.157 14874 14899 E TestRunner: DeviceInfo(Brand=rockchip, Model=MP58, SDK=32, BuildFp=rockchip/xx/
08-18 17:50:51.157 14874 14899 E TestRunner:    at androidx.benchmark.perfetto.PerfettoHelper.perfettoStartupException(PerfettoHelper.kt:60)
08-18 17:50:51.157 14874 14899 E TestRunner:    at androidx.benchmark.perfetto.PerfettoHelper.startCollecting(PerfettoHelper.kt:152)
08-18 17:50:51.157 14874 14899 E TestRunner:    at androidx.benchmark.perfetto.PerfettoCapture.start(PerfettoCapture.kt:72)
08-18 17:50:51.157 14874 14899 E TestRunner:    at androidx.benchmark.perfetto.PerfettoCaptureWrapper.start(PerfettoCaptureWrapper.kt:68)
08-18 17:50:51.157 14874 14899 E TestRunner:    at androidx.benchmark.perfetto.PerfettoCaptureWrapper.record(PerfettoCaptureWrapper.kt:124)
08-18 17:50:51.157 14874 14899 E TestRunner:    at androidx.benchmark.perfetto.PerfettoCaptureWrapper.record$default(PerfettoCaptureWrapper.kt:90)
08-18 17:50:51.157 14874 14899 E TestRunner:    at androidx.benchmark.macro.MacrobenchmarkKt$macrobenchmark$measurements$1.invoke(Macrobenchmark.kt:243)
08-18 17:50:51.157 14874 14899 E TestRunner:    at androidx.benchmark.macro.MacrobenchmarkKt$macrobenchmark$measurements$1.invoke(Macrobenchmark.kt:228)
08-18 17:50:51.157 14874 14899 E TestRunner:    at androidx.benchmark.perfetto.PerfettoTraceProcessor$Companion.runServer(PerfettoTraceProcessor.kt:105)
08-18 17:50:51.157 14874 14899 E TestRunner:    at androidx.benchmark.macro.MacrobenchmarkK

here attach log: 08-18 17:36:59.356 777 777 I perfetto: ng_service_impl.cc:2293 Tracing session 9 ended, total sessions:0 08-18 17:36:59.398 7967 7992 I PerfettoCapture: Starting perfetto tracing with cmd: cat /storage/emulated/0/Android/media/com.example.macrobenchmark/trace_config.pb | perfetto --background -c - -o /data/misc/perfetto-traces/trace_output.pb 08-18 17:36:59.412 2173 17611 W MediaProvider: isAppCloneUserPair for user 0: false 08-18 17:36:59.541 8382 8382 I perfetto: perfetto_cmd.cc:794 Connected to the Perfetto traced service, starting tracing 08-18 17:36:59.543 777 777 I perfetto: ing_service_impl.cc:912 Configured tracing session 10, #sources:9, duration:0 ms, #buffers:2, total buffer size:36864 KB, total sessions:1, uid:0 session name: "" 08-18 17:36:59.546 772 772 I perfetto: probes_producer.cc:241 Ftrace setup (target_buf=14) 08-18 17:36:59.606 8386 8386 D hw-ProcessState: Binder ioctl to enable oneway spam detection failed: Invalid argument 08-18 17:36:59.609 134 134 I hwservicemanager: getTransport: Cannot find entry android.hardware.atrace@1.0::IAtraceDevice/default in either framework or device VINTF manifest. 08-18 17:36:59.627 7967 7992 I PerfettoCapture: Perfetto output - 8382 08-18 17:36:59.627 7967 7992 I PerfettoCapture: EXITCODE=0 08-18 17:36:59.644 772 772 I perfetto: ftrace_procfs.cc:206 enabled ftrace in /sys/kernel/tracing/ 08-18 17:36:59.756 2173 8237 I MediaProvider: Deleted 1 0 0 0 0 0 0 items on external_primary due to com.example.macrobenchmark 08-18 17:36:59.758 7967 7992 I System.out: stopserver 08-18 17:36:59.777 2173 8239 W MediaProvider: isAppCloneUserPair for user 0: false 08-18 17:36:59.794 7967 7967 I auditd : type=1400 audit(0.0:12859): avc: denied { call } for comm="roidJUnitRunner" scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:su:s0 tclass=binder permissive=1 app=com.example.macrobenchmark 08-18 17:36:59.794 7967 7967 I roidJUnitRunner: type=1400 audit(0.0:12859): avc: denied { call } for scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:su:s0 tclass=binder permissive=1 app=com.example.macrobenchmark 08-18 17:36:59.817 777 777 I auditd : type=1400 audit(0.0:12860): avc: denied { use } for comm="traced" path="/data/misc/perfetto-traces/trace_output.pb" dev="mmcblk0p12" ino=1438 scontext=u:r:traced:s0 tcontext=u:r:su:s0 tclass=fd permissive=1 08-18 17:36:59.817 777 777 I traced : type=1400 audit(0.0:12860): avc: denied { use } for path="/data/misc/perfetto-traces/trace_output.pb" dev="mmcblk0p12" ino=1438 scontext=u:r:traced:s0 tcontext=u:r:su:s0 tclass=fd permissive=1 08-18 17:36:59.820 632 742 D AudioHardwareMP56: pcm_wrap_read readAftTime 4680002202, readBefTime 4679984023, 18179 08-18 17:36:59.822 632 738 E AudioHardwareMP56: RecvDataExt: mStatsLoopCount 577437, cur_time - pre_time 19295 08-18 17:36:59.830 134 134 I hwservicemanager: getTransport: Cannot find entry android.hardware.power.stats@1.0::IPowerStats/default in either framework or device VINTF manifest. 08-18 17:36:59.830 772 772 E perfetto: power_data_source.cc:84 Failed to retrieve rail descriptors.

keyboardsurfer commented 1 year ago

I could not find any details on this SOC's Android version. @maryyMa Can you provide me with details to the version it runs and possible modifications which might cause permission issues when accessing perfetto traces?

Relevant snippet from your log:

08-18 17:36:59.817 777 777 I auditd : type=1400 audit(0.0:12860): avc: denied { use } for comm="traced" path="/data/misc/perfetto-traces/trace_output.pb" dev="mmcblk0p12" ino=1438 scontext=u:r:traced:s0 tcontext=u:r:su:s0 tclass=fd permissive=1
08-18 17:36:59.817 777 777 I traced : type=1400 audit(0.0:12860): avc: denied { use } for path="/data/misc/perfetto-traces/trace_output.pb" dev="mmcblk0p12" ino=1438 scontext=u:r:traced:s0 tcontext=u:r:su:s0 tclass=fd permissive=1
08-18 17:36:59.820 632 742 D AudioHardwareMP56: pcm_wrap_read readAftTime 4680002202, readBefTime 4679984023, 18179