Loading bootstat/bootstat.cpp +3 −0 Original line number Original line Diff line number Diff line Loading @@ -714,6 +714,9 @@ void RecordBootComplete() { // property. // property. void RecordBootReason() { void RecordBootReason() { const std::string reason(GetProperty(bootloader_reboot_reason_property)); const std::string reason(GetProperty(bootloader_reboot_reason_property)); android::metricslogger::LogMultiAction(android::metricslogger::ACTION_BOOT, android::metricslogger::FIELD_PLATFORM_REASON, reason); // Log the raw bootloader_boot_reason property value. // Log the raw bootloader_boot_reason property value. int32_t boot_reason = BootReasonStrToEnum(reason); int32_t boot_reason = BootReasonStrToEnum(reason); Loading libmetricslogger/Android.bp +6 −3 Original line number Original line Diff line number Diff line Loading @@ -19,10 +19,13 @@ cc_defaults { "-Wextra", "-Wextra", "-Werror", "-Werror", // 524291 corresponds to sysui_histogram, from // The following defines map logtag IDs as represented by: // frameworks/base/core/java/com/android/internal/logging/EventLogTags.logtags // frameworks/base/core/java/com/android/internal/logging/EventLogTags.logtags "-DHISTOGRAM_LOG_TAG=524292", // // E.g., 524290 corresponds to sysui_count. "-DCOUNT_LOG_TAG=524290", "-DCOUNT_LOG_TAG=524290", "-DHISTOGRAM_LOG_TAG=524292", "-DMULTI_ACTION_LOG_TAG=524292", ], ], } } Loading libmetricslogger/include/metricslogger/metrics_logger.h +12 −0 Original line number Original line Diff line number Diff line Loading @@ -28,14 +28,26 @@ void LogHistogram(const std::string& event, int32_t data); // log buffer. // log buffer. void LogCounter(const std::string& name, int32_t val); void LogCounter(const std::string& name, int32_t val); // Logs a Tron multi_action with category|category| containing the string // |value| in the field |field|. void LogMultiAction(int32_t category, int32_t field, const std::string& value); // TODO: replace these with the metric_logger.proto definitions // TODO: replace these with the metric_logger.proto definitions enum { enum { LOGBUILDER_CATEGORY = 757, LOGBUILDER_CATEGORY = 757, LOGBUILDER_TYPE = 758, LOGBUILDER_NAME = 799, LOGBUILDER_NAME = 799, LOGBUILDER_BUCKET = 801, LOGBUILDER_BUCKET = 801, LOGBUILDER_VALUE = 802, LOGBUILDER_VALUE = 802, LOGBUILDER_COUNTER = 803, LOGBUILDER_COUNTER = 803, LOGBUILDER_HISTOGRAM = 804, LOGBUILDER_HISTOGRAM = 804, ACTION_BOOT = 1092, FIELD_PLATFORM_REASON = 1093, }; enum { TYPE_ACTION = 4, }; }; } // namespace metricslogger } // namespace metricslogger Loading libmetricslogger/metrics_logger.cpp +7 −0 Original line number Original line Diff line number Diff line Loading @@ -37,5 +37,12 @@ void LogCounter(const std::string& name, int32_t val) { << val << LOG_ID_EVENTS; << val << LOG_ID_EVENTS; } } // Mirror com.android.internal.logging.MetricsLogger#action(). void LogMultiAction(int32_t category, int32_t field, const std::string& value) { android_log_event_list log(MULTI_ACTION_LOG_TAG); log << LOGBUILDER_CATEGORY << category << LOGBUILDER_TYPE << TYPE_ACTION << field << value << LOG_ID_EVENTS; } } // namespace metricslogger } // namespace metricslogger } // namespace android } // namespace android Loading
bootstat/bootstat.cpp +3 −0 Original line number Original line Diff line number Diff line Loading @@ -714,6 +714,9 @@ void RecordBootComplete() { // property. // property. void RecordBootReason() { void RecordBootReason() { const std::string reason(GetProperty(bootloader_reboot_reason_property)); const std::string reason(GetProperty(bootloader_reboot_reason_property)); android::metricslogger::LogMultiAction(android::metricslogger::ACTION_BOOT, android::metricslogger::FIELD_PLATFORM_REASON, reason); // Log the raw bootloader_boot_reason property value. // Log the raw bootloader_boot_reason property value. int32_t boot_reason = BootReasonStrToEnum(reason); int32_t boot_reason = BootReasonStrToEnum(reason); Loading
libmetricslogger/Android.bp +6 −3 Original line number Original line Diff line number Diff line Loading @@ -19,10 +19,13 @@ cc_defaults { "-Wextra", "-Wextra", "-Werror", "-Werror", // 524291 corresponds to sysui_histogram, from // The following defines map logtag IDs as represented by: // frameworks/base/core/java/com/android/internal/logging/EventLogTags.logtags // frameworks/base/core/java/com/android/internal/logging/EventLogTags.logtags "-DHISTOGRAM_LOG_TAG=524292", // // E.g., 524290 corresponds to sysui_count. "-DCOUNT_LOG_TAG=524290", "-DCOUNT_LOG_TAG=524290", "-DHISTOGRAM_LOG_TAG=524292", "-DMULTI_ACTION_LOG_TAG=524292", ], ], } } Loading
libmetricslogger/include/metricslogger/metrics_logger.h +12 −0 Original line number Original line Diff line number Diff line Loading @@ -28,14 +28,26 @@ void LogHistogram(const std::string& event, int32_t data); // log buffer. // log buffer. void LogCounter(const std::string& name, int32_t val); void LogCounter(const std::string& name, int32_t val); // Logs a Tron multi_action with category|category| containing the string // |value| in the field |field|. void LogMultiAction(int32_t category, int32_t field, const std::string& value); // TODO: replace these with the metric_logger.proto definitions // TODO: replace these with the metric_logger.proto definitions enum { enum { LOGBUILDER_CATEGORY = 757, LOGBUILDER_CATEGORY = 757, LOGBUILDER_TYPE = 758, LOGBUILDER_NAME = 799, LOGBUILDER_NAME = 799, LOGBUILDER_BUCKET = 801, LOGBUILDER_BUCKET = 801, LOGBUILDER_VALUE = 802, LOGBUILDER_VALUE = 802, LOGBUILDER_COUNTER = 803, LOGBUILDER_COUNTER = 803, LOGBUILDER_HISTOGRAM = 804, LOGBUILDER_HISTOGRAM = 804, ACTION_BOOT = 1092, FIELD_PLATFORM_REASON = 1093, }; enum { TYPE_ACTION = 4, }; }; } // namespace metricslogger } // namespace metricslogger Loading
libmetricslogger/metrics_logger.cpp +7 −0 Original line number Original line Diff line number Diff line Loading @@ -37,5 +37,12 @@ void LogCounter(const std::string& name, int32_t val) { << val << LOG_ID_EVENTS; << val << LOG_ID_EVENTS; } } // Mirror com.android.internal.logging.MetricsLogger#action(). void LogMultiAction(int32_t category, int32_t field, const std::string& value) { android_log_event_list log(MULTI_ACTION_LOG_TAG); log << LOGBUILDER_CATEGORY << category << LOGBUILDER_TYPE << TYPE_ACTION << field << value << LOG_ID_EVENTS; } } // namespace metricslogger } // namespace metricslogger } // namespace android } // namespace android