13

When I run python systrace.py --time=10 -o mynewtrace.html gfx
The following error occurs

Starting tracing (10 seconds)
Tracing completed. Collecting output...
<br>

Exception in thread Thread-11:

Traceback (most recent call last):
  File "C:\Python27\lib\threading.py", line 801, in __bootstrap_inner
    self.run()<br>
  File "C:\Python27\lib\threading.py", line 754, in run
    self.__target(*self.__args, self.__kwargs)<br>
  File "C:\Users\rajnish.r\AppData\Local\Android\Sdk\platform-tools\systrace\cat
apult\systrace\systrace\tracing_agents\atrace_agent.py", line 194, in _collect_a
nd_preprocess
    self._trace_data = self._preprocess_trace_data(trace_data)<br>
  File "C:\Users\rajnish.r\AppData\Local\Android\Sdk\platform-tools\systrace\cat
apult\systrace\systrace\tracing_agents\atrace_agent.py", line 272, in _preproces
s_trace_data
    trace_data = strip_and_decompress_trace(trace_data)<br>
  File "C:\Users\rajnish.r\AppData\Local\Android\Sdk\platform-tools\systrace\cat
apult\systrace\systrace\tracing_agents\atrace_agent.py", line 332, in strip_and_
decompress_trace
    **trace_data = zlib.decompress(trace_data)**

error: Error -5 while decompressing data: incomplete or truncated stream

Outputting Systrace results...<br>
Tracing complete, writing results<br>
Traceback (most recent call last):,br>
  File "systrace.py", line 49, in <module>
    sys.exit(run_systrace.main())<br>
  File "C:\Users\rajnish.r\AppData\Local\Android\Sdk\platform-tools\systrace\cat
apult\systrace\systrace\run_systrace.py", line 196, in main
    main_impl(sys.argv)<br>
  File "C:\Users\rajnish.r\AppData\Local\Android\Sdk\platform-tools\systrace\cat
apult\systrace\systrace\run_systrace.py", line 193, in main_impl
    controller.OutputSystraceResults(write_json=options.write_json)<br>
  File "C:\Users\rajnish.r\AppData\Local\Android\Sdk\platform-tools\systrace\cat
apult\systrace\systrace\systrace_runner.py", line 68, in OutputSystraceResults
    self._out_filename)<br>
  File "C:\Users\rajnish.r\AppData\Local\Android\Sdk\platform-tools\systrace\cat
apult\systrace\systrace\output_generator.py", line 98, in GenerateHTMLOutput
    html_file.write(_ConvertToHtmlString(result.raw_data))<br>
  File "C:\Users\rajnish.r\AppData\Local\Android\Sdk\platform-tools\systrace\cat
apult\systrace\systrace\output_generator.py", line 120, in _ConvertToHtmlString
    raise ValueError('Invalid trace result format for HTML output')<br>
*

ValueError: Invalid trace result format for HTML output

*

Virendra Kumar
  • 131
  • 1
  • 3
  • I get this same error both for a physical device (Galaxy S8) and for the Android 7 emulator. It seems that the trace log is coming back from the machine as what appears to be compressed data, but that zlip is failing the decompress. As there are a couple of questions about this in the last week, I wonder if it's a broken update... – Chris Rae Feb 14 '18 at 01:11
  • Interesting I also can only repro this on the Windows SDK, not the Mac one. – Chris Rae Feb 14 '18 at 22:41
  • I've got the same error on my PC too. Connected my MIA1. Python 2.7.14, pywin32-221. Looking for a solution... – zkvarz Mar 07 '18 at 09:21
  • @ChrisRae Is this command working fine on Mac SDK? – Virendra Kumar Mar 12 '18 at 05:12
  • @VirendraKumar yes it is. – Chris Rae Mar 12 '18 at 16:24
  • Same problem for me with SDK Platform-tools 27.0.1, Build-Tools 28.0.0-rc1 – fralbo Apr 04 '18 at 12:07

2 Answers2

7

I was able to log systrace only from Android Device Monitor. Console didn't work out for me. enter image description here

Community
  • 1
  • 1
zkvarz
  • 611
  • 1
  • 8
  • 18
  • 7
    Which - to save you another Google search - starting from `Android Studio 3.1`, is only available from the command line, by executing `/tools/monitor`. See [here](https://stackoverflow.com/a/49574244/3160869) – Attila Tanyi Apr 20 '18 at 08:50
  • 1
    Android Device Monitor was deprecated in Android Studio 3.1 and removed from Android Studio 3.2. The features that you could use through the Android Device Monitor have been replaced by new features. https://developer.android.com/studio/profile/monitor – Ashutosh Oct 04 '18 at 11:07
  • @Ashutosh New features, yes, but how would you save / log the systrace? – tom_mai78101 Nov 01 '18 at 18:26
0

You need to use --no-compress option. Like this:

systrace.py --time=10 --no-compress -o=trace.html sched gfx view -a com.yourapp.Name
xfyre
  • 93
  • 2
  • 6