systrace: Invalid trace result format for HTML output
Asked Answered
S

2

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

*

Stavro answered 29/1, 2018 at 11:53 Comment(6)
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...Demulcent
Interesting I also can only repro this on the Windows SDK, not the Mac one.Demulcent
I've got the same error on my PC too. Connected my MIA1. Python 2.7.14, pywin32-221. Looking for a solution...Intensity
@ChrisRae Is this command working fine on Mac SDK?Stavro
@VirendraKumar yes it is.Demulcent
Same problem for me with SDK Platform-tools 27.0.1, Build-Tools 28.0.0-rc1Astronomical
I
7

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

Intensity answered 7/3, 2018 at 13:8 Comment(3)
Which - to save you another Google search - starting from Android Studio 3.1, is only available from the command line, by executing <android-sdk>/tools/monitor. See hereMyrilla
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. developer.android.com/studio/profile/monitorBalanchine
@Balanchine New features, yes, but how would you save / log the systrace?Sacrificial
R
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
Reiter answered 23/8, 2019 at 8:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.