diff options
author | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-11 21:24:39 +0000 |
---|---|---|
committer | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-11 21:24:39 +0000 |
commit | dc0b5bdb56a502c648dba9e9c042392298a97617 (patch) | |
tree | 53ccf49287385cafb8edfb933e4f56ec538780f4 /base/process_util_linux.cc | |
parent | 4fb4a895d3b238cd8a7860295a419b130db488ba (diff) | |
download | chromium_src-dc0b5bdb56a502c648dba9e9c042392298a97617.zip chromium_src-dc0b5bdb56a502c648dba9e9c042392298a97617.tar.gz chromium_src-dc0b5bdb56a502c648dba9e9c042392298a97617.tar.bz2 |
cros: Add UMA stats for graphics driver memory
* Log graphics driver memory in the regular UMA memory stats
* Log also on tab discard
* Fix range of Tab.Discard.MemAnonymousMB to give more precision in the > 2 GB range
* Incorporate both Mali and GEM memory for ARM stats
BUG=164761,164106
TEST=manual
Review URL: https://chromiumcodereview.appspot.com/11475016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172405 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util_linux.cc')
-rw-r--r-- | base/process_util_linux.cc | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc index 1099fec..11937f0 100644 --- a/base/process_util_linux.cc +++ b/base/process_util_linux.cc @@ -623,7 +623,9 @@ SystemMemoryInfoKB::SystemMemoryInfoKB() inactive_anon(0), active_file(0), inactive_file(0), - shmem(0) { + shmem(0), + gem_objects(-1), + gem_size(-1) { } bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) { @@ -678,11 +680,14 @@ bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) { } #endif - // Check for gem data and report if present. + // Check for graphics memory data and report if present. Synchronously + // reading files in /sys is fast. +#if defined(ARCH_CPU_ARM_FAMILY) + FilePath geminfo_file("/sys/kernel/debug/dri/0/exynos_gem_objects"); +#else FilePath geminfo_file("/sys/kernel/debug/dri/0/i915_gem_objects"); +#endif std::string geminfo_data; - FilePath mali_memory_file("/sys/devices/platform/mali.0/memory"); - std::string mali_memory_data; meminfo->gem_objects = -1; meminfo->gem_size = -1; if (file_util::ReadFileToString(geminfo_file, &geminfo_data)) { @@ -695,15 +700,20 @@ bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) { meminfo->gem_objects = gem_objects; meminfo->gem_size = gem_size; } - } else { - if (file_util::ReadFileToString(mali_memory_file, &mali_memory_data)) { - long long mali_size = -1; - int num_res = sscanf(mali_memory_data.c_str(), "%lld bytes", &mali_size); - if (num_res == 1) - meminfo->gem_size = mali_size; - } + } +#if defined(ARCH_CPU_ARM_FAMILY) + // Incorporate Mali graphics memory if present. + FilePath mali_memory_file("/sys/devices/platform/mali.0/memory"); + std::string mali_memory_data; + if (file_util::ReadFileToString(mali_memory_file, &mali_memory_data)) { + long long mali_size = -1; + int num_res = sscanf(mali_memory_data.c_str(), "%lld bytes", &mali_size); + if (num_res == 1) + meminfo->gem_size += mali_size; } +#endif // defined(ARCH_CPU_ARM_FAMILY) + return true; } |