summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2016-09-21 11:24:13 -0500
committerMark Salyzyn2017-02-02 17:21:15 -0600
commitc9e5f3716626fb8fcbde87c2f7324cc9292a0bd5 (patch)
tree62c5e6ae6f95045d41fc736340fab29b0437942b /liblog/logd_reader.c
parent7da7fab790ca6cfff2755cf8c86b20b739b919ad (diff)
downloadplatform-system-core-c9e5f3716626fb8fcbde87c2f7324cc9292a0bd5.tar.gz
platform-system-core-c9e5f3716626fb8fcbde87c2f7324cc9292a0bd5.tar.xz
platform-system-core-c9e5f3716626fb8fcbde87c2f7324cc9292a0bd5.zip
liblog: add android_lookupEventTagNum
android_lookupEventTagNum added. Adds support for creating a new log tag at runtime, registered to the logd service. Tested on Hikey, all services stopped, shell only access, CPUs not locked (there is enough repeatability on this platform). $ /data/nativetest64/liblog-benchmarks/liblog-benchmarks BM_lookupEventTagNum iterations ns/op Precharge: start Precharge: stop 231 NB: only Tag matching, linear lookup (as reference, before unordered_map) BM_lookupEventTagNum 1000000 1017 NB: unordered_map with full Tag & Format lookup, but with Tag hashing BM_lookupEventTagNum 2000000 683 NB: with full Tag & Format hash and lookup for matching BM_lookupEventTagNum 2000000 814 NB: only Tag matching (Hail Mary path) BM_lookupEventTagNum 5000000 471 Because the database can now be dynamic, we added reader/writer locks which adds a 65ns (uncontended) premium on lookups, and switch to check for an allocation adds 25ns (either open code, or using string_view, no difference) which means our overall speed takes 90% as long as the requests did before we switched to unordered_map. Faster than before where we originally utilized binary lookup on static content, but not by much. Dynamic updates that are not cached locally take the following times to acquire long path to logd to generate. BM_lookupEventTag 20000000 139 BM_lookupEventTag_NOT 20000000 87 BM_lookupEventFormat 20000000 139 BM_lookupEventTagNum_logd_new 5000 335936 BM_lookupEventTagNum_logd_existing 10000 249226 The long path pickups are mitigated by the built-in caching, and the public mapping in /dev/event-log-tags. SideEffects: Event tags and signal handlers do not mix Test: liblog benchmarks Bug: 31456426 Change-Id: I69e6489d899cf35cdccffcee0d8d7cad469ada0a
Diffstat (limited to 'liblog/logd_reader.c')
-rw-r--r--liblog/logd_reader.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/liblog/logd_reader.c b/liblog/logd_reader.c
index 99d7fea3b..ccc7da8ae 100644
--- a/liblog/logd_reader.c
+++ b/liblog/logd_reader.c
@@ -37,6 +37,7 @@
37 37
38#include "config_read.h" 38#include "config_read.h"
39#include "log_portability.h" 39#include "log_portability.h"
40#include "logd_reader.h"
40#include "logger.h" 41#include "logger.h"
41 42
42/* branchless on many architectures. */ 43/* branchless on many architectures. */
@@ -324,6 +325,11 @@ done:
324 return ret; 325 return ret;
325} 326}
326 327
328LIBLOG_HIDDEN ssize_t __send_log_msg(char *buf, size_t buf_size)
329{
330 return send_log_msg(NULL, NULL, buf, buf_size);
331}
332
327static int check_log_success(char *buf, ssize_t ret) 333static int check_log_success(char *buf, ssize_t ret)
328{ 334{
329 if (ret < 0) { 335 if (ret < 0) {