[layertracegenerator] stream layer trace to file
Write the generated layer trace entry by entry
so we don't hold the entire unserialized layer trace
in memory.
Fixes: 272158947
Test: presubmit
Test: open streamed trace in winscope
Test: cat /proc/`pidof layertracegenerator`/status
old
VmHWM: 959496 kB
new
VmHWM: 21416 kB
Change-Id: I4bf0cd8fe98d1e2a44fb6b7c85c4e06e586a52ed
diff --git a/services/surfaceflinger/Tracing/LayerTracing.h b/services/surfaceflinger/Tracing/LayerTracing.h
index 11bb9f4..40b0fbe 100644
--- a/services/surfaceflinger/Tracing/LayerTracing.h
+++ b/services/surfaceflinger/Tracing/LayerTracing.h
@@ -43,9 +43,10 @@
LayerTracing();
~LayerTracing();
bool enable();
- bool disable(std::string filename = FILE_NAME);
+ bool disable(std::string filename = FILE_NAME, bool writeToFile = true);
+ void appendToStream(std::ofstream& out);
bool isEnabled() const;
- status_t writeToFile();
+ status_t writeToFile(std::string filename = FILE_NAME);
static LayersTraceFileProto createTraceFileProto();
void notify(bool visibleRegionDirty, int64_t time, int64_t vsyncId, LayersProto* layers,
std::string hwcDump, google::protobuf::RepeatedPtrField<DisplayProto>* displays);