[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
3 files changed