2014-02-06 23:48:50 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 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 _LOGD_LOG_STATISTICS_H__
|
|
|
|
#define _LOGD_LOG_STATISTICS_H__
|
|
|
|
|
2016-12-19 23:51:15 +01:00
|
|
|
#include <ctype.h>
|
2017-04-19 23:39:21 +02:00
|
|
|
#include <inttypes.h>
|
|
|
|
#include <stdint.h>
|
2015-03-16 16:26:05 +01:00
|
|
|
#include <stdlib.h>
|
2017-04-19 23:39:21 +02:00
|
|
|
#include <string.h>
|
2014-02-06 23:48:50 +01:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
#include <algorithm> // std::max
|
2016-12-19 23:51:15 +01:00
|
|
|
#include <memory>
|
2017-12-01 01:31:35 +01:00
|
|
|
#include <string>
|
|
|
|
#include <string_view>
|
2015-05-19 18:12:30 +02:00
|
|
|
#include <unordered_map>
|
|
|
|
|
2015-12-05 07:00:26 +01:00
|
|
|
#include <android-base/stringprintf.h>
|
2017-03-10 23:31:54 +01:00
|
|
|
#include <android/log.h>
|
2017-04-14 18:46:57 +02:00
|
|
|
#include <log/log_time.h>
|
2015-08-22 01:44:30 +02:00
|
|
|
#include <private/android_filesystem_config.h>
|
2017-04-19 23:39:21 +02:00
|
|
|
#include <utils/FastStrcmp.h>
|
2015-03-10 21:51:35 +01:00
|
|
|
|
|
|
|
#include "LogBufferElement.h"
|
2015-08-28 17:02:59 +02:00
|
|
|
#include "LogUtils.h"
|
2014-02-06 23:48:50 +01:00
|
|
|
|
|
|
|
#define log_id_for_each(i) \
|
2017-03-10 23:31:54 +01:00
|
|
|
for (log_id_t i = LOG_ID_MIN; (i) < LOG_ID_MAX; (i) = (log_id_t)((i) + 1))
|
2014-02-06 23:48:50 +01:00
|
|
|
|
2015-08-22 01:44:30 +02:00
|
|
|
class LogStatistics;
|
|
|
|
|
2015-03-16 16:26:05 +01:00
|
|
|
template <typename TKey, typename TEntry>
|
2015-05-19 18:12:30 +02:00
|
|
|
class LogHashtable {
|
|
|
|
std::unordered_map<TKey, TEntry> map;
|
|
|
|
|
2016-10-06 18:55:21 +02:00
|
|
|
size_t bucket_size() const {
|
|
|
|
size_t count = 0;
|
|
|
|
for (size_t idx = 0; idx < map.bucket_count(); ++idx) {
|
|
|
|
size_t bucket_size = map.bucket_size(idx);
|
|
|
|
if (bucket_size == 0) bucket_size = 1;
|
|
|
|
count += bucket_size;
|
|
|
|
}
|
|
|
|
float load_factor = map.max_load_factor();
|
|
|
|
if (load_factor < 1.0) return count;
|
|
|
|
return count * load_factor;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const size_t unordered_map_per_entry_overhead = sizeof(void*);
|
|
|
|
static const size_t unordered_map_bucket_overhead = sizeof(void*);
|
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
public:
|
|
|
|
size_t size() const {
|
|
|
|
return map.size();
|
|
|
|
}
|
2016-10-06 19:09:24 +02:00
|
|
|
|
2016-10-06 18:55:21 +02:00
|
|
|
// Estimate unordered_map memory usage.
|
|
|
|
size_t sizeOf() const {
|
|
|
|
return sizeof(*this) +
|
2016-10-06 19:09:24 +02:00
|
|
|
(size() * (sizeof(TEntry) + unordered_map_per_entry_overhead)) +
|
2016-10-06 18:55:21 +02:00
|
|
|
(bucket_size() * sizeof(size_t) + unordered_map_bucket_overhead);
|
|
|
|
}
|
|
|
|
|
2015-05-19 18:12:30 +02:00
|
|
|
typedef typename std::unordered_map<TKey, TEntry>::iterator iterator;
|
2017-03-10 23:31:54 +01:00
|
|
|
typedef
|
|
|
|
typename std::unordered_map<TKey, TEntry>::const_iterator const_iterator;
|
2015-05-19 18:12:30 +02:00
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
std::unique_ptr<const TEntry* []> sort(uid_t uid, pid_t pid,
|
2015-12-17 18:58:43 +01:00
|
|
|
size_t len) const {
|
2015-08-22 01:44:30 +02:00
|
|
|
if (!len) {
|
2017-04-19 23:39:21 +02:00
|
|
|
std::unique_ptr<const TEntry* []> sorted(nullptr);
|
2015-03-16 16:26:05 +01:00
|
|
|
return sorted;
|
|
|
|
}
|
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
const TEntry** retval = new const TEntry*[len];
|
2015-08-22 01:44:30 +02:00
|
|
|
memset(retval, 0, sizeof(*retval) * len);
|
2015-03-16 16:26:05 +01:00
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
for (const_iterator it = map.begin(); it != map.end(); ++it) {
|
|
|
|
const TEntry& entry = it->second;
|
2015-12-17 18:58:43 +01:00
|
|
|
|
|
|
|
if ((uid != AID_ROOT) && (uid != entry.getUid())) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (pid && entry.getPid() && (pid != entry.getPid())) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2015-08-22 01:44:30 +02:00
|
|
|
size_t sizes = entry.getSizes();
|
|
|
|
ssize_t index = len - 1;
|
2017-03-10 23:31:54 +01:00
|
|
|
while ((!retval[index] || (sizes > retval[index]->getSizes())) &&
|
|
|
|
(--index >= 0))
|
2015-03-16 16:26:05 +01:00
|
|
|
;
|
2015-08-22 01:44:30 +02:00
|
|
|
if (++index < (ssize_t)len) {
|
|
|
|
size_t num = len - index - 1;
|
|
|
|
if (num) {
|
|
|
|
memmove(&retval[index + 1], &retval[index],
|
|
|
|
num * sizeof(retval[0]));
|
2015-03-16 16:26:05 +01:00
|
|
|
}
|
2015-08-22 01:44:30 +02:00
|
|
|
retval[index] = &entry;
|
2015-03-16 16:26:05 +01:00
|
|
|
}
|
|
|
|
}
|
2017-03-10 23:31:54 +01:00
|
|
|
std::unique_ptr<const TEntry* []> sorted(retval);
|
2015-03-16 16:26:05 +01:00
|
|
|
return sorted;
|
|
|
|
}
|
|
|
|
|
2017-04-19 23:39:21 +02:00
|
|
|
inline iterator add(const TKey& key, const LogBufferElement* element) {
|
2015-05-19 18:12:30 +02:00
|
|
|
iterator it = map.find(key);
|
|
|
|
if (it == map.end()) {
|
2015-08-22 01:44:30 +02:00
|
|
|
it = map.insert(std::make_pair(key, TEntry(element))).first;
|
2015-05-19 18:12:30 +02:00
|
|
|
} else {
|
2015-08-22 01:44:30 +02:00
|
|
|
it->second.add(element);
|
2015-04-13 23:24:45 +02:00
|
|
|
}
|
2015-05-19 18:12:30 +02:00
|
|
|
return it;
|
2015-04-13 23:24:45 +02:00
|
|
|
}
|
|
|
|
|
2015-05-19 18:12:30 +02:00
|
|
|
inline iterator add(TKey key) {
|
|
|
|
iterator it = map.find(key);
|
|
|
|
if (it == map.end()) {
|
|
|
|
it = map.insert(std::make_pair(key, TEntry(key))).first;
|
|
|
|
} else {
|
|
|
|
it->second.add(key);
|
2015-04-13 23:24:45 +02:00
|
|
|
}
|
2015-05-19 18:12:30 +02:00
|
|
|
return it;
|
2015-04-13 23:24:45 +02:00
|
|
|
}
|
|
|
|
|
2017-04-19 23:39:21 +02:00
|
|
|
void subtract(TKey&& key, const LogBufferElement* element) {
|
|
|
|
iterator it = map.find(std::move(key));
|
|
|
|
if ((it != map.end()) && it->second.subtract(element)) {
|
|
|
|
map.erase(it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void subtract(const TKey& key, const LogBufferElement* element) {
|
2015-05-19 18:12:30 +02:00
|
|
|
iterator it = map.find(key);
|
2015-08-22 01:44:30 +02:00
|
|
|
if ((it != map.end()) && it->second.subtract(element)) {
|
2015-05-19 18:12:30 +02:00
|
|
|
map.erase(it);
|
2015-04-13 23:24:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-19 23:39:21 +02:00
|
|
|
inline void drop(TKey key, const LogBufferElement* element) {
|
2015-05-19 18:12:30 +02:00
|
|
|
iterator it = map.find(key);
|
|
|
|
if (it != map.end()) {
|
2015-08-22 01:44:30 +02:00
|
|
|
it->second.drop(element);
|
2015-04-13 23:24:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
inline iterator begin() {
|
|
|
|
return map.begin();
|
|
|
|
}
|
|
|
|
inline const_iterator begin() const {
|
|
|
|
return map.begin();
|
|
|
|
}
|
|
|
|
inline iterator end() {
|
|
|
|
return map.end();
|
|
|
|
}
|
|
|
|
inline const_iterator end() const {
|
|
|
|
return map.end();
|
|
|
|
}
|
2015-08-22 01:44:30 +02:00
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
std::string format(const LogStatistics& stat, uid_t uid, pid_t pid,
|
|
|
|
const std::string& name = std::string(""),
|
|
|
|
log_id_t id = LOG_ID_MAX) const {
|
2015-08-22 01:44:30 +02:00
|
|
|
static const size_t maximum_sorted_entries = 32;
|
|
|
|
std::string output;
|
2017-03-10 23:31:54 +01:00
|
|
|
std::unique_ptr<const TEntry* []> sorted =
|
|
|
|
sort(uid, pid, maximum_sorted_entries);
|
2015-08-22 01:44:30 +02:00
|
|
|
if (!sorted.get()) {
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
bool headerPrinted = false;
|
|
|
|
for (size_t index = 0; index < maximum_sorted_entries; ++index) {
|
2017-03-10 23:31:54 +01:00
|
|
|
const TEntry* entry = sorted[index];
|
2015-08-22 01:44:30 +02:00
|
|
|
if (!entry) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (entry->getSizes() <= (sorted[0]->getSizes() / 100)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!headerPrinted) {
|
|
|
|
output += "\n\n";
|
|
|
|
output += entry->formatHeader(name, id);
|
|
|
|
headerPrinted = true;
|
|
|
|
}
|
|
|
|
output += entry->format(stat, id);
|
|
|
|
}
|
|
|
|
return output;
|
|
|
|
}
|
2015-03-16 16:26:05 +01:00
|
|
|
};
|
|
|
|
|
2015-08-22 01:44:30 +02:00
|
|
|
namespace EntryBaseConstants {
|
2017-03-10 23:31:54 +01:00
|
|
|
static constexpr size_t pruned_len = 14;
|
|
|
|
static constexpr size_t total_len = 80;
|
2015-08-22 01:44:30 +02:00
|
|
|
}
|
|
|
|
|
2015-04-13 23:24:45 +02:00
|
|
|
struct EntryBase {
|
2015-03-10 21:51:35 +01:00
|
|
|
size_t size;
|
2014-02-06 23:48:50 +01:00
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
EntryBase() : size(0) {
|
|
|
|
}
|
2017-04-19 23:39:21 +02:00
|
|
|
explicit EntryBase(const LogBufferElement* element)
|
|
|
|
: size(element->getMsgLen()) {
|
2017-03-10 23:31:54 +01:00
|
|
|
}
|
2014-02-06 23:48:50 +01:00
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
size_t getSizes() const {
|
|
|
|
return size;
|
|
|
|
}
|
2015-04-13 23:24:45 +02:00
|
|
|
|
2017-04-19 23:39:21 +02:00
|
|
|
inline void add(const LogBufferElement* element) {
|
2017-03-10 23:31:54 +01:00
|
|
|
size += element->getMsgLen();
|
|
|
|
}
|
2017-04-19 23:39:21 +02:00
|
|
|
inline bool subtract(const LogBufferElement* element) {
|
2015-08-22 01:44:30 +02:00
|
|
|
size -= element->getMsgLen();
|
|
|
|
return !size;
|
|
|
|
}
|
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
static std::string formatLine(const std::string& name,
|
|
|
|
const std::string& size,
|
|
|
|
const std::string& pruned) {
|
|
|
|
ssize_t drop_len =
|
|
|
|
std::max(pruned.length() + 1, EntryBaseConstants::pruned_len);
|
|
|
|
ssize_t size_len =
|
|
|
|
std::max(size.length() + 1, EntryBaseConstants::total_len -
|
|
|
|
name.length() - drop_len - 1);
|
|
|
|
|
|
|
|
std::string ret = android::base::StringPrintf(
|
|
|
|
"%s%*s%*s", name.c_str(), (int)size_len, size.c_str(),
|
|
|
|
(int)drop_len, pruned.c_str());
|
2016-12-19 23:51:15 +01:00
|
|
|
// remove any trailing spaces
|
|
|
|
size_t pos = ret.size();
|
|
|
|
size_t len = 0;
|
|
|
|
while (pos && isspace(ret[--pos])) ++len;
|
|
|
|
if (len) ret.erase(pos + 1, len);
|
|
|
|
return ret + "\n";
|
2015-08-22 01:44:30 +02:00
|
|
|
}
|
2015-04-13 23:24:45 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct EntryBaseDropped : public EntryBase {
|
|
|
|
size_t dropped;
|
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
EntryBaseDropped() : dropped(0) {
|
|
|
|
}
|
2017-04-19 23:39:21 +02:00
|
|
|
explicit EntryBaseDropped(const LogBufferElement* element)
|
2017-03-10 23:31:54 +01:00
|
|
|
: EntryBase(element), dropped(element->getDropped()) {
|
2015-08-22 01:44:30 +02:00
|
|
|
}
|
2015-04-13 23:24:45 +02:00
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
size_t getDropped() const {
|
|
|
|
return dropped;
|
|
|
|
}
|
2015-03-16 20:04:09 +01:00
|
|
|
|
2017-04-19 23:39:21 +02:00
|
|
|
inline void add(const LogBufferElement* element) {
|
2015-08-22 01:44:30 +02:00
|
|
|
dropped += element->getDropped();
|
|
|
|
EntryBase::add(element);
|
2015-04-13 23:24:45 +02:00
|
|
|
}
|
2017-04-19 23:39:21 +02:00
|
|
|
inline bool subtract(const LogBufferElement* element) {
|
2015-08-22 01:44:30 +02:00
|
|
|
dropped -= element->getDropped();
|
|
|
|
return EntryBase::subtract(element) && !dropped;
|
2015-04-13 23:24:45 +02:00
|
|
|
}
|
2017-04-19 23:39:21 +02:00
|
|
|
inline void drop(const LogBufferElement* element) {
|
2015-04-13 23:24:45 +02:00
|
|
|
dropped += 1;
|
2015-08-22 01:44:30 +02:00
|
|
|
EntryBase::subtract(element);
|
2015-04-13 23:24:45 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct UidEntry : public EntryBaseDropped {
|
|
|
|
const uid_t uid;
|
2015-12-17 18:58:43 +01:00
|
|
|
pid_t pid;
|
2015-04-13 23:24:45 +02:00
|
|
|
|
2017-04-19 23:39:21 +02:00
|
|
|
explicit UidEntry(const LogBufferElement* element)
|
2017-03-10 23:31:54 +01:00
|
|
|
: EntryBaseDropped(element),
|
|
|
|
uid(element->getUid()),
|
|
|
|
pid(element->getPid()) {
|
2015-08-22 01:44:30 +02:00
|
|
|
}
|
2015-04-13 23:24:45 +02:00
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
inline const uid_t& getKey() const {
|
|
|
|
return uid;
|
|
|
|
}
|
|
|
|
inline const uid_t& getUid() const {
|
|
|
|
return getKey();
|
|
|
|
}
|
|
|
|
inline const pid_t& getPid() const {
|
|
|
|
return pid;
|
|
|
|
}
|
2015-12-17 18:58:43 +01:00
|
|
|
|
2017-04-19 23:39:21 +02:00
|
|
|
inline void add(const LogBufferElement* element) {
|
2015-12-17 18:58:43 +01:00
|
|
|
if (pid != element->getPid()) {
|
|
|
|
pid = -1;
|
|
|
|
}
|
2016-12-13 19:31:29 +01:00
|
|
|
EntryBaseDropped::add(element);
|
2015-12-17 18:58:43 +01:00
|
|
|
}
|
2015-08-22 01:44:30 +02:00
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
std::string formatHeader(const std::string& name, log_id_t id) const;
|
|
|
|
std::string format(const LogStatistics& stat, log_id_t id) const;
|
2014-02-06 23:48:50 +01:00
|
|
|
};
|
|
|
|
|
2015-04-13 23:24:45 +02:00
|
|
|
struct PidEntry : public EntryBaseDropped {
|
2015-03-16 16:26:05 +01:00
|
|
|
const pid_t pid;
|
|
|
|
uid_t uid;
|
2017-03-10 23:31:54 +01:00
|
|
|
char* name;
|
2015-03-16 16:26:05 +01:00
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
explicit PidEntry(pid_t pid)
|
|
|
|
: EntryBaseDropped(),
|
|
|
|
pid(pid),
|
|
|
|
uid(android::pidToUid(pid)),
|
|
|
|
name(android::pidToName(pid)) {
|
|
|
|
}
|
2017-04-19 23:39:21 +02:00
|
|
|
explicit PidEntry(const LogBufferElement* element)
|
2017-03-10 23:31:54 +01:00
|
|
|
: EntryBaseDropped(element),
|
|
|
|
pid(element->getPid()),
|
|
|
|
uid(element->getUid()),
|
|
|
|
name(android::pidToName(pid)) {
|
2015-08-22 01:44:30 +02:00
|
|
|
}
|
2017-03-10 23:31:54 +01:00
|
|
|
PidEntry(const PidEntry& element)
|
|
|
|
: EntryBaseDropped(element),
|
|
|
|
pid(element.pid),
|
|
|
|
uid(element.uid),
|
2017-04-19 23:39:21 +02:00
|
|
|
name(element.name ? strdup(element.name) : nullptr) {
|
2015-08-22 01:44:30 +02:00
|
|
|
}
|
2017-03-10 23:31:54 +01:00
|
|
|
~PidEntry() {
|
|
|
|
free(name);
|
2015-08-22 01:44:30 +02:00
|
|
|
}
|
2015-03-16 16:26:05 +01:00
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
const pid_t& getKey() const {
|
|
|
|
return pid;
|
|
|
|
}
|
|
|
|
const pid_t& getPid() const {
|
|
|
|
return getKey();
|
|
|
|
}
|
|
|
|
const uid_t& getUid() const {
|
|
|
|
return uid;
|
|
|
|
}
|
|
|
|
const char* getName() const {
|
|
|
|
return name;
|
|
|
|
}
|
2015-04-13 23:24:45 +02:00
|
|
|
|
2015-08-22 01:44:30 +02:00
|
|
|
inline void add(pid_t newPid) {
|
2016-12-02 19:08:48 +01:00
|
|
|
if (name && !fastcmp<strncmp>(name, "zygote", 6)) {
|
2015-04-20 19:27:38 +02:00
|
|
|
free(name);
|
2017-04-19 23:39:21 +02:00
|
|
|
name = nullptr;
|
2015-04-20 19:27:38 +02:00
|
|
|
}
|
2015-04-13 23:24:45 +02:00
|
|
|
if (!name) {
|
2015-08-22 01:44:30 +02:00
|
|
|
name = android::pidToName(newPid);
|
2015-04-13 23:24:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-19 23:39:21 +02:00
|
|
|
inline void add(const LogBufferElement* element) {
|
2015-08-22 01:44:30 +02:00
|
|
|
uid_t incomingUid = element->getUid();
|
|
|
|
if (getUid() != incomingUid) {
|
|
|
|
uid = incomingUid;
|
2015-04-13 23:24:45 +02:00
|
|
|
free(name);
|
2015-08-22 01:44:30 +02:00
|
|
|
name = android::pidToName(element->getPid());
|
2015-04-13 23:24:45 +02:00
|
|
|
} else {
|
2015-08-22 01:44:30 +02:00
|
|
|
add(element->getPid());
|
2015-04-13 23:24:45 +02:00
|
|
|
}
|
2015-08-22 01:44:30 +02:00
|
|
|
EntryBaseDropped::add(element);
|
2015-04-13 23:24:45 +02:00
|
|
|
}
|
2015-08-22 01:44:30 +02:00
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
std::string formatHeader(const std::string& name, log_id_t id) const;
|
|
|
|
std::string format(const LogStatistics& stat, log_id_t id) const;
|
2015-04-13 23:24:45 +02:00
|
|
|
};
|
|
|
|
|
2015-04-20 22:35:15 +02:00
|
|
|
struct TidEntry : public EntryBaseDropped {
|
|
|
|
const pid_t tid;
|
2015-12-17 18:58:43 +01:00
|
|
|
pid_t pid;
|
2015-04-20 22:35:15 +02:00
|
|
|
uid_t uid;
|
2017-03-10 23:31:54 +01:00
|
|
|
char* name;
|
|
|
|
|
|
|
|
TidEntry(pid_t tid, pid_t pid)
|
|
|
|
: EntryBaseDropped(),
|
|
|
|
tid(tid),
|
|
|
|
pid(pid),
|
|
|
|
uid(android::pidToUid(tid)),
|
|
|
|
name(android::tidToName(tid)) {
|
|
|
|
}
|
2017-05-04 22:54:46 +02:00
|
|
|
TidEntry(pid_t tid)
|
|
|
|
: EntryBaseDropped(),
|
|
|
|
tid(tid),
|
|
|
|
pid(android::tidToPid(tid)),
|
|
|
|
uid(android::pidToUid(tid)),
|
|
|
|
name(android::tidToName(tid)) {
|
|
|
|
}
|
2017-04-19 23:39:21 +02:00
|
|
|
explicit TidEntry(const LogBufferElement* element)
|
2017-03-10 23:31:54 +01:00
|
|
|
: EntryBaseDropped(element),
|
|
|
|
tid(element->getTid()),
|
|
|
|
pid(element->getPid()),
|
|
|
|
uid(element->getUid()),
|
|
|
|
name(android::tidToName(tid)) {
|
|
|
|
}
|
|
|
|
TidEntry(const TidEntry& element)
|
|
|
|
: EntryBaseDropped(element),
|
|
|
|
tid(element.tid),
|
|
|
|
pid(element.pid),
|
|
|
|
uid(element.uid),
|
2017-04-19 23:39:21 +02:00
|
|
|
name(element.name ? strdup(element.name) : nullptr) {
|
2017-03-10 23:31:54 +01:00
|
|
|
}
|
|
|
|
~TidEntry() {
|
|
|
|
free(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
const pid_t& getKey() const {
|
|
|
|
return tid;
|
|
|
|
}
|
|
|
|
const pid_t& getTid() const {
|
|
|
|
return getKey();
|
|
|
|
}
|
|
|
|
const pid_t& getPid() const {
|
|
|
|
return pid;
|
|
|
|
}
|
|
|
|
const uid_t& getUid() const {
|
|
|
|
return uid;
|
|
|
|
}
|
|
|
|
const char* getName() const {
|
|
|
|
return name;
|
|
|
|
}
|
2015-04-20 22:35:15 +02:00
|
|
|
|
2015-08-22 01:44:30 +02:00
|
|
|
inline void add(pid_t incomingTid) {
|
2016-12-02 19:08:48 +01:00
|
|
|
if (name && !fastcmp<strncmp>(name, "zygote", 6)) {
|
2015-04-20 22:35:15 +02:00
|
|
|
free(name);
|
2017-04-19 23:39:21 +02:00
|
|
|
name = nullptr;
|
2015-04-20 22:35:15 +02:00
|
|
|
}
|
|
|
|
if (!name) {
|
2015-08-22 01:44:30 +02:00
|
|
|
name = android::tidToName(incomingTid);
|
2015-04-20 22:35:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-19 23:39:21 +02:00
|
|
|
inline void add(const LogBufferElement* element) {
|
2015-08-22 01:44:30 +02:00
|
|
|
uid_t incomingUid = element->getUid();
|
2015-12-17 18:58:43 +01:00
|
|
|
pid_t incomingPid = element->getPid();
|
|
|
|
if ((getUid() != incomingUid) || (getPid() != incomingPid)) {
|
2015-08-22 01:44:30 +02:00
|
|
|
uid = incomingUid;
|
2015-12-17 18:58:43 +01:00
|
|
|
pid = incomingPid;
|
2015-04-20 22:35:15 +02:00
|
|
|
free(name);
|
2015-08-22 01:44:30 +02:00
|
|
|
name = android::tidToName(element->getTid());
|
2015-04-20 22:35:15 +02:00
|
|
|
} else {
|
2015-08-22 01:44:30 +02:00
|
|
|
add(element->getTid());
|
2015-04-20 22:35:15 +02:00
|
|
|
}
|
2015-08-22 01:44:30 +02:00
|
|
|
EntryBaseDropped::add(element);
|
2015-04-20 22:35:15 +02:00
|
|
|
}
|
2015-08-22 01:44:30 +02:00
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
std::string formatHeader(const std::string& name, log_id_t id) const;
|
|
|
|
std::string format(const LogStatistics& stat, log_id_t id) const;
|
2015-04-20 22:35:15 +02:00
|
|
|
};
|
|
|
|
|
2016-07-15 00:34:30 +02:00
|
|
|
struct TagEntry : public EntryBaseDropped {
|
2015-04-13 23:24:45 +02:00
|
|
|
const uint32_t tag;
|
2015-12-17 18:58:43 +01:00
|
|
|
pid_t pid;
|
2015-04-13 23:24:45 +02:00
|
|
|
uid_t uid;
|
|
|
|
|
2017-04-19 23:39:21 +02:00
|
|
|
explicit TagEntry(const LogBufferElement* element)
|
2017-03-10 23:31:54 +01:00
|
|
|
: EntryBaseDropped(element),
|
|
|
|
tag(element->getTag()),
|
|
|
|
pid(element->getPid()),
|
|
|
|
uid(element->getUid()) {
|
2015-08-22 01:44:30 +02:00
|
|
|
}
|
2015-04-13 23:24:45 +02:00
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
const uint32_t& getKey() const {
|
|
|
|
return tag;
|
|
|
|
}
|
|
|
|
const pid_t& getPid() const {
|
|
|
|
return pid;
|
|
|
|
}
|
|
|
|
const uid_t& getUid() const {
|
|
|
|
return uid;
|
|
|
|
}
|
|
|
|
const char* getName() const {
|
|
|
|
return android::tagToName(tag);
|
|
|
|
}
|
2015-04-13 23:24:45 +02:00
|
|
|
|
2017-04-19 23:39:21 +02:00
|
|
|
inline void add(const LogBufferElement* element) {
|
2015-12-17 18:58:43 +01:00
|
|
|
if (uid != element->getUid()) {
|
2015-04-13 23:24:45 +02:00
|
|
|
uid = -1;
|
|
|
|
}
|
2015-12-17 18:58:43 +01:00
|
|
|
if (pid != element->getPid()) {
|
|
|
|
pid = -1;
|
|
|
|
}
|
2016-12-13 19:31:29 +01:00
|
|
|
EntryBaseDropped::add(element);
|
2015-04-13 23:24:45 +02:00
|
|
|
}
|
2015-08-22 01:44:30 +02:00
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
std::string formatHeader(const std::string& name, log_id_t id) const;
|
|
|
|
std::string format(const LogStatistics& stat, log_id_t id) const;
|
2015-03-16 16:26:05 +01:00
|
|
|
};
|
|
|
|
|
2017-04-19 23:39:21 +02:00
|
|
|
struct TagNameKey {
|
|
|
|
std::string* alloc;
|
2017-12-01 01:31:35 +01:00
|
|
|
std::string_view name; // Saves space if const char*
|
2017-04-19 23:39:21 +02:00
|
|
|
|
|
|
|
explicit TagNameKey(const LogBufferElement* element)
|
|
|
|
: alloc(nullptr), name("", strlen("")) {
|
|
|
|
if (element->isBinary()) {
|
|
|
|
uint32_t tag = element->getTag();
|
|
|
|
if (tag) {
|
|
|
|
const char* cp = android::tagToName(tag);
|
|
|
|
if (cp) {
|
2017-12-01 01:31:35 +01:00
|
|
|
name = std::string_view(cp, strlen(cp));
|
2017-04-19 23:39:21 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
alloc = new std::string(
|
|
|
|
android::base::StringPrintf("[%" PRIu32 "]", tag));
|
|
|
|
if (!alloc) return;
|
2017-12-01 01:31:35 +01:00
|
|
|
name = std::string_view(alloc->c_str(), alloc->size());
|
2017-04-19 23:39:21 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
const char* msg = element->getMsg();
|
|
|
|
if (!msg) {
|
2017-12-01 01:31:35 +01:00
|
|
|
name = std::string_view("chatty", strlen("chatty"));
|
2017-04-19 23:39:21 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
++msg;
|
2018-08-13 23:22:56 +02:00
|
|
|
uint16_t len = element->getMsgLen();
|
2017-04-19 23:39:21 +02:00
|
|
|
len = (len <= 1) ? 0 : strnlen(msg, len - 1);
|
|
|
|
if (!len) {
|
2017-12-01 01:31:35 +01:00
|
|
|
name = std::string_view("<NULL>", strlen("<NULL>"));
|
2017-04-19 23:39:21 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
alloc = new std::string(msg, len);
|
|
|
|
if (!alloc) return;
|
2017-12-01 01:31:35 +01:00
|
|
|
name = std::string_view(alloc->c_str(), alloc->size());
|
2017-04-19 23:39:21 +02:00
|
|
|
}
|
|
|
|
|
2018-09-25 20:16:22 +02:00
|
|
|
explicit TagNameKey(TagNameKey&& rval) noexcept
|
2017-04-19 23:39:21 +02:00
|
|
|
: alloc(rval.alloc), name(rval.name.data(), rval.name.length()) {
|
|
|
|
rval.alloc = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
explicit TagNameKey(const TagNameKey& rval)
|
|
|
|
: alloc(rval.alloc ? new std::string(*rval.alloc) : nullptr),
|
|
|
|
name(alloc ? alloc->data() : rval.name.data(), rval.name.length()) {
|
|
|
|
}
|
|
|
|
|
|
|
|
~TagNameKey() {
|
|
|
|
if (alloc) delete alloc;
|
|
|
|
}
|
|
|
|
|
2017-12-01 01:31:35 +01:00
|
|
|
operator const std::string_view() const {
|
2017-04-19 23:39:21 +02:00
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* data() const {
|
|
|
|
return name.data();
|
|
|
|
}
|
|
|
|
size_t length() const {
|
|
|
|
return name.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(const TagNameKey& rval) const {
|
|
|
|
if (length() != rval.length()) return false;
|
|
|
|
if (length() == 0) return true;
|
|
|
|
return fastcmp<strncmp>(data(), rval.data(), length()) == 0;
|
|
|
|
}
|
|
|
|
bool operator!=(const TagNameKey& rval) const {
|
|
|
|
return !(*this == rval);
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t getAllocLength() const {
|
|
|
|
return alloc ? alloc->length() + 1 + sizeof(std::string) : 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// Hash for TagNameKey
|
|
|
|
template <>
|
|
|
|
struct std::hash<TagNameKey>
|
|
|
|
: public std::unary_function<const TagNameKey&, size_t> {
|
|
|
|
size_t operator()(const TagNameKey& __t) const noexcept {
|
|
|
|
if (!__t.length()) return 0;
|
2017-12-01 01:31:35 +01:00
|
|
|
return std::hash<std::string_view>()(std::string_view(__t));
|
2017-04-19 23:39:21 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TagNameEntry : public EntryBase {
|
|
|
|
pid_t tid;
|
|
|
|
pid_t pid;
|
|
|
|
uid_t uid;
|
|
|
|
TagNameKey name;
|
|
|
|
|
|
|
|
explicit TagNameEntry(const LogBufferElement* element)
|
|
|
|
: EntryBase(element),
|
|
|
|
tid(element->getTid()),
|
|
|
|
pid(element->getPid()),
|
|
|
|
uid(element->getUid()),
|
|
|
|
name(element) {
|
|
|
|
}
|
|
|
|
|
|
|
|
const TagNameKey& getKey() const {
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
const pid_t& getTid() const {
|
|
|
|
return tid;
|
|
|
|
}
|
|
|
|
const pid_t& getPid() const {
|
|
|
|
return pid;
|
|
|
|
}
|
|
|
|
const uid_t& getUid() const {
|
|
|
|
return uid;
|
|
|
|
}
|
|
|
|
const char* getName() const {
|
|
|
|
return name.data();
|
|
|
|
}
|
|
|
|
size_t getNameAllocLength() const {
|
|
|
|
return name.getAllocLength();
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void add(const LogBufferElement* element) {
|
|
|
|
if (uid != element->getUid()) {
|
|
|
|
uid = -1;
|
|
|
|
}
|
|
|
|
if (pid != element->getPid()) {
|
|
|
|
pid = -1;
|
|
|
|
}
|
|
|
|
if (tid != element->getTid()) {
|
|
|
|
tid = -1;
|
|
|
|
}
|
|
|
|
EntryBase::add(element);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string formatHeader(const std::string& name, log_id_t id) const;
|
|
|
|
std::string format(const LogStatistics& stat, log_id_t id) const;
|
|
|
|
};
|
|
|
|
|
2016-07-15 00:34:30 +02:00
|
|
|
template <typename TEntry>
|
|
|
|
class LogFindWorst {
|
2017-03-10 23:31:54 +01:00
|
|
|
std::unique_ptr<const TEntry* []> sorted;
|
2016-07-15 00:34:30 +02:00
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
public:
|
|
|
|
explicit LogFindWorst(std::unique_ptr<const TEntry* []>&& sorted)
|
|
|
|
: sorted(std::move(sorted)) {
|
|
|
|
}
|
2016-07-15 00:34:30 +02:00
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
void findWorst(int& worst, size_t& worst_sizes, size_t& second_worst_sizes,
|
|
|
|
size_t threshold) {
|
2016-07-15 00:34:30 +02:00
|
|
|
if (sorted.get() && sorted[0] && sorted[1]) {
|
|
|
|
worst_sizes = sorted[0]->getSizes();
|
|
|
|
if ((worst_sizes > threshold)
|
|
|
|
// Allow time horizon to extend roughly tenfold, assume
|
|
|
|
// average entry length is 100 characters.
|
2017-03-10 23:31:54 +01:00
|
|
|
&& (worst_sizes > (10 * sorted[0]->getDropped()))) {
|
2016-07-15 00:34:30 +02:00
|
|
|
worst = sorted[0]->getKey();
|
|
|
|
second_worst_sizes = sorted[1]->getSizes();
|
|
|
|
if (second_worst_sizes < threshold) {
|
|
|
|
second_worst_sizes = threshold;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
void findWorst(int& worst, size_t worst_sizes, size_t& second_worst_sizes) {
|
2016-07-15 00:34:30 +02:00
|
|
|
if (sorted.get() && sorted[0] && sorted[1]) {
|
|
|
|
worst = sorted[0]->getKey();
|
2017-03-10 23:31:54 +01:00
|
|
|
second_worst_sizes =
|
|
|
|
worst_sizes - sorted[0]->getSizes() + sorted[1]->getSizes();
|
2016-07-15 00:34:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-02-06 23:48:50 +01:00
|
|
|
// Log Statistics
|
|
|
|
class LogStatistics {
|
2015-08-24 20:08:00 +02:00
|
|
|
friend UidEntry;
|
|
|
|
|
2014-02-06 23:48:50 +01:00
|
|
|
size_t mSizes[LOG_ID_MAX];
|
|
|
|
size_t mElements[LOG_ID_MAX];
|
2015-09-30 16:40:09 +02:00
|
|
|
size_t mDroppedElements[LOG_ID_MAX];
|
2015-03-10 21:51:35 +01:00
|
|
|
size_t mSizesTotal[LOG_ID_MAX];
|
|
|
|
size_t mElementsTotal[LOG_ID_MAX];
|
2017-04-14 18:46:57 +02:00
|
|
|
log_time mOldest[LOG_ID_MAX];
|
|
|
|
log_time mNewest[LOG_ID_MAX];
|
|
|
|
log_time mNewestDropped[LOG_ID_MAX];
|
2016-09-12 19:29:17 +02:00
|
|
|
static size_t SizesTotal;
|
2015-03-16 16:26:05 +01:00
|
|
|
bool enable;
|
2014-02-06 23:48:50 +01:00
|
|
|
|
2015-03-10 21:51:35 +01:00
|
|
|
// uid to size list
|
2015-03-16 16:26:05 +01:00
|
|
|
typedef LogHashtable<uid_t, UidEntry> uidTable_t;
|
2015-03-10 21:51:35 +01:00
|
|
|
uidTable_t uidTable[LOG_ID_MAX];
|
2014-02-20 02:18:31 +01:00
|
|
|
|
2015-08-28 17:02:59 +02:00
|
|
|
// pid of system to size list
|
|
|
|
typedef LogHashtable<pid_t, PidEntry> pidSystemTable_t;
|
|
|
|
pidSystemTable_t pidSystemTable[LOG_ID_MAX];
|
|
|
|
|
2015-03-16 16:26:05 +01:00
|
|
|
// pid to uid list
|
|
|
|
typedef LogHashtable<pid_t, PidEntry> pidTable_t;
|
|
|
|
pidTable_t pidTable;
|
|
|
|
|
2015-04-20 22:35:15 +02:00
|
|
|
// tid to uid list
|
|
|
|
typedef LogHashtable<pid_t, TidEntry> tidTable_t;
|
|
|
|
tidTable_t tidTable;
|
|
|
|
|
2015-04-13 23:24:45 +02:00
|
|
|
// tag list
|
|
|
|
typedef LogHashtable<uint32_t, TagEntry> tagTable_t;
|
|
|
|
tagTable_t tagTable;
|
|
|
|
|
2015-12-04 19:59:45 +01:00
|
|
|
// security tag list
|
|
|
|
tagTable_t securityTagTable;
|
|
|
|
|
2017-04-19 23:39:21 +02:00
|
|
|
// global tag list
|
|
|
|
typedef LogHashtable<TagNameKey, TagNameEntry> tagNameTable_t;
|
|
|
|
tagNameTable_t tagNameTable;
|
|
|
|
|
2016-10-06 18:55:21 +02:00
|
|
|
size_t sizeOf() const {
|
|
|
|
size_t size = sizeof(*this) + pidTable.sizeOf() + tidTable.sizeOf() +
|
2016-10-06 19:09:24 +02:00
|
|
|
tagTable.sizeOf() + securityTagTable.sizeOf() +
|
2017-04-19 23:39:21 +02:00
|
|
|
tagNameTable.sizeOf() +
|
2016-10-06 19:09:24 +02:00
|
|
|
(pidTable.size() * sizeof(pidTable_t::iterator)) +
|
|
|
|
(tagTable.size() * sizeof(tagTable_t::iterator));
|
2017-03-10 23:31:54 +01:00
|
|
|
for (auto it : pidTable) {
|
2016-10-06 18:55:21 +02:00
|
|
|
const char* name = it.second.getName();
|
|
|
|
if (name) size += strlen(name) + 1;
|
|
|
|
}
|
2017-03-10 23:31:54 +01:00
|
|
|
for (auto it : tidTable) {
|
2016-10-06 18:55:21 +02:00
|
|
|
const char* name = it.second.getName();
|
|
|
|
if (name) size += strlen(name) + 1;
|
|
|
|
}
|
2017-04-19 23:39:21 +02:00
|
|
|
for (auto it : tagNameTable) size += it.second.getNameAllocLength();
|
2016-10-06 18:55:21 +02:00
|
|
|
log_id_for_each(id) {
|
|
|
|
size += uidTable[id].sizeOf();
|
2016-10-06 19:09:24 +02:00
|
|
|
size += uidTable[id].size() * sizeof(uidTable_t::iterator);
|
2016-10-06 18:55:21 +02:00
|
|
|
size += pidSystemTable[id].sizeOf();
|
2017-03-10 23:31:54 +01:00
|
|
|
size +=
|
|
|
|
pidSystemTable[id].size() * sizeof(pidSystemTable_t::iterator);
|
2016-10-06 18:55:21 +02:00
|
|
|
}
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
public:
|
2014-02-06 23:48:50 +01:00
|
|
|
LogStatistics();
|
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
void enableStatistics() {
|
|
|
|
enable = true;
|
|
|
|
}
|
2014-02-06 23:48:50 +01:00
|
|
|
|
2017-04-14 18:46:57 +02:00
|
|
|
void addTotal(LogBufferElement* entry);
|
2017-03-10 23:31:54 +01:00
|
|
|
void add(LogBufferElement* entry);
|
|
|
|
void subtract(LogBufferElement* entry);
|
2015-03-16 20:04:09 +01:00
|
|
|
// entry->setDropped(1) must follow this call
|
2017-03-10 23:31:54 +01:00
|
|
|
void drop(LogBufferElement* entry);
|
2015-09-30 16:40:09 +02:00
|
|
|
// Correct for coalescing two entries referencing dropped content
|
2017-03-10 23:31:54 +01:00
|
|
|
void erase(LogBufferElement* element) {
|
2015-09-30 16:40:09 +02:00
|
|
|
log_id_t log_id = element->getLogId();
|
|
|
|
--mElements[log_id];
|
|
|
|
--mDroppedElements[log_id];
|
|
|
|
}
|
2014-02-20 02:18:31 +01:00
|
|
|
|
2016-07-15 00:34:30 +02:00
|
|
|
LogFindWorst<UidEntry> sort(uid_t uid, pid_t pid, size_t len, log_id id) {
|
|
|
|
return LogFindWorst<UidEntry>(uidTable[id].sort(uid, pid, len));
|
|
|
|
}
|
2017-03-10 23:31:54 +01:00
|
|
|
LogFindWorst<PidEntry> sortPids(uid_t uid, pid_t pid, size_t len,
|
|
|
|
log_id id) {
|
2016-07-15 00:34:30 +02:00
|
|
|
return LogFindWorst<PidEntry>(pidSystemTable[id].sort(uid, pid, len));
|
2015-08-22 01:44:30 +02:00
|
|
|
}
|
2016-07-15 00:34:30 +02:00
|
|
|
LogFindWorst<TagEntry> sortTags(uid_t uid, pid_t pid, size_t len, log_id) {
|
|
|
|
return LogFindWorst<TagEntry>(tagTable.sort(uid, pid, len));
|
2015-08-28 17:02:59 +02:00
|
|
|
}
|
2014-02-06 23:48:50 +01:00
|
|
|
|
|
|
|
// fast track current value by id only
|
2017-03-10 23:31:54 +01:00
|
|
|
size_t sizes(log_id_t id) const {
|
|
|
|
return mSizes[id];
|
|
|
|
}
|
|
|
|
size_t elements(log_id_t id) const {
|
|
|
|
return mElements[id];
|
|
|
|
}
|
2015-09-30 16:40:09 +02:00
|
|
|
size_t realElements(log_id_t id) const {
|
|
|
|
return mElements[id] - mDroppedElements[id];
|
|
|
|
}
|
2017-03-10 23:31:54 +01:00
|
|
|
size_t sizesTotal(log_id_t id) const {
|
|
|
|
return mSizesTotal[id];
|
|
|
|
}
|
|
|
|
size_t elementsTotal(log_id_t id) const {
|
|
|
|
return mElementsTotal[id];
|
|
|
|
}
|
|
|
|
static size_t sizesTotal() {
|
|
|
|
return SizesTotal;
|
|
|
|
}
|
2014-02-06 23:48:50 +01:00
|
|
|
|
2015-12-17 18:58:43 +01:00
|
|
|
std::string format(uid_t uid, pid_t pid, unsigned int logMask) const;
|
2014-04-07 16:05:40 +02:00
|
|
|
|
2015-06-25 01:22:54 +02:00
|
|
|
// helper (must be locked directly or implicitly by mLogElementsLock)
|
2017-03-10 23:31:54 +01:00
|
|
|
const char* pidToName(pid_t pid) const;
|
2014-04-07 16:15:33 +02:00
|
|
|
uid_t pidToUid(pid_t pid);
|
2017-05-04 22:54:46 +02:00
|
|
|
pid_t tidToPid(pid_t tid);
|
2017-03-10 23:31:54 +01:00
|
|
|
const char* uidToName(uid_t uid) const;
|
2014-02-06 23:48:50 +01:00
|
|
|
};
|
|
|
|
|
2017-03-10 23:31:54 +01:00
|
|
|
#endif // _LOGD_LOG_STATISTICS_H__
|