summaryrefslogtreecommitdiffstats
path: root/liblog
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2014-02-06 14:48:50 -0800
committerMark Salyzyn <salyzyn@google.com>2014-03-13 14:47:58 -0700
commit34facab86b0fe7ec613de92b46b637f864fb0682 (patch)
treeb2587070fbb968d1e20954dc53d53faad9cca74a /liblog
parent897d345b1f2672480346e5dc8971a4626f3f1b8b (diff)
downloadcore-34facab86b0fe7ec613de92b46b637f864fb0682.tar.gz
core-34facab86b0fe7ec613de92b46b637f864fb0682.tar.bz2
core-34facab86b0fe7ec613de92b46b637f864fb0682.zip
logd: liblog: logcat: Add Statistics
- logd add statistical collection and formatting - liblog add android_logger_get_statistics call - logcat add -S flag - logcat add -b all (cherry picked from commit 51a29c8dc445e4fb89860561933e54a231e6ffb4) Change-Id: I521753b1969ecd4590c956aeeb1557d101059d67
Diffstat (limited to 'liblog')
-rw-r--r--liblog/log_read.c26
-rw-r--r--liblog/log_read_kern.c14
2 files changed, 40 insertions, 0 deletions
diff --git a/liblog/log_read.c b/liblog/log_read.c
index 889442db9..6f6fe5f2c 100644
--- a/liblog/log_read.c
+++ b/liblog/log_read.c
@@ -357,6 +357,32 @@ int android_logger_get_log_version(struct logger *logger UNUSED)
return 3;
}
+/*
+ * returns statistics
+ */
+ssize_t android_logger_get_statistics(struct logger_list *logger_list,
+ char *buf, size_t len)
+{
+ struct listnode *node;
+ struct logger *logger;
+ char *cp = buf;
+ size_t remaining = len;
+ size_t n;
+
+ n = snprintf(cp, remaining, "getStatistics");
+ n = min(n, remaining);
+ remaining -= n;
+ cp += n;
+
+ logger_for_each(logger, logger_list) {
+ n = snprintf(cp, remaining, " %d", logger->id);
+ n = min(n, remaining);
+ remaining -= n;
+ cp += n;
+ }
+ return send_log_msg(NULL, NULL, buf, len);
+}
+
struct logger_list *android_logger_list_alloc(int mode,
unsigned int tail,
pid_t pid)
diff --git a/liblog/log_read_kern.c b/liblog/log_read_kern.c
index b4547295f..59a7a0b19 100644
--- a/liblog/log_read_kern.c
+++ b/liblog/log_read_kern.c
@@ -51,6 +51,8 @@ typedef char bool;
logger != node_to_item(&(logger_list)->node, struct logger, node); \
logger = node_to_item((logger)->node.next, struct logger, node))
+#define UNUSED __attribute__((unused))
+
/* In the future, we would like to make this list extensible */
static const char *LOG_NAME[LOG_ID_MAX] = {
[LOG_ID_MAIN] = "main",
@@ -248,6 +250,18 @@ int android_logger_get_log_version(struct logger *logger)
return (ret < 0) ? 1 : ret;
}
+/*
+ * returns statistics
+ */
+
+ssize_t android_logger_get_statistics(struct logger_list *logger_list UNUSED,
+ char *buf, size_t len)
+{
+ static const char unsupported[] = "18\nNot Supported\n\f";
+ strncpy(buf, unsupported, len);
+ return -ENOTSUP;
+}
+
struct logger_list *android_logger_list_alloc(int mode,
unsigned int tail,
pid_t pid)