diff options
| author | Rajeev Kumar <rajekumar@google.com> | 2018-03-09 15:20:56 -0800 |
|---|---|---|
| committer | Rajeev Kumar <rajekumar@google.com> | 2018-03-26 18:15:25 +0000 |
| commit | 02499a92f0ae2aa81bdb79d668e0332a04f5b2b3 (patch) | |
| tree | 29a59f65d15e22d04558b283dc0ed7f4bc636858 /statslog.h | |
| parent | 294b1dd97f8a847b429d179d1395d250ef960025 (diff) | |
| download | platform_system_memory_lmkd-02499a92f0ae2aa81bdb79d668e0332a04f5b2b3.tar.gz platform_system_memory_lmkd-02499a92f0ae2aa81bdb79d668e0332a04f5b2b3.tar.bz2 platform_system_memory_lmkd-02499a92f0ae2aa81bdb79d668e0332a04f5b2b3.zip | |
Fix compilation issue when LMKD_LOG_STATS is defined.
Note: The breakage was caused by http://ag/3621623
Test: mmma system/core/lmkd/
Change-Id: I17033aeedb3183d4777dacb89ec84430ff061b3c
Bug: 74443701
(cherry picked from commit fb25ddd9c9004de9a9ebb1175a6ceaf7aeec0673)
Diffstat (limited to 'statslog.h')
| -rw-r--r-- | statslog.h | 30 |
1 files changed, 17 insertions, 13 deletions
@@ -17,6 +17,7 @@ #ifndef _STATSLOG_H_ #define _STATSLOG_H_ +#include <assert.h> #include <stdbool.h> #include <sys/cdefs.h> @@ -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); } } @@ -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. |
