OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 | 46 |
47 static bool IsFeedbackAllowed() { | 47 static bool IsFeedbackAllowed() { |
48 return s_metrics_lib.AreMetricsEnabled(); | 48 return s_metrics_lib.AreMetricsEnabled(); |
49 } | 49 } |
50 | 50 |
51 static bool TouchFile(const FilePath &file_path) { | 51 static bool TouchFile(const FilePath &file_path) { |
52 return file_util::WriteFile(file_path, "", 0) == 0; | 52 return file_util::WriteFile(file_path, "", 0) == 0; |
53 } | 53 } |
54 | 54 |
55 static void CountKernelCrash() { | 55 static void CountKernelCrash() { |
56 // TODO(kmixter): We can remove this histogram once we have | |
petkov
2011/01/10 18:51:41
File a cleanup issue?
| |
57 // UMA stability data. | |
56 s_metrics_lib.SendEnumToUMA(std::string(kCrashCounterHistogram), | 58 s_metrics_lib.SendEnumToUMA(std::string(kCrashCounterHistogram), |
57 kCrashKindKernel, | 59 kCrashKindKernel, |
58 kCrashKindMax); | 60 kCrashKindMax); |
61 s_metrics_lib.SendCrashToUMA("kernel"); | |
59 } | 62 } |
60 | 63 |
61 static void CountUncleanShutdown() { | 64 static void CountUncleanShutdown() { |
65 // TODO(kmixter): We can remove this histogram once we have | |
66 // UMA stability data. | |
62 s_metrics_lib.SendEnumToUMA(std::string(kCrashCounterHistogram), | 67 s_metrics_lib.SendEnumToUMA(std::string(kCrashCounterHistogram), |
63 kCrashKindUncleanShutdown, | 68 kCrashKindUncleanShutdown, |
64 kCrashKindMax); | 69 kCrashKindMax); |
70 s_metrics_lib.SendCrashToUMA("uncleanshutdown"); | |
65 } | 71 } |
66 | 72 |
67 static void CountUserCrash() { | 73 static void CountUserCrash() { |
74 // TODO(kmixter): We can remove this histogram once we have | |
75 // UMA stability data, as well as the signalling to | |
76 // metrics daemon. | |
68 s_metrics_lib.SendEnumToUMA(std::string(kCrashCounterHistogram), | 77 s_metrics_lib.SendEnumToUMA(std::string(kCrashCounterHistogram), |
69 kCrashKindUser, | 78 kCrashKindUser, |
70 kCrashKindMax); | 79 kCrashKindMax); |
80 s_metrics_lib.SendCrashToUMA("user"); | |
71 std::string command = StringPrintf( | 81 std::string command = StringPrintf( |
72 "/usr/bin/dbus-send --type=signal --system / \"%s\" &", | 82 "/usr/bin/dbus-send --type=signal --system / \"%s\" &", |
73 kUserCrashSignal); | 83 kUserCrashSignal); |
74 // Announce through D-Bus whenever a user crash happens. This is | 84 // Announce through D-Bus whenever a user crash happens. This is |
75 // used by the metrics daemon to log active use time between | 85 // used by the metrics daemon to log active use time between |
76 // crashes. | 86 // crashes. |
77 // | 87 // |
78 // This could be done more efficiently by explicit fork/exec or | 88 // This could be done more efficiently by explicit fork/exec or |
79 // using a dbus library directly. However, this should run | 89 // using a dbus library directly. However, this should run |
80 // relatively rarely and longer term we may need to implement a | 90 // relatively rarely and longer term we may need to implement a |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 user_collector.Disable(); | 215 user_collector.Disable(); |
206 return 0; | 216 return 0; |
207 } | 217 } |
208 | 218 |
209 if (!FLAGS_generate_kernel_signature.empty()) { | 219 if (!FLAGS_generate_kernel_signature.empty()) { |
210 return GenerateKernelSignature(&kernel_collector); | 220 return GenerateKernelSignature(&kernel_collector); |
211 } | 221 } |
212 | 222 |
213 return HandleUserCrash(&user_collector); | 223 return HandleUserCrash(&user_collector); |
214 } | 224 } |
OLD | NEW |