summaryrefslogtreecommitdiffstats
path: root/liblog
diff options
context:
space:
mode:
authoryaochen2017-11-15 13:26:12 -0600
committerandroid-build-merger2017-11-15 13:26:12 -0600
commit11bb6bbf415389ca0aaab97b8dbe283f249d1135 (patch)
tree8540d34082192f095bf2085a6a7d3a29e09563fa /liblog
parent23e27db576d06761363365494327baf062468a66 (diff)
parent68f2c85354acd1d758f5aa2349b83b620a7ba1dd (diff)
downloadplatform-system-core-11bb6bbf415389ca0aaab97b8dbe283f249d1135.tar.gz
platform-system-core-11bb6bbf415389ca0aaab97b8dbe283f249d1135.tar.xz
platform-system-core-11bb6bbf415389ca0aaab97b8dbe283f249d1135.zip
Merge changes from topic "stats_log"
am: 68f2c85354 Change-Id: I2dce867c04ea61a05b32063f321414f459cbe26c
Diffstat (limited to 'liblog')
-rw-r--r--liblog/include/log/log.h2
-rw-r--r--liblog/include/log/log_id.h5
-rw-r--r--liblog/log_event_list.c6
-rw-r--r--liblog/logger_name.c3
-rw-r--r--liblog/logger_write.c13
5 files changed, 24 insertions, 5 deletions
diff --git a/liblog/include/log/log.h b/liblog/include/log/log.h
index d01708d8b..3813e6e32 100644
--- a/liblog/include/log/log.h
+++ b/liblog/include/log/log.h
@@ -95,6 +95,8 @@ int __android_log_btwrite(int32_t tag, char type, const void* payload,
95 size_t len); 95 size_t len);
96int __android_log_bswrite(int32_t tag, const char* payload); 96int __android_log_bswrite(int32_t tag, const char* payload);
97 97
98int __android_log_stats_bwrite(int32_t tag, const void* payload, size_t len);
99
98#define android_bWriteLog(tag, payload, len) \ 100#define android_bWriteLog(tag, payload, len) \
99 __android_log_bwrite(tag, payload, len) 101 __android_log_bwrite(tag, payload, len)
100#define android_btWriteLog(tag, type, payload, len) \ 102#define android_btWriteLog(tag, type, payload, len) \
diff --git a/liblog/include/log/log_id.h b/liblog/include/log/log_id.h
index 7bfa2770b..c44f5a2eb 100644
--- a/liblog/include/log/log_id.h
+++ b/liblog/include/log/log_id.h
@@ -31,8 +31,9 @@ typedef enum log_id {
31 LOG_ID_EVENTS = 2, 31 LOG_ID_EVENTS = 2,
32 LOG_ID_SYSTEM = 3, 32 LOG_ID_SYSTEM = 3,
33 LOG_ID_CRASH = 4, 33 LOG_ID_CRASH = 4,
34 LOG_ID_SECURITY = 5, 34 LOG_ID_STATS = 5,
35 LOG_ID_KERNEL = 6, /* place last, third-parties can not use it */ 35 LOG_ID_SECURITY = 6,
36 LOG_ID_KERNEL = 7, /* place last, third-parties can not use it */
36 37
37 LOG_ID_MAX 38 LOG_ID_MAX
38} log_id_t; 39} log_id_t;
diff --git a/liblog/log_event_list.c b/liblog/log_event_list.c
index 59ea5ef13..a59cb8738 100644
--- a/liblog/log_event_list.c
+++ b/liblog/log_event_list.c
@@ -301,7 +301,7 @@ LIBLOG_ABI_PUBLIC int android_log_write_list(android_log_context ctx,
301 const char* msg; 301 const char* msg;
302 ssize_t len; 302 ssize_t len;
303 303
304 if ((id != LOG_ID_EVENTS) && (id != LOG_ID_SECURITY)) { 304 if ((id != LOG_ID_EVENTS) && (id != LOG_ID_SECURITY) && (id != LOG_ID_STATS)) {
305 return -EINVAL; 305 return -EINVAL;
306 } 306 }
307 307
@@ -326,7 +326,9 @@ LIBLOG_ABI_PUBLIC int android_log_write_list(android_log_context ctx,
326 } 326 }
327 return (id == LOG_ID_EVENTS) 327 return (id == LOG_ID_EVENTS)
328 ? __android_log_bwrite(context->tag, msg, len) 328 ? __android_log_bwrite(context->tag, msg, len)
329 : __android_log_security_bwrite(context->tag, msg, len); 329 : ((id == LOG_ID_STATS)
330 ? __android_log_stats_bwrite(context->tag, msg, len)
331 : __android_log_security_bwrite(context->tag, msg, len));
330} 332}
331 333
332LIBLOG_ABI_PRIVATE int android_log_write_list_buffer(android_log_context ctx, 334LIBLOG_ABI_PRIVATE int android_log_write_list_buffer(android_log_context ctx,
diff --git a/liblog/logger_name.c b/liblog/logger_name.c
index a5a83e05a..479bbfeec 100644
--- a/liblog/logger_name.c
+++ b/liblog/logger_name.c
@@ -22,12 +22,13 @@
22 22
23/* In the future, we would like to make this list extensible */ 23/* In the future, we would like to make this list extensible */
24static const char* LOG_NAME[LOG_ID_MAX] = { 24static const char* LOG_NAME[LOG_ID_MAX] = {
25 /* clang-format off */ 25 /* clang-format off */
26 [LOG_ID_MAIN] = "main", 26 [LOG_ID_MAIN] = "main",
27 [LOG_ID_RADIO] = "radio", 27 [LOG_ID_RADIO] = "radio",
28 [LOG_ID_EVENTS] = "events", 28 [LOG_ID_EVENTS] = "events",
29 [LOG_ID_SYSTEM] = "system", 29 [LOG_ID_SYSTEM] = "system",
30 [LOG_ID_CRASH] = "crash", 30 [LOG_ID_CRASH] = "crash",
31 [LOG_ID_STATS] = "stats",
31 [LOG_ID_SECURITY] = "security", 32 [LOG_ID_SECURITY] = "security",
32 [LOG_ID_KERNEL] = "kernel", 33 [LOG_ID_KERNEL] = "kernel",
33 /* clang-format on */ 34 /* clang-format on */
diff --git a/liblog/logger_write.c b/liblog/logger_write.c
index 84feb206b..589ce8429 100644
--- a/liblog/logger_write.c
+++ b/liblog/logger_write.c
@@ -546,6 +546,19 @@ LIBLOG_ABI_PUBLIC int __android_log_bwrite(int32_t tag, const void* payload,
546 return write_to_log(LOG_ID_EVENTS, vec, 2); 546 return write_to_log(LOG_ID_EVENTS, vec, 2);
547} 547}
548 548
549LIBLOG_ABI_PUBLIC int __android_log_stats_bwrite(int32_t tag,
550 const void* payload,
551 size_t len) {
552 struct iovec vec[2];
553
554 vec[0].iov_base = &tag;
555 vec[0].iov_len = sizeof(tag);
556 vec[1].iov_base = (void*)payload;
557 vec[1].iov_len = len;
558
559 return write_to_log(LOG_ID_STATS, vec, 2);
560}
561
549LIBLOG_ABI_PUBLIC int __android_log_security_bwrite(int32_t tag, 562LIBLOG_ABI_PUBLIC int __android_log_security_bwrite(int32_t tag,
550 const void* payload, 563 const void* payload,
551 size_t len) { 564 size_t len) {