Loading lmkd/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ cc_binary { ], static_libs: [ "libstatslogc", "libstatssocket", ], local_include_dirs: ["include"], cflags: ["-Werror", "-DLMKD_TRACE_KILLS"], Loading @@ -31,6 +32,7 @@ cc_library_static { shared_libs: [ "liblog", ], static_libs: ["libstatssocket",], } cc_library_static { Loading lmkd/lmkd.c +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ #include <log/log.h> #ifdef LMKD_LOG_STATS #include <statslog.h> #include "statslog.h" #endif /* Loading lmkd/statslog.c +23 −6 Original line number Diff line number Diff line Loading @@ -16,8 +16,16 @@ #include <assert.h> #include <errno.h> #include <log/log_event_list.h> #include <log/log_id.h> #include <stats_event_list.h> #include <time.h> static int64_t getElapsedRealTimeNs() { struct timespec t; t.tv_sec = t.tv_nsec = 0; clock_gettime(CLOCK_BOOTTIME, &t); return (int64_t)t.tv_sec * 1000000000LL + t.tv_nsec; } /** * Logs the change in LMKD state which is used as start/stop boundaries for logging Loading @@ -32,6 +40,12 @@ stats_write_lmk_state_changed(android_log_context ctx, int32_t code, int32_t sta return ret; } reset_log_context(ctx); if ((ret = android_log_write_int64(ctx, getElapsedRealTimeNs())) < 0) { return ret; } if ((ret = android_log_write_int32(ctx, code)) < 0) { return ret; } Loading @@ -39,7 +53,8 @@ stats_write_lmk_state_changed(android_log_context ctx, int32_t code, int32_t sta if ((ret = android_log_write_int32(ctx, state)) < 0) { return ret; } return ret; return write_to_logger(ctx, LOG_ID_STATS); } /** Loading @@ -56,6 +71,11 @@ stats_write_lmk_kill_occurred(android_log_context ctx, int32_t code, int32_t uid if (!ctx) { return ret; } reset_log_context(ctx); if ((ret = android_log_write_int64(ctx, getElapsedRealTimeNs())) < 0) { return ret; } if ((ret = android_log_write_int32(ctx, code)) < 0) { return ret; Loading Loading @@ -93,8 +113,5 @@ stats_write_lmk_kill_occurred(android_log_context ctx, int32_t code, int32_t uid return ret; } if ((ret = android_log_write_list(ctx, LOG_ID_STATS)) < 0) { return ret; } return ret; return write_to_logger(ctx, LOG_ID_STATS); } lmkd/statslog.h +1 −1 Original line number Diff line number Diff line Loading @@ -18,11 +18,11 @@ #define _STATSLOG_H_ #include <assert.h> #include <stats_event_list.h> #include <stdbool.h> #include <sys/cdefs.h> #include <cutils/properties.h> #include <log/log_event_list.h> __BEGIN_DECLS Loading Loading
lmkd/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ cc_binary { ], static_libs: [ "libstatslogc", "libstatssocket", ], local_include_dirs: ["include"], cflags: ["-Werror", "-DLMKD_TRACE_KILLS"], Loading @@ -31,6 +32,7 @@ cc_library_static { shared_libs: [ "liblog", ], static_libs: ["libstatssocket",], } cc_library_static { Loading
lmkd/lmkd.c +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ #include <log/log.h> #ifdef LMKD_LOG_STATS #include <statslog.h> #include "statslog.h" #endif /* Loading
lmkd/statslog.c +23 −6 Original line number Diff line number Diff line Loading @@ -16,8 +16,16 @@ #include <assert.h> #include <errno.h> #include <log/log_event_list.h> #include <log/log_id.h> #include <stats_event_list.h> #include <time.h> static int64_t getElapsedRealTimeNs() { struct timespec t; t.tv_sec = t.tv_nsec = 0; clock_gettime(CLOCK_BOOTTIME, &t); return (int64_t)t.tv_sec * 1000000000LL + t.tv_nsec; } /** * Logs the change in LMKD state which is used as start/stop boundaries for logging Loading @@ -32,6 +40,12 @@ stats_write_lmk_state_changed(android_log_context ctx, int32_t code, int32_t sta return ret; } reset_log_context(ctx); if ((ret = android_log_write_int64(ctx, getElapsedRealTimeNs())) < 0) { return ret; } if ((ret = android_log_write_int32(ctx, code)) < 0) { return ret; } Loading @@ -39,7 +53,8 @@ stats_write_lmk_state_changed(android_log_context ctx, int32_t code, int32_t sta if ((ret = android_log_write_int32(ctx, state)) < 0) { return ret; } return ret; return write_to_logger(ctx, LOG_ID_STATS); } /** Loading @@ -56,6 +71,11 @@ stats_write_lmk_kill_occurred(android_log_context ctx, int32_t code, int32_t uid if (!ctx) { return ret; } reset_log_context(ctx); if ((ret = android_log_write_int64(ctx, getElapsedRealTimeNs())) < 0) { return ret; } if ((ret = android_log_write_int32(ctx, code)) < 0) { return ret; Loading Loading @@ -93,8 +113,5 @@ stats_write_lmk_kill_occurred(android_log_context ctx, int32_t code, int32_t uid return ret; } if ((ret = android_log_write_list(ctx, LOG_ID_STATS)) < 0) { return ret; } return ret; return write_to_logger(ctx, LOG_ID_STATS); }
lmkd/statslog.h +1 −1 Original line number Diff line number Diff line Loading @@ -18,11 +18,11 @@ #define _STATSLOG_H_ #include <assert.h> #include <stats_event_list.h> #include <stdbool.h> #include <sys/cdefs.h> #include <cutils/properties.h> #include <log/log_event_list.h> __BEGIN_DECLS Loading