diff options
authorMark Salyzyn2016-09-21 11:24:13 -0500
committerMark Salyzyn2017-02-02 17:21:15 -0600
commitc9e5f3716626fb8fcbde87c2f7324cc9292a0bd5 (patch)
tree62c5e6ae6f95045d41fc736340fab29b0437942b /liblog/fake_log_device.c
parent7da7fab790ca6cfff2755cf8c86b20b739b919ad (diff)
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/fake_log_device.c')
1 files changed, 6 insertions, 0 deletions
diff --git a/liblog/fake_log_device.c b/liblog/fake_log_device.c
index 493922101..957129ed9 100644
--- a/liblog/fake_log_device.c
+++ b/liblog/fake_log_device.c
@@ -715,6 +715,12 @@ LIBLOG_HIDDEN ssize_t fakeLogWritev(int fd,
715 return redirectWritev(fd, vector, count); 715 return redirectWritev(fd, vector, count);
716} 716}
717 717
718LIBLOG_HIDDEN ssize_t __send_log_msg(char *buf __unused,
719 size_t buf_size __unused)
721 return -ENODEV;
718LIBLOG_ABI_PUBLIC int __android_log_is_loggable(int prio, 724LIBLOG_ABI_PUBLIC int __android_log_is_loggable(int prio,
719 const char *tag __unused, 725 const char *tag __unused,
720 int def) 726 int def)