Loading crash_reporter/Android.mk +8 −7 Original line number Diff line number Diff line Loading @@ -43,11 +43,12 @@ LOCAL_CPP_EXTENSION := $(crash_reporter_cpp_extension) LOCAL_C_INCLUDES := $(crash_reporter_includes) LOCAL_RTTI_FLAG := -frtti LOCAL_SHARED_LIBRARIES := libchrome \ libbinder \ libbrillo \ libcutils \ libdbus \ libmetrics \ libpcrecpp LOCAL_STATIC_LIBRARIES := libmetricscollectorservice LOCAL_SRC_FILES := $(crash_reporter_src) include $(BUILD_STATIC_LIBRARY) Loading @@ -60,18 +61,19 @@ LOCAL_C_INCLUDES := $(crash_reporter_includes) LOCAL_REQUIRED_MODULES := core2md \ crash_reporter_logs.conf \ crash_sender \ crash_server \ dbus-send crash_server LOCAL_INIT_RC := crash_reporter.rc LOCAL_RTTI_FLAG := -frtti LOCAL_SHARED_LIBRARIES := libchrome \ libbinder \ libbrillo \ libcutils \ libdbus \ libmetrics \ libpcrecpp libpcrecpp \ libutils LOCAL_SRC_FILES := crash_reporter.cc LOCAL_STATIC_LIBRARIES := libcrash LOCAL_STATIC_LIBRARIES := libcrash \ libmetricscollectorservice include $(BUILD_EXECUTABLE) # Crash sender script. Loading Loading @@ -140,7 +142,6 @@ LOCAL_CPP_EXTENSION := $(crash_reporter_cpp_extension) LOCAL_SHARED_LIBRARIES := libchrome \ libbrillo \ libcutils \ libdbus \ libpcrecpp LOCAL_SRC_FILES := $(crash_reporter_test_src) LOCAL_STATIC_LIBRARIES := libcrash libgmock Loading crash_reporter/crash_reporter.cc +13 −29 Original line number Diff line number Diff line Loading @@ -25,10 +25,13 @@ #include <base/strings/string_split.h> #include <base/strings/string_util.h> #include <base/strings/stringprintf.h> #include <binder/IServiceManager.h> #include <brillo/flag_helper.h> #include <brillo/process.h> #include <brillo/syslog_logging.h> #include <metrics/metrics_collector_service_client.h> #include <metrics/metrics_library.h> #include <utils/String16.h> #include "kernel_collector.h" #include "kernel_warning_collector.h" Loading @@ -37,8 +40,6 @@ #include "user_collector.h" static const char kCrashCounterHistogram[] = "Logging.CrashCounter"; static const char kUserCrashSignal[] = "org.chromium.CrashReporter.UserCrash"; static const char kKernelCrashDetected[] = "/var/run/kernel-crash-detected"; static const char kUncleanShutdownDetected[] = "/var/run/unclean-shutdown-detected"; Loading @@ -56,6 +57,7 @@ enum CrashKinds { static MetricsLibrary s_metrics_lib; using android::brillo::metrics::IMetricsCollectorService; using base::FilePath; using base::StringPrintf; Loading Loading @@ -88,32 +90,14 @@ static void CountUncleanShutdown() { static void CountUserCrash() { SendCrashMetrics(kCrashKindUser, "user"); // Announce through D-Bus whenever a user crash happens. This is // used by the metrics daemon to log active use time between // crashes. // // We run in the background in case dbus-daemon itself is crashed // and not responding. This allows us to not block and potentially // deadlock on a dbus-daemon crash. If dbus-daemon crashes without // restarting, each crash will fork off a lot of dbus-send // processes. Such a system is in a unusable state and will need // to be restarted anyway. // // Note: This will mean that the dbus-send process will become a zombie and // reparent to init for reaping, but that's OK -- see above. brillo::ProcessImpl dbus_send; dbus_send.AddArg("/system/bin/dbus-send"); dbus_send.AddArg("--type=signal"); dbus_send.AddArg("--system"); dbus_send.AddArg("/"); dbus_send.AddArg(kUserCrashSignal); bool status = dbus_send.Start(); if (status) { dbus_send.Release(); } else { PLOG(WARNING) << "Sending UserCrash DBus signal failed"; } // Tell the metrics collector about the user crash, in order to log active // use time between crashes. MetricsCollectorServiceClient metrics_collector_service; if (metrics_collector_service.Init()) metrics_collector_service.notifyUserCrash(); else LOG(ERROR) << "Failed to send user crash notification to metrics_collector"; } Loading Loading
crash_reporter/Android.mk +8 −7 Original line number Diff line number Diff line Loading @@ -43,11 +43,12 @@ LOCAL_CPP_EXTENSION := $(crash_reporter_cpp_extension) LOCAL_C_INCLUDES := $(crash_reporter_includes) LOCAL_RTTI_FLAG := -frtti LOCAL_SHARED_LIBRARIES := libchrome \ libbinder \ libbrillo \ libcutils \ libdbus \ libmetrics \ libpcrecpp LOCAL_STATIC_LIBRARIES := libmetricscollectorservice LOCAL_SRC_FILES := $(crash_reporter_src) include $(BUILD_STATIC_LIBRARY) Loading @@ -60,18 +61,19 @@ LOCAL_C_INCLUDES := $(crash_reporter_includes) LOCAL_REQUIRED_MODULES := core2md \ crash_reporter_logs.conf \ crash_sender \ crash_server \ dbus-send crash_server LOCAL_INIT_RC := crash_reporter.rc LOCAL_RTTI_FLAG := -frtti LOCAL_SHARED_LIBRARIES := libchrome \ libbinder \ libbrillo \ libcutils \ libdbus \ libmetrics \ libpcrecpp libpcrecpp \ libutils LOCAL_SRC_FILES := crash_reporter.cc LOCAL_STATIC_LIBRARIES := libcrash LOCAL_STATIC_LIBRARIES := libcrash \ libmetricscollectorservice include $(BUILD_EXECUTABLE) # Crash sender script. Loading Loading @@ -140,7 +142,6 @@ LOCAL_CPP_EXTENSION := $(crash_reporter_cpp_extension) LOCAL_SHARED_LIBRARIES := libchrome \ libbrillo \ libcutils \ libdbus \ libpcrecpp LOCAL_SRC_FILES := $(crash_reporter_test_src) LOCAL_STATIC_LIBRARIES := libcrash libgmock Loading
crash_reporter/crash_reporter.cc +13 −29 Original line number Diff line number Diff line Loading @@ -25,10 +25,13 @@ #include <base/strings/string_split.h> #include <base/strings/string_util.h> #include <base/strings/stringprintf.h> #include <binder/IServiceManager.h> #include <brillo/flag_helper.h> #include <brillo/process.h> #include <brillo/syslog_logging.h> #include <metrics/metrics_collector_service_client.h> #include <metrics/metrics_library.h> #include <utils/String16.h> #include "kernel_collector.h" #include "kernel_warning_collector.h" Loading @@ -37,8 +40,6 @@ #include "user_collector.h" static const char kCrashCounterHistogram[] = "Logging.CrashCounter"; static const char kUserCrashSignal[] = "org.chromium.CrashReporter.UserCrash"; static const char kKernelCrashDetected[] = "/var/run/kernel-crash-detected"; static const char kUncleanShutdownDetected[] = "/var/run/unclean-shutdown-detected"; Loading @@ -56,6 +57,7 @@ enum CrashKinds { static MetricsLibrary s_metrics_lib; using android::brillo::metrics::IMetricsCollectorService; using base::FilePath; using base::StringPrintf; Loading Loading @@ -88,32 +90,14 @@ static void CountUncleanShutdown() { static void CountUserCrash() { SendCrashMetrics(kCrashKindUser, "user"); // Announce through D-Bus whenever a user crash happens. This is // used by the metrics daemon to log active use time between // crashes. // // We run in the background in case dbus-daemon itself is crashed // and not responding. This allows us to not block and potentially // deadlock on a dbus-daemon crash. If dbus-daemon crashes without // restarting, each crash will fork off a lot of dbus-send // processes. Such a system is in a unusable state and will need // to be restarted anyway. // // Note: This will mean that the dbus-send process will become a zombie and // reparent to init for reaping, but that's OK -- see above. brillo::ProcessImpl dbus_send; dbus_send.AddArg("/system/bin/dbus-send"); dbus_send.AddArg("--type=signal"); dbus_send.AddArg("--system"); dbus_send.AddArg("/"); dbus_send.AddArg(kUserCrashSignal); bool status = dbus_send.Start(); if (status) { dbus_send.Release(); } else { PLOG(WARNING) << "Sending UserCrash DBus signal failed"; } // Tell the metrics collector about the user crash, in order to log active // use time between crashes. MetricsCollectorServiceClient metrics_collector_service; if (metrics_collector_service.Init()) metrics_collector_service.notifyUserCrash(); else LOG(ERROR) << "Failed to send user crash notification to metrics_collector"; } Loading