我尝试做一个运行在android上的react native应用的systrace:
/home/a/Android/Sdk/platform-tools/systrace/systrace.py --time=5 -o trace.html sched gfx view -a com.mypackage
这是我得到的错误,但是trace_markers似乎有缺陷:
These categories are unavailable: sched
Starting tracing (5 seconds)
Tracing completed. Collecting output...
/system/bin/sh: <stdin>[2]: can't create /sys/kernel/debug/tracing/trace_marker: No such file or directory
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/r/Android/Sdk/platform-tools/systrace/catapult/systrace/systrace/tracing_agents/atrace_agent.py", line 194, in _collect_and_preprocess
trace_data = self._collect_trace_data()
File "/home/r/Android/Sdk/platform-tools/systrace/catapult/systrace/systrace/tracing_agents/atrace_agent.py", line 259, in _collect_trace_data
raise IOError('Unable to get atrace data. Did you forget adb root?')
IOError: Unable to get atrace data. Did you forget adb root?
Outputting Systrace results...
Tracing complete, writing results
Traceback (most recent call last):
File "/home/r/Android/Sdk/platform-tools/systrace/systrace.py", line 49, in <module>
sys.exit(run_systrace.main())
File "/home/r/Android/Sdk/platform-tools/systrace/catapult/systrace/systrace/run_systrace.py", line 194, in main
main_impl(sys.argv)
File "/home/r/Android/Sdk/platform-tools/systrace/catapult/systrace/systrace/run_systrace.py", line 191, in main_impl
controller.OutputSystraceResults(write_json=options.write_json)
File "/home/r/Android/Sdk/platform-tools/systrace/catapult/systrace/systrace/systrace_runner.py", line 67, in OutputSystraceResults
self._out_filename)
File "/home/r/Android/Sdk/platform-tools/systrace/catapult/systrace/systrace/output_generator.py", line 70, in GenerateHTMLOutput
html_file.write(_ConvertToHtmlString(result.raw_data))
File "/home/r/Android/Sdk/platform-tools/systrace/catapult/systrace/systrace/output_generator.py", line 92, in _ConvertToHtmlString
raise ValueError('Invalid trace result format for HTML output')
ValueError: Invalid trace result format for HTML output
我该如何解决?
反应:16.0.0-alpha.12
React Native:0.48.2
Android:7.1.2(LineageOS 14.1-20170607)
最佳答案
问题是:
IOError:无法获取跟踪数据。您忘了adb root吗?
试试这个命令:
python systrace.py -a com.example.myapp -b 16384 \
-o my_systrace_report.html sched freq idle am wm gfx view binder_driver hal \
dalvik camera input res
关于android - systrace:无法创建/sys/kernel/debug/tracing/trace_marker:没有此类文件或目录,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46449567/