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

Commit 314a9c52 authored by Stefan Lafon's avatar Stefan Lafon Committed by Android (Google) Code Review
Browse files

Merge "Create stats buffer in logd."

parents 6b0be94c 1b1b6f50
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -95,6 +95,8 @@ int __android_log_btwrite(int32_t tag, char type, const void* payload,
                          size_t len);
int __android_log_bswrite(int32_t tag, const char* payload);

int __android_log_stats_bwrite(int32_t tag, const void* payload, size_t len);

#define android_bWriteLog(tag, payload, len) \
  __android_log_bwrite(tag, payload, len)
#define android_btWriteLog(tag, type, payload, len) \
+3 −2
Original line number Diff line number Diff line
@@ -31,8 +31,9 @@ typedef enum log_id {
  LOG_ID_EVENTS = 2,
  LOG_ID_SYSTEM = 3,
  LOG_ID_CRASH = 4,
  LOG_ID_SECURITY = 5,
  LOG_ID_KERNEL = 6, /* place last, third-parties can not use it */
  LOG_ID_STATS = 5,
  LOG_ID_SECURITY = 6,
  LOG_ID_KERNEL = 7, /* place last, third-parties can not use it */

  LOG_ID_MAX
} log_id_t;
+4 −2
Original line number Diff line number Diff line
@@ -301,7 +301,7 @@ LIBLOG_ABI_PUBLIC int android_log_write_list(android_log_context ctx,
  const char* msg;
  ssize_t len;

  if ((id != LOG_ID_EVENTS) && (id != LOG_ID_SECURITY)) {
  if ((id != LOG_ID_EVENTS) && (id != LOG_ID_SECURITY) && (id != LOG_ID_STATS)) {
    return -EINVAL;
  }

@@ -326,7 +326,9 @@ LIBLOG_ABI_PUBLIC int android_log_write_list(android_log_context ctx,
  }
  return (id == LOG_ID_EVENTS)
             ? __android_log_bwrite(context->tag, msg, len)
             : __android_log_security_bwrite(context->tag, msg, len);
             : ((id == LOG_ID_STATS)
                    ? __android_log_stats_bwrite(context->tag, msg, len)
                    : __android_log_security_bwrite(context->tag, msg, len));
}

LIBLOG_ABI_PRIVATE int android_log_write_list_buffer(android_log_context ctx,
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ static const char* LOG_NAME[LOG_ID_MAX] = {
  [LOG_ID_EVENTS] = "events",
  [LOG_ID_SYSTEM] = "system",
  [LOG_ID_CRASH] = "crash",
  [LOG_ID_STATS] = "stats",
  [LOG_ID_SECURITY] = "security",
  [LOG_ID_KERNEL] = "kernel",
  /* clang-format on */
+13 −0
Original line number Diff line number Diff line
@@ -546,6 +546,19 @@ LIBLOG_ABI_PUBLIC int __android_log_bwrite(int32_t tag, const void* payload,
  return write_to_log(LOG_ID_EVENTS, vec, 2);
}

LIBLOG_ABI_PUBLIC int __android_log_stats_bwrite(int32_t tag,
                                                 const void* payload,
                                                 size_t len) {
  struct iovec vec[2];

  vec[0].iov_base = &tag;
  vec[0].iov_len = sizeof(tag);
  vec[1].iov_base = (void*)payload;
  vec[1].iov_len = len;

  return write_to_log(LOG_ID_STATS, vec, 2);
}

LIBLOG_ABI_PUBLIC int __android_log_security_bwrite(int32_t tag,
                                                    const void* payload,
                                                    size_t len) {
Loading