ART: Fix Trace types, check minimum buf size
Also make streaming mode adhere to the given buffer (and fix the
case where the buffer is too small for a packet). This is important
to not lose too much tracing information when the runtime is destroyed
with an unflushed buffer.
Change-Id: I6525fe4326ac5c3d7c9cda41c54a2a911ca889b7
diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc
index 8524348..1a7a3e5 100644
--- a/runtime/native/dalvik_system_ZygoteHooks.cc
+++ b/runtime/native/dalvik_system_ZygoteHooks.cc
@@ -152,6 +152,7 @@
if (Trace::GetMethodTracingMode() != TracingMode::kTracingInactive) {
Trace::TraceOutputMode output_mode = Trace::GetOutputMode();
Trace::TraceMode trace_mode = Trace::GetMode();
+ size_t buffer_size = Trace::GetBufferSize();
// Just drop it.
Trace::Abort();
@@ -176,7 +177,7 @@
proc_name.c_str());
Trace::Start(trace_file.c_str(),
-1,
- -1, // TODO: Expose buffer size.
+ buffer_size,
0, // TODO: Expose flags.
output_mode,
trace_mode,