Pass a string as const reference to avoid a copy
WriteToBuf copies a string into a buffer so it is just sufficient to
send it by reference to avoid copy
Bug: 259258187
Test: art/test.py
Change-Id: I96dc4eb0019d90971169214a643a234202b4e1cb
diff --git a/runtime/trace.cc b/runtime/trace.cc
index 0f93742..eb0c04e 100644
--- a/runtime/trace.cc
+++ b/runtime/trace.cc
@@ -934,7 +934,7 @@
void Trace::WriteToBuf(uint8_t* header,
size_t header_size,
- std::string data,
+ const std::string& data,
size_t* current_index,
uint8_t* buffer,
size_t buffer_size) {
diff --git a/runtime/trace.h b/runtime/trace.h
index dc3649f..bce8efc 100644
--- a/runtime/trace.h
+++ b/runtime/trace.h
@@ -320,7 +320,7 @@
// current_index to point to the next entry.
void WriteToBuf(uint8_t* header,
size_t header_size,
- std::string data,
+ const std::string& data,
size_t* current_index,
uint8_t* buffer,
size_t buffer_size);