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

Unified Diff: chrome/browser/chromeos/memory/oom_priority_manager.cc

Issue 11475016: cros: Add UMA stat for graphics driver memory on tab discard (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Log graphics on discard, fix anon mem range Created 8 years 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
Index: chrome/browser/chromeos/memory/oom_priority_manager.cc
diff --git a/chrome/browser/chromeos/memory/oom_priority_manager.cc b/chrome/browser/chromeos/memory/oom_priority_manager.cc
index a0f38aa716246c0f1306db5e619ea72be2e769db..ef63457902177df1dc89fd9e7e6e5a72e06e201a 100644
--- a/chrome/browser/chromeos/memory/oom_priority_manager.cc
+++ b/chrome/browser/chromeos/memory/oom_priority_manager.cc
@@ -17,6 +17,7 @@
#include "base/process_util.h"
#include "base/string16.h"
#include "base/string_number_conversions.h"
+#include "base/stringprintf.h"
#include "base/synchronization/lock.h"
#include "base/threading/thread.h"
#include "base/time.h"
@@ -110,8 +111,14 @@ void OomMemoryDetails::OnDetailsAvailable() {
TimeDelta delta = TimeTicks::Now() - start_time_;
// These logs are collected by user feedback reports. We want them to help
// diagnose user-reported problems with frequently discarded tabs.
+ std::string log_string = ToLogString();
+ base::SystemMemoryInfoKB memory;
+ if (base::GetSystemMemoryInfo(&memory) && memory.gem_size != -1) {
+ log_string += StringPrintf("Graphics %lld MB",
+ memory.gem_size / 1024 / 1024);
DaveMoore 2012/12/07 18:52:48 Use ui::FormatBytes() instead. You can find it in
James Cook 2012/12/07 19:41:22 Done.
+ }
LOG(WARNING) << "OOM details (" << delta.InMilliseconds() << " ms):\n"
- << ToLogString();
+ << log_string;
if (g_browser_process && g_browser_process->oom_priority_manager())
g_browser_process->oom_priority_manager()->DiscardTab();
// Delete ourselves so we don't have to worry about OomPriorityManager
@@ -281,13 +288,24 @@ void OomPriorityManager::RecordDiscardStatistics() {
base::SystemMemoryInfoKB memory;
if (base::GetSystemMemoryInfo(&memory)) {
int mem_anonymous_mb = (memory.active_anon + memory.inactive_anon) / 1024;
+ // TODO(jamescook): Remove this after R25 is deployed to stable. It does
+ // not have sufficient resolution in the 2-4 GB range and has been replaced
+ // by Tabs.Discard.MemAnonymousMB2 below.
EXPERIMENT_HISTOGRAM_MEGABYTES("Tabs.Discard.MemAnonymousMB",
mem_anonymous_mb);
+ EXPERIMENT_CUSTOM_COUNTS("Tabs.Discard.MemAnonymousMB2", mem_anonymous_mb,
+ 256, 32768, 50)
int mem_available_mb =
(memory.active_file + memory.inactive_file + memory.free) / 1024;
EXPERIMENT_HISTOGRAM_MEGABYTES("Tabs.Discard.MemAvailableMB",
mem_available_mb);
+
+ if (memory.gem_size != -1) {
DaveMoore 2012/12/07 18:52:48 If you do this on Intel you will double count memo
James Cook 2012/12/07 19:41:22 Replaced with a MemAllocatedMB stat that tracks bo
+ int mem_graphics_mb = memory.gem_size / 1024 / 1024;
+ EXPERIMENT_HISTOGRAM_MEGABYTES("Tabs.Discard.MemGraphicsMB",
+ mem_graphics_mb);
+ }
}
// Set up to record the next interval.
last_discard_time_ = TimeTicks::Now();

Powered by Google App Engine
This is Rietveld 408576698