当我尝试运行Systrace时,我得到了这个堆栈跟踪:
python systrace.py --app=com.mydebug.app view gfx sched dalvik wm
Starting tracing (stop with enter)
Tracing completed. Collecting output...
CRITICAL:root:(TimeoutThread-1-for-Thread-1) Exception on ReadFile(1829d365, /sys/kernel/debug/tracing/tracing_on, retries=3, timeout=30), attempt 1 of 4: AdbCommandFailedError("(device: 1829d365) adb pull /sys/kernel/debug/tracing/tracing_on /tmp/tmpyO_hQZ/tmp_ReadFileWithPull: failed with exit status 1 and output:\n- adb: error: failed to copy '/sys/kernel/debug/tracing/tracing_on' to '/tmp/tmpyO_hQZ/tmp_ReadFileWithPull': remote Permission denied\n",)
CRITICAL:root:(TimeoutThread-2-for-Thread-1) Exception on ReadFile(1829d365, /sys/kernel/debug/tracing/tracing_on, retries=3, timeout=30), attempt 2 of 4: AdbCommandFailedError("(device: 1829d365) adb pull /sys/kernel/debug/tracing/tracing_on /tmp/tmpVakBVH/tmp_ReadFileWithPull: failed with exit status 1 and output:\n- adb: error: failed to copy '/sys/kernel/debug/tracing/tracing_on' to '/tmp/tmpVakBVH/tmp_ReadFileWithPull': remote Permission denied\n",)
CRITICAL:root:(TimeoutThread-3-for-Thread-1) Exception on ReadFile(1829d365, /sys/kernel/debug/tracing/tracing_on, retries=3, timeout=30), attempt 3 of 4: AdbCommandFailedError("(device: 1829d365) adb pull /sys/kernel/debug/tracing/tracing_on /tmp/tmp_IoryO/tmp_ReadFileWithPull: failed with exit status 1 and output:\n- adb: error: failed to copy '/sys/kernel/debug/tracing/tracing_on' to '/tmp/tmp_IoryO/tmp_ReadFileWithPull': remote Permission denied\n",)
Exception in thread Thread-1:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "/Users/vinay.nagaraj/Library/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 "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/tracing_agents/atrace_agent.py", line 261, in _collect_trace_data
self._stop_trace()
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/tracing_agents/atrace_agent.py", line 244, in _stop_trace
if int(self._device_utils.ReadFile(is_trace_enabled_file)):
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/decorators.py", line 57, in timeout_retry_wrapper
retry_if_func=retry_if_func)
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/utils/timeout_retry.py", line 159, in Run
error_log_func=error_log_func)
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/utils/reraiser_thread.py", line 186, in JoinAll
self._JoinAll(watcher, timeout)
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/utils/reraiser_thread.py", line 158, in _JoinAll
thread.ReraiseIfException()
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/utils/reraiser_thread.py", line 81, in run
self._ret = self._func(*self._args, **self._kwargs)
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/utils/timeout_retry.py", line 152, in <lambda>
child_thread = reraiser_thread.ReraiserThread(lambda: func(*args, **kwargs),
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/decorators.py", line 47, in impl
return f(*args, **kwargs)
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/device_utils.py", line 1658, in ReadFile
return self._ReadFileWithPull(device_path)
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/device_utils.py", line 1610, in _ReadFileWithPull
self.adb.Pull(device_path, host_temp_path)
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/sdk/adb_wrapper.py", line 454, in Pull
self._RunDeviceAdbCmd(cmd, timeout, retries)
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/sdk/adb_wrapper.py", line 282, in _RunDeviceAdbCmd
check_error=check_error)
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/decorators.py", line 51, in timeout_retry_wrapper
return impl()
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/decorators.py", line 47, in impl
return f(*args, **kwargs)
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/../../devil/devil/android/sdk/adb_wrapper.py", line 258, in _RunAdbCmd
args, output, status, device_serial)
AdbCommandFailedError: (device: 1829d365) adb pull /sys/kernel/debug/tracing/tracing_on /tmp/tmpw7qK2c/tmp_ReadFileWithPull: failed with exit status 1 and output:
- adb: error: failed to copy '/sys/kernel/debug/tracing/tracing_on' to '/tmp/tmpw7qK2c/tmp_ReadFileWithPull': remote Permission denied
Outputting Systrace results...
Tracing complete, writing results
Traceback (most recent call last):
File "systrace.py", line 49, in <module>
sys.exit(run_systrace.main())
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/run_systrace.py", line 194, in main
main_impl(sys.argv)
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/run_systrace.py", line 191, in main_impl
controller.OutputSystraceResults(write_json=options.write_json)
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/systrace_runner.py", line 67, in OutputSystraceResults
self._out_filename)
File "/Users/vinay.nagaraj/Library/Android/sdk/platform-tools/systrace/catapult/systrace/systrace/output_generator.py", line 70, in GenerateHTMLOutput
html_file.write(_ConvertToHtmlString(result.raw_data))
File "/Users/vinay.nagaraj/Library/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
虽然我可以{s}卡adb pull
文件。我试过从我的android-sdk platform-tools运行systrace
,我尝试从catapult git repo运行systrace,但是我得到了同样的错误。是否无法在生产设备上运行systrace?
有什么特别之处在于我可以使用Android设备监视器成功运行systrace,但我不喜欢它如何强迫我投入时间与命令行工具不同。此外,无论我在通过设备监视器运行systrace时选择的时间和缓冲区大小,它始终只记录5秒。