3

I try to do a systrace of a react native app running on android:

/home/a/Android/Sdk/platform-tools/systrace/systrace.py --time=5 -o trace.html sched gfx view -a com.mypackage

This is the error I get, but trace_markers seem to be defect:

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

How could I fix this?

  • React: 16.0.0-alpha.12
  • React Native: 0.48.2
  • Android: 7.1.2 (LineageOS 14.1-20170607)
Stuck
  • 11,225
  • 11
  • 59
  • 104

1 Answers1

0

The problem is:

IOError: Unable to get atrace data. Did you forget adb root?

Try this cmd:

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
Alen Lee
  • 2,479
  • 2
  • 21
  • 30