OSDN Git Service

[ART] Prepare streaming output of method tracing for developer use.
authorShukang Zhou <shukang@google.com>
Fri, 20 Jan 2017 19:40:16 +0000 (11:40 -0800)
committerShukang Zhou <shukang@google.com>
Sat, 21 Jan 2017 01:38:55 +0000 (17:38 -0800)
commit8a5ab9102fe705b63eda6e6bcfe98ee1c03e5a6c
tree5c1065aa6949b12b11fd659755ea97b654474e54
parent64e50021845b1ad9d8851596e8aaddf18be217c2
[ART] Prepare streaming output of method tracing for developer use.

Changes include:

* Flush the buffer to file when tracing ends, so every record is
  preserved.

* At the end of the streaming output, add what's the header when the
  output mode is not strreaming (called 'trace summary' in code).
  * A new special token (kOpTraceSummary) is added for this purpose.
  * The summary used to be written to a .sec file, which has
    permission issues with non-rooted devices.

* Update the streaming output converter (stream-trace-converter.py)
  to handle the updated format. When the trace summary is present,
  it is used to populate the output header, which provides more
  complete info than existing implementation where some info is
  inferred from the records.

The changes to trace.h/cc impact streaming output mode only.

The updated stream-trace-converter.py works with or without the
trace summary at the file end, so pulling the file in the middle
is still supported.

Bug: b/33300765

Test: m -j48 ART_TEST_TRACE=true ART_TEST_TRACE_STREAM=true test-art-host
I also tested manually: flashed a Nexus 6P, collected traces, and
parsed them in Studio.

Change-Id: I697d2ec09bed56033cfce9a8f27dc4710d8b0798
runtime/trace.cc
runtime/trace.h
tools/stream-trace-converter.py