Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3629)

Unified Diff: chrome/browser/metrics/metrics_service.cc

Issue 9769011: Histogram times surrounding render crashes (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/metrics/metrics_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/metrics_service.cc
===================================================================
--- chrome/browser/metrics/metrics_service.cc (revision 127735)
+++ chrome/browser/metrics/metrics_service.cc (working copy)
@@ -559,8 +559,8 @@
details).ptr();
content::RenderProcessHost* host =
content::Source<content::RenderProcessHost>(source).ptr();
- LogRendererCrash(
- host, process_details->status, process_details->was_alive);
+ LogRendererCrash(host, process_details->status,
+ process_details->was_alive, process_details->handle);
}
break;
@@ -1368,20 +1368,80 @@
// might be lost due to a crash :-(.
}
+#if defined(OS_WIN)
+static base::TimeDelta FromWinFileTime(FILETIME filetime) {
rvargas (doing something else) 2012/03/21 22:54:41 use Time::FromFileTime() instead
+ ULARGE_INTEGER large_integer;
+ large_integer.LowPart = filetime.dwLowDateTime;
+ large_integer.HighPart = filetime.dwHighDateTime;
+ // Time is supplied in 100 nano-second counts.
+ return base::TimeDelta::FromMicroseconds(large_integer.QuadPart / 10);
+}
+#endif // OS_WIN
+
void MetricsService::LogRendererCrash(content::RenderProcessHost* host,
base::TerminationStatus status,
- bool was_alive) {
+ bool was_alive,
+ base::ProcessHandle handle) {
Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
ExtensionService* service = profile->GetExtensionService();
bool was_extension_process =
service && service->process_map()->Contains(host->GetID());
+
+#if defined(OS_WIN)
+ FILETIME win_creation_time;
+ FILETIME win_exit_time;
+ FILETIME win_kernel_time;
+ FILETIME win_user_time;
+ base::TimeDelta creation_time;
+ base::TimeDelta exit_time;
+ base::TimeDelta kernel_duration;
+ base::TimeDelta user_duration;
+ base::TimeDelta run_duration;
+ bool have_process_times = (0 != GetProcessTimes(handle, &win_creation_time,
+ &win_exit_time, &win_kernel_time, &win_user_time));
+ if (have_process_times) {
+ creation_time = FromWinFileTime(win_creation_time);
+ exit_time = FromWinFileTime(win_exit_time);
+ kernel_duration = FromWinFileTime(win_kernel_time);
+ user_duration = FromWinFileTime(win_user_time);
+ run_duration = exit_time - creation_time;
+ } else {
+ DWORD an_error = GetLastError();
+ DLOG(ERROR) << "Error getting process data" << an_error;
+ }
+#endif // OS_WIN
+
if (status == base::TERMINATION_STATUS_PROCESS_CRASHED ||
status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) {
- if (was_extension_process)
+ if (was_extension_process) {
IncrementPrefValue(prefs::kStabilityExtensionRendererCrashCount);
- else
+ } else {
IncrementPrefValue(prefs::kStabilityRendererCrashCount);
+#if defined(OS_WIN)
+ if (have_process_times) {
+ if (status == base::TERMINATION_STATUS_PROCESS_CRASHED) {
+ UMA_HISTOGRAM_TIMES("BrowserRenderProcessHost.CrashedDuration",
+ run_duration);
+ UMA_HISTOGRAM_TIMES("BrowserRenderProcessHost.CrashedKernelTime",
+ kernel_duration);
+ UMA_HISTOGRAM_TIMES("BrowserRenderProcessHost.CrashedUserTime",
+ user_duration);
+ } else {
+ DCHECK(status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION);
+ UMA_HISTOGRAM_TIMES("BrowserRenderProcessHost.AbnormalTermDuration",
+ run_duration);
+ UMA_HISTOGRAM_TIMES("BrowserRenderProcessHost.AbnormalTermKernelTime",
+ kernel_duration);
+ UMA_HISTOGRAM_TIMES("BrowserRenderProcessHost.AbnormalTermUserTime",
+ user_duration);
+ }
+ }
+#endif // OS_WIN
+
+ }
+
+ // TODO(jar): These histograms should be small enumerated histograms.
UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildCrashes",
was_extension_process ? 2 : 1);
if (was_alive) {
@@ -1396,6 +1456,20 @@
was_extension_process ? 2 : 1);
}
}
+
+#if defined(OS_WIN)
+ if (have_process_times && !was_extension_process &&
+ status != base::TERMINATION_STATUS_PROCESS_CRASHED &&
+ status != base::TERMINATION_STATUS_ABNORMAL_TERMINATION) {
+ UMA_HISTOGRAM_TIMES("BrowserRenderProcessHost.NormalTermDuration",
+ run_duration);
+ UMA_HISTOGRAM_TIMES("BrowserRenderProcessHost.NormalTermKernelTime",
+ kernel_duration);
+ UMA_HISTOGRAM_TIMES("BrowserRenderProcessHost.NormalTermUserTime",
+ user_duration);
+ }
+#endif // OS_WIN
+
}
void MetricsService::LogRendererHang() {
« no previous file with comments | « chrome/browser/metrics/metrics_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698