Loading lmkd/lmkd.c +2 −2 Original line number Diff line number Diff line Loading @@ -1229,7 +1229,7 @@ int main(int argc __unused, char **argv __unused) { (unsigned long)property_get_int32("ro.lmk.kill_timeout_ms", 0); #ifdef LMKD_LOG_STATS statlog_init(); statslog_init(&log_ctx, &enable_stats_log); #endif // MCL_ONFAULT pins pages as they fault instead of loading Loading @@ -1249,7 +1249,7 @@ int main(int argc __unused, char **argv __unused) { mainloop(); #ifdef LMKD_LOG_STATS statslog_destroy(); statslog_destroy(&log_ctx); #endif ALOGI("exiting"); Loading lmkd/statslog.h +17 −13 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #ifndef _STATSLOG_H_ #define _STATSLOG_H_ #include <assert.h> #include <stdbool.h> #include <sys/cdefs.h> Loading @@ -34,17 +35,26 @@ __BEGIN_DECLS #define LMK_STATE_CHANGE_START 1 #define LMK_STATE_CHANGE_STOP 2 static inline void statslog_init() { enable_stats_log = property_get_bool("ro.lmk.log_stats", false); /* * The single event tag id for all stats logs. * Keep this in sync with system/core/logcat/event.logtags */ const static int kStatsEventTag = 1937006964; static inline void statslog_init(android_log_context* log_ctx, bool* enable_stats_log) { assert(log_ctx != NULL); assert(enable_stats_log != NULL); *enable_stats_log = property_get_bool("ro.lmk.log_stats", false); if (enable_stats_log) { log_ctx = create_android_logger(kStatsEventTag); if (*enable_stats_log) { *log_ctx = create_android_logger(kStatsEventTag); } } static inline void statslog_destroy() { if (log_ctx) { android_log_destroy(&log_ctx); static inline void statslog_destroy(android_log_context* log_ctx) { assert(log_ctx != NULL); if (*log_ctx) { android_log_destroy(log_ctx); } } Loading @@ -58,12 +68,6 @@ struct memory_stat { #define MEMCG_PROCESS_MEMORY_STAT_PATH "/dev/memcg/apps/uid_%u/pid_%u/memory.stat" /* * The single event tag id for all stats logs. * Keep this in sync with system/core/logcat/event.logtags */ const static int kStatsEventTag = 1937006964; /** * Logs the change in LMKD state which is used as start/stop boundaries for logging * LMK_KILL_OCCURRED event. Loading Loading
lmkd/lmkd.c +2 −2 Original line number Diff line number Diff line Loading @@ -1229,7 +1229,7 @@ int main(int argc __unused, char **argv __unused) { (unsigned long)property_get_int32("ro.lmk.kill_timeout_ms", 0); #ifdef LMKD_LOG_STATS statlog_init(); statslog_init(&log_ctx, &enable_stats_log); #endif // MCL_ONFAULT pins pages as they fault instead of loading Loading @@ -1249,7 +1249,7 @@ int main(int argc __unused, char **argv __unused) { mainloop(); #ifdef LMKD_LOG_STATS statslog_destroy(); statslog_destroy(&log_ctx); #endif ALOGI("exiting"); Loading
lmkd/statslog.h +17 −13 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #ifndef _STATSLOG_H_ #define _STATSLOG_H_ #include <assert.h> #include <stdbool.h> #include <sys/cdefs.h> Loading @@ -34,17 +35,26 @@ __BEGIN_DECLS #define LMK_STATE_CHANGE_START 1 #define LMK_STATE_CHANGE_STOP 2 static inline void statslog_init() { enable_stats_log = property_get_bool("ro.lmk.log_stats", false); /* * The single event tag id for all stats logs. * Keep this in sync with system/core/logcat/event.logtags */ const static int kStatsEventTag = 1937006964; static inline void statslog_init(android_log_context* log_ctx, bool* enable_stats_log) { assert(log_ctx != NULL); assert(enable_stats_log != NULL); *enable_stats_log = property_get_bool("ro.lmk.log_stats", false); if (enable_stats_log) { log_ctx = create_android_logger(kStatsEventTag); if (*enable_stats_log) { *log_ctx = create_android_logger(kStatsEventTag); } } static inline void statslog_destroy() { if (log_ctx) { android_log_destroy(&log_ctx); static inline void statslog_destroy(android_log_context* log_ctx) { assert(log_ctx != NULL); if (*log_ctx) { android_log_destroy(log_ctx); } } Loading @@ -58,12 +68,6 @@ struct memory_stat { #define MEMCG_PROCESS_MEMORY_STAT_PATH "/dev/memcg/apps/uid_%u/pid_%u/memory.stat" /* * The single event tag id for all stats logs. * Keep this in sync with system/core/logcat/event.logtags */ const static int kStatsEventTag = 1937006964; /** * Logs the change in LMKD state which is used as start/stop boundaries for logging * LMK_KILL_OCCURRED event. Loading