Put send metrics code into common function
SendEnumToUMA() and SendCrashToUMA() are being called from three functions in crash_reporter.cc. This patch puts the three calls plus a repeated TODO into one helper function that's called by the three existing functions. BUG=chromium-os:11163,chromium-os:30268 TEST=emerge crash-reporter Change-Id: I703d93e3a072faa0264a220a69df2203af100c57 Signed-off-by: Simon Que <sque@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/26291 Reviewed-by: Ben Chan <benchan@chromium.org>
This commit is contained in:
parent
b8ff76914d
commit
6f03549d97
1 changed files with 9 additions and 17 deletions
|
|
@ -59,31 +59,23 @@ static bool TouchFile(const FilePath &file_path) {
|
|||
return file_util::WriteFile(file_path, "", 0) == 0;
|
||||
}
|
||||
|
||||
static void CountKernelCrash() {
|
||||
static void SendCrashMetrics(CrashKinds type, const char* name) {
|
||||
// TODO(kmixter): We can remove this histogram as part of
|
||||
// crosbug.com/11163.
|
||||
s_metrics_lib.SendEnumToUMA(std::string(kCrashCounterHistogram),
|
||||
kCrashKindKernel,
|
||||
kCrashKindMax);
|
||||
s_metrics_lib.SendCrashToUMA("kernel");
|
||||
s_metrics_lib.SendEnumToUMA(kCrashCounterHistogram, type, kCrashKindMax);
|
||||
s_metrics_lib.SendCrashToUMA(name);
|
||||
}
|
||||
|
||||
static void CountKernelCrash() {
|
||||
SendCrashMetrics(kCrashKindKernel, "kernel");
|
||||
}
|
||||
|
||||
static void CountUncleanShutdown() {
|
||||
// TODO(kmixter): We can remove this histogram as part of
|
||||
// crosbug.com/11163.
|
||||
s_metrics_lib.SendEnumToUMA(std::string(kCrashCounterHistogram),
|
||||
kCrashKindUncleanShutdown,
|
||||
kCrashKindMax);
|
||||
s_metrics_lib.SendCrashToUMA("uncleanshutdown");
|
||||
SendCrashMetrics(kCrashKindUncleanShutdown, "uncleanshutdown");
|
||||
}
|
||||
|
||||
static void CountUserCrash() {
|
||||
// TODO(kmixter): We can remove this histogram as part of
|
||||
// crosbug.com/11163.
|
||||
s_metrics_lib.SendEnumToUMA(std::string(kCrashCounterHistogram),
|
||||
kCrashKindUser,
|
||||
kCrashKindMax);
|
||||
s_metrics_lib.SendCrashToUMA("user");
|
||||
SendCrashMetrics(kCrashKindUser, "user");
|
||||
std::string command = StringPrintf(
|
||||
"/usr/bin/dbus-send --type=signal --system / \"%s\" &",
|
||||
kUserCrashSignal);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue