Chromium Code Reviews| Index: components/browser_watcher/postmortem_report_collector.cc |
| diff --git a/components/browser_watcher/postmortem_report_collector.cc b/components/browser_watcher/postmortem_report_collector.cc |
| index 35cc7b455b39c324162f31fb73c046d88fda9e93..434e886817555b976d54a09e47a852791ddb1292 100644 |
| --- a/components/browser_watcher/postmortem_report_collector.cc |
| +++ b/components/browser_watcher/postmortem_report_collector.cc |
| @@ -91,19 +91,31 @@ int PostmortemReportCollector::CollectAndSubmitAllPendingReports( |
| settings->GetClientID(&client_id); |
| } |
| + // Number of unclean shutdowns based on successful collection of stability |
| + // reports. |
| + int unclean_cnt = 0; |
| + // Number of unclean shutdowns that may be attributable to system instability |
| + // based on successful collection of stability reports. This number should be |
| + // smaller or equal to |unclean_cnt|. |
| + int unclean_system_cnt = 0; |
| + |
| // Process each stability file. |
| - int success_cnt = 0; |
| for (const FilePath& file : debug_files) { |
| - CollectionStatus status = |
| - CollectAndSubmitOneReport(client_id, file, report_database); |
| + CollectionStatus status = CollectAndSubmitOneReport( |
| + client_id, file, report_database, &unclean_system_cnt); |
| // TODO(manzagop): consider making this a stability metric. |
| UMA_HISTOGRAM_ENUMERATION("ActivityTracker.Collect.Status", status, |
| COLLECTION_STATUS_MAX); |
| if (status == SUCCESS) |
|
Sigurður Ásgeirsson
2017/05/18 12:45:03
yups, if the CollectOne function reports a bool, t
manzagop (departed)
2017/05/18 14:52:12
Done.
|
| - ++success_cnt; |
| + ++unclean_cnt; |
| } |
| - return success_cnt; |
| + UMA_STABILITY_HISTOGRAM_COUNTS_100( |
| + "ActivityTracker.Collect.UncleanShutdownCount", unclean_cnt); |
| + UMA_STABILITY_HISTOGRAM_COUNTS_100( |
| + "ActivityTracker.Collect.UncleanSystemCount", unclean_system_cnt); |
| + |
| + return unclean_cnt; |
| } |
| std::vector<FilePath> PostmortemReportCollector::GetDebugStateFilePaths( |
| @@ -128,8 +140,10 @@ std::vector<FilePath> PostmortemReportCollector::GetDebugStateFilePaths( |
| CollectionStatus PostmortemReportCollector::CollectAndSubmitOneReport( |
| const crashpad::UUID& client_id, |
| const FilePath& file, |
| - crashpad::CrashReportDatabase* report_database) { |
| + crashpad::CrashReportDatabase* report_database, |
| + int* unclean_system_cnt) { |
| DCHECK_NE(nullptr, report_database); |
| + DCHECK_NE(nullptr, unclean_system_cnt); |
| // Note: the code below involves two notions of report: chrome internal state |
| // reports and the crashpad reports they get wrapped into. |
| @@ -189,6 +203,10 @@ CollectionStatus PostmortemReportCollector::CollectAndSubmitOneReport( |
| return FINISHED_WRITING_CRASH_REPORT_FAILED; |
| } |
| + // Report collection is successful. We may increment |unclean_system_cnt|. |
| + if (report_proto.system_state().session_state() == SystemState::UNCLEAN) |
| + (*unclean_system_cnt)++; |
| + |
| return SUCCESS; |
| } |