Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a75a8cd authored by Tom Cherry's avatar Tom Cherry
Browse files

liblog: remove memset() before recv().

This is unneeded, since we're already checking the length returned by
recv() and log_msg that is read for validity.

It costs ~4% of CPU with `logcat -s` and ~2% of CPU when running
simpleperf for 1 second on walleye on master.

Bug: 144311420
Test: logcat works, simpleperf doesn't show memset() costing as much.
Change-Id: I986e7e96518774034340f1b1201a2071a904e3bb
parent 7d16aedc
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -392,8 +392,6 @@ static int LogdRead(struct logger_list* logger_list, struct android_log_transpor
    return ret;
  }

  memset(log_msg, 0, sizeof(*log_msg));

  /* NOTE: SOCK_SEQPACKET guarantees we read exactly one full entry */
  ret = TEMP_FAILURE_RETRY(recv(ret, log_msg, LOGGER_ENTRY_MAX_LEN, 0));
  if ((logger_list->mode & ANDROID_LOG_NONBLOCK) && ret == 0) {