c9e5f37166
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
30 lines
869 B
C
30 lines
869 B
C
/*
|
|
* Copyright (C) 2016 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#ifndef _LIBLOG_LOGD_READER_H__
|
|
#define _LIBLOG_LOGD_READER_H__
|
|
|
|
#include <unistd.h>
|
|
|
|
#include "log_portability.h"
|
|
|
|
__BEGIN_DECLS
|
|
|
|
LIBLOG_HIDDEN ssize_t __send_log_msg(char *buf, size_t buf_size);
|
|
|
|
__END_DECLS
|
|
|
|
#endif /* _LIBLOG_LOGD_READER_H__ */
|