5

I ran systrace on my android studio project in order to find some performance bugs but after the end of the tracing process, i get the following error and if i open the trace.html output file in chrome, the trace view is empty:

Starting tracing (10 seconds)
Tracing completed. Collecting output...
Exception in thread Thread-13:
Traceback (most recent call last):
  File "C:\Python27\lib\threading.py", line 801, in __bootstrap_inner
    self.run()
  File "C:\Python27\lib\threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "C:\Users\Steli\AppData\Local\Android\sdk\platform-tools\systrace\catapult\systrace\systrace\tracing_agents\atrace_agent.py", line 194, in _collect_and_preprocess
    self._trace_data = self._preprocess_trace_data(trace_data)
  File "C:\Users\Steli\AppData\Local\Android\sdk\platform-tools\systrace\catapult\systrace\systrace\tracing_agents\atrace_agent.py", line 272, in _preprocess_trace_data
    trace_data = strip_and_decompress_trace(trace_data)
  File "C:\Users\Steli\AppData\Local\Android\sdk\platform-tools\systrace\catapult\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...
Tracing complete, writing results
Traceback (most recent call last):
  File "systrace.py", line 49, in <module>
    sys.exit(run_systrace.main())
  File "C:\Users\Steli\AppData\Local\Android\sdk\platform-tools\systrace\catapult\systrace\systrace\run_systrace.py", line 196, in main
    main_impl(sys.argv)
  File "C:\Users\Steli\AppData\Local\Android\sdk\platform-tools\systrace\catapult\systrace\systrace\run_systrace.py", line 193, in main_impl
    controller.OutputSystraceResults(write_json=options.write_json)
  File "C:\Users\Steli\AppData\Local\Android\sdk\platform-tools\systrace\catapult\systrace\systrace\systrace_runner.py", line 68, in OutputSystraceResults
    self._out_filename)
  File "C:\Users\Steli\AppData\Local\Android\sdk\platform-tools\systrace\catapult\systrace\systrace\output_generator.py", line 98, in GenerateHTMLOutput
    html_file.write(_ConvertToHtmlString(result.raw_data))
  File "C:\Users\Steli\AppData\Local\Android\sdk\platform-tools\systrace\catapult\systrace\systrace\output_generator.py", line 120, in _ConvertToHtmlString
    raise ValueError('Invalid trace result format for HTML output')
ValueError: Invalid trace result format for HTML output

Anyone have a solution for this or any advice?

Stelios Papamichail
  • 955
  • 2
  • 19
  • 57
  • I'm getting the exact same error - what device are you using to debug on? – Waddles Feb 06 '18 at 03:17
  • @Waddles I'm using an s8 – Stelios Papamichail Feb 06 '18 at 03:25
  • 1
    Me too - I also think this question might already exist (no answer though): https://stackoverflow.com/questions/48500644/systrace-invalid-trace-result-format-for-html-output – Chris Rae Feb 14 '18 at 00:37
  • Possible duplicate of [systrace: Invalid trace result format for HTML output](https://stackoverflow.com/questions/48500644/systrace-invalid-trace-result-format-for-html-output) – zkvarz Mar 13 '18 at 15:16

1 Answers1

2

Systrace.py has a --no-compress option. Using it should allow the trace to complete without hitting the failing decompression step.

The same problem was occurring on my Windows 10 system and this solved it for me.

timl
  • 131
  • 5