aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Mayer <fmayer@google.com>2019-11-08 18:29:18 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-11-08 18:29:18 +0000
commit6a4520edecbd819d65a179e31c2d0eac37a9c29e (patch)
tree17ad9062024b1dee5f1fc4b2c286ac5e46ac861f
parent1de6bb1cd4bdb6915b6aa03e20d2b9a5348c7661 (diff)
parent906e06987f66cfbd46cdd586a15b0072b2fbed19 (diff)
downloadperfetto-6a4520edecbd819d65a179e31c2d0eac37a9c29e.tar.gz
Merge "Do not block on control socket."
-rw-r--r--src/profiling/memory/client.cc13
-rw-r--r--src/profiling/memory/unwinding.cc4
2 files changed, 7 insertions, 10 deletions
diff --git a/src/profiling/memory/client.cc b/src/profiling/memory/client.cc
index 806573363..420da4c02 100644
--- a/src/profiling/memory/client.cc
+++ b/src/profiling/memory/client.cc
@@ -213,10 +213,7 @@ std::shared_ptr<Client> Client::CreateAndHandshake(
}
PERFETTO_DCHECK(client_config.interval >= 1);
- // TODO(fmayer): Always make this nonblocking.
- // This is so that without block_client, we get the old behaviour that rate
- // limits using the blocking socket. We do not want to change that for Q.
- sock.SetBlocking(!client_config.block_client);
+ sock.SetBlocking(false);
Sampler sampler{client_config.interval};
// note: the shared_ptr will retain a copy of the unhooked_allocator
return std::allocate_shared<Client>(unhooked_allocator, std::move(sock),
@@ -379,10 +376,12 @@ bool Client::IsConnected() {
}
bool Client::SendControlSocketByte() {
- // TODO(fmayer): Fix the special casing that only block_client uses a
- // nonblocking socket.
+ // If base::IsAgain(errno), the socket buffer is full, so the service will
+ // pick up the notification even without adding another byte.
+ // In other error cases (usually EPIPE) we want to disconnect, because that
+ // is how the service signals the tracing session was torn down.
if (sock_.Send(kSingleByte, sizeof(kSingleByte)) == -1 &&
- (!client_config_.block_client || !base::IsAgain(errno))) {
+ !base::IsAgain(errno)) {
PERFETTO_PLOG("Failed to send control socket byte.");
return false;
}
diff --git a/src/profiling/memory/unwinding.cc b/src/profiling/memory/unwinding.cc
index ced87f9f6..6b030c09c 100644
--- a/src/profiling/memory/unwinding.cc
+++ b/src/profiling/memory/unwinding.cc
@@ -303,9 +303,7 @@ void UnwindingWorker::HandleUnwindBatch(pid_t peer_pid) {
shmem.EndRead(std::move(buf));
// Reparsing takes time, so process the rest in a new batch to avoid timing
// out.
- // TODO(fmayer): Do not special case blocking mode.
- if (client_data.client_config.block_client &&
- reparses_before < client_data.metadata.reparses) {
+ if (reparses_before < client_data.metadata.reparses) {
repost_task = true;
break;
}