OLD | NEW |
1 // Copyright 2016 The Crashpad Authors. All rights reserved. | 1 // Copyright 2016 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 12 matching lines...) Expand all Loading... |
23 namespace crashpad { | 23 namespace crashpad { |
24 | 24 |
25 //! \brief Container class to hold shared UMA metrics integration points. | 25 //! \brief Container class to hold shared UMA metrics integration points. |
26 //! | 26 //! |
27 //! Each static function in this class will call a `UMA_*` from | 27 //! Each static function in this class will call a `UMA_*` from |
28 //! `base/metrics/histogram_macros.h`. When building Crashpad standalone, | 28 //! `base/metrics/histogram_macros.h`. When building Crashpad standalone, |
29 //! (against mini_chromium), these macros do nothing. When built against | 29 //! (against mini_chromium), these macros do nothing. When built against |
30 //! Chromium's base, they allow integration with its metrics system. | 30 //! Chromium's base, they allow integration with its metrics system. |
31 class Metrics { | 31 class Metrics { |
32 public: | 32 public: |
33 //! \brief Values for CrashReportPending(). These are used as metrics | 33 //! \brief Values for CrashReportPending(). |
34 //! enumeration values, so new values should always be added at the end. | 34 //! |
| 35 //! \note These are used as metrics enumeration values, so new values should |
| 36 //! always be added at the end, before PendingReportReason::kMaxValue. |
35 enum class PendingReportReason : int32_t { | 37 enum class PendingReportReason : int32_t { |
36 //! \brief A report was newly created and is ready for upload. | 38 //! \brief A report was newly created and is ready for upload. |
37 kNewlyCreated = 0, | 39 kNewlyCreated = 0, |
38 | 40 |
39 //! \brief The user manually requested the report be uploaded. | 41 //! \brief The user manually requested the report be uploaded. |
40 kUserInitiated = 1, | 42 kUserInitiated = 1, |
41 | 43 |
42 //! \brief The number of values in this enumeration; not a valid value. | 44 //! \brief The number of values in this enumeration; not a valid value. |
43 kMaxValue | 45 kMaxValue |
44 }; | 46 }; |
45 | 47 |
46 //! \brief Reports when a crash upload has entered the pending state. | 48 //! \brief Reports when a crash upload has entered the pending state. |
47 static void CrashReportPending(PendingReportReason reason); | 49 static void CrashReportPending(PendingReportReason reason); |
48 | 50 |
49 //! \brief Reports the size of a crash report file in bytes. Should be called | 51 //! \brief Reports the size of a crash report file in bytes. Should be called |
50 //! when a new report is written to disk. | 52 //! when a new report is written to disk. |
51 static void CrashReportSize(FileHandle file); | 53 static void CrashReportSize(FileHandle file); |
52 | 54 |
53 //! \brief Reports on a crash upload attempt, and if it succeeded. | 55 //! \brief Reports on a crash upload attempt, and if it succeeded. |
54 static void CrashUploadAttempted(bool successful); | 56 static void CrashUploadAttempted(bool successful); |
55 | 57 |
56 //! \brief Values for CrashUploadSkipped(). These are used as metrics | 58 //! \brief Values for CrashUploadSkipped(). |
57 //! enumeration values, so new values should always be added at the end. | 59 //! |
| 60 //! \note These are used as metrics enumeration values, so new values should |
| 61 //! always be added at the end, before CrashSkippedReason::kMaxValue. |
58 enum class CrashSkippedReason : int32_t { | 62 enum class CrashSkippedReason : int32_t { |
59 //! \brief Crash uploading is disabled. | 63 //! \brief Crash uploading is disabled. |
60 kUploadsDisabled = 0, | 64 kUploadsDisabled = 0, |
61 | 65 |
62 //! \brief There was another upload too recently, so this one was throttled. | 66 //! \brief There was another upload too recently, so this one was throttled. |
63 kUploadThrottled = 1, | 67 kUploadThrottled = 1, |
64 | 68 |
65 //! \brief The report had an unexpected timestamp. | 69 //! \brief The report had an unexpected timestamp. |
66 kUnexpectedTime = 2, | 70 kUnexpectedTime = 2, |
67 | 71 |
68 //! \brief The database reported an error, likely due to a filesystem | 72 //! \brief The database reported an error, likely due to a filesystem |
69 //! problem. | 73 //! problem. |
70 kDatabaseError = 3, | 74 kDatabaseError = 3, |
71 | 75 |
72 //! \brief The upload of the crash failed during communication with the | 76 //! \brief The upload of the crash failed during communication with the |
73 //! server. | 77 //! server. |
74 kUploadFailed = 4, | 78 kUploadFailed = 4, |
75 | 79 |
76 //! \brief The number of values in this enumeration; not a valid value. | 80 //! \brief The number of values in this enumeration; not a valid value. |
77 kMaxValue | 81 kMaxValue |
78 }; | 82 }; |
79 | 83 |
80 //! \brief Reports when a report is moved to the completed state in the | 84 //! \brief Reports when a report is moved to the completed state in the |
81 //! database, without the report being uploadad. | 85 //! database, without the report being uploadad. |
82 static void CrashUploadSkipped(CrashSkippedReason reason); | 86 static void CrashUploadSkipped(CrashSkippedReason reason); |
83 | 87 |
84 //! \brief The result of capturing an exception. These are used as metrics | 88 //! \brief The result of capturing an exception. |
85 //! enumeration values, so new values should always be added at the end. | 89 //! |
| 90 //! \note These are used as metrics enumeration values, so new values should |
| 91 //! always be added at the end, before CaptureResult::kMaxValue. |
86 enum class CaptureResult : int32_t { | 92 enum class CaptureResult : int32_t { |
87 //! \brief The exception capture succeeded normally. | 93 //! \brief The exception capture succeeded normally. |
88 kSuccess = 0, | 94 kSuccess = 0, |
89 | 95 |
90 //! \brief Unexpected exception behavior. | 96 //! \brief Unexpected exception behavior. |
91 //! | 97 //! |
92 //! This value is only used on macOS. | 98 //! This value is only used on macOS. |
93 kUnexpectedExceptionBehavior = 1, | 99 kUnexpectedExceptionBehavior = 1, |
94 | 100 |
95 //! \brief Failed due to attempt to suspend self. | 101 //! \brief Failed due to attempt to suspend self. |
(...skipping 27 matching lines...) Expand all Loading... |
123 | 129 |
124 //! \brief The exception code for an exception was retrieved. | 130 //! \brief The exception code for an exception was retrieved. |
125 //! | 131 //! |
126 //! These values are OS-specific, and correspond to | 132 //! These values are OS-specific, and correspond to |
127 //! MINIDUMP_EXCEPTION::ExceptionCode. | 133 //! MINIDUMP_EXCEPTION::ExceptionCode. |
128 static void ExceptionCode(uint32_t exception_code); | 134 static void ExceptionCode(uint32_t exception_code); |
129 | 135 |
130 //! \brief The exception handler server started capturing an exception. | 136 //! \brief The exception handler server started capturing an exception. |
131 static void ExceptionEncountered(); | 137 static void ExceptionEncountered(); |
132 | 138 |
| 139 //! \brief An important event in a handler process’ lifetime. |
| 140 //! |
| 141 //! \note These are used as metrics enumeration values, so new values should |
| 142 //! always be added at the end, before LifetimeMilestone::kMaxValue. |
| 143 enum class LifetimeMilestone : int32_t { |
| 144 //! \brief The handler process started. |
| 145 kStarted = 0, |
| 146 |
| 147 //! \brief The handler process exited normally and cleanly. |
| 148 kExitedNormally, |
| 149 |
| 150 //! \brief The handler process exited early, but was successful in |
| 151 //! performing some non-default action on user request. |
| 152 kExitedEarly, |
| 153 |
| 154 //! \brief The handler process exited with a failure code. |
| 155 kFailed, |
| 156 |
| 157 //! \brief The handler process was forcibly terminated. |
| 158 kTerminated, |
| 159 |
| 160 //! \brief The handler process crashed. |
| 161 kCrashed, |
| 162 |
| 163 //! \brief The number of values in this enumeration; not a valid value. |
| 164 kMaxValue |
| 165 }; |
| 166 |
| 167 //! \brief Records a handler start/exit/crash event. |
| 168 static void HandlerLifetimeMilestone(LifetimeMilestone milestone); |
| 169 |
133 //! \brief The handler process crashed with the given exception code. | 170 //! \brief The handler process crashed with the given exception code. |
134 //! | 171 //! |
135 //! This is currently only reported on Windows. | 172 //! This is currently only reported on Windows. |
136 static void HandlerCrashed(uint32_t exception_code); | 173 static void HandlerCrashed(uint32_t exception_code); |
137 | 174 |
138 private: | 175 private: |
139 DISALLOW_IMPLICIT_CONSTRUCTORS(Metrics); | 176 DISALLOW_IMPLICIT_CONSTRUCTORS(Metrics); |
140 }; | 177 }; |
141 | 178 |
142 } // namespace crashpad | 179 } // namespace crashpad |
143 | 180 |
144 #endif // CRASHPAD_UTIL_MISC_METRICS_H_ | 181 #endif // CRASHPAD_UTIL_MISC_METRICS_H_ |
OLD | NEW |