Only send control socket byte for frees if other end paused.
This will improve performance of blocking mode.
Bug: 160388760
Change-Id: Icfa657ed9def8be3502b93cb781898edb93c7422
diff --git a/src/profiling/memory/client.cc b/src/profiling/memory/client.cc
index f77da5d..05c7329 100644
--- a/src/profiling/memory/client.cc
+++ b/src/profiling/memory/client.cc
@@ -447,8 +447,10 @@
if (bytes_free == -1)
return false;
// Seems like we are filling up the shmem with frees. Flush.
- if (static_cast<uint64_t>(bytes_free) < shmem_.size() / 2)
+ if (static_cast<uint64_t>(bytes_free) < shmem_.size() / 2 &&
+ shmem_.GetAndResetReaderPaused()) {
return SendControlSocketByte();
+ }
return true;
}