| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/process/process_metrics.h" | 5 #include "base/process/process_metrics.h" |
| 6 | 6 |
| 7 #include <dirent.h> | 7 #include <dirent.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 #include <sys/time.h> | 10 #include <sys/time.h> |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 DLOG(WARNING) << "Failed to open " << meminfo_file.value(); | 662 DLOG(WARNING) << "Failed to open " << meminfo_file.value(); |
| 663 return false; | 663 return false; |
| 664 } | 664 } |
| 665 | 665 |
| 666 if (!ParseProcMeminfo(meminfo_data, meminfo)) { | 666 if (!ParseProcMeminfo(meminfo_data, meminfo)) { |
| 667 DLOG(WARNING) << "Failed to parse " << meminfo_file.value(); | 667 DLOG(WARNING) << "Failed to parse " << meminfo_file.value(); |
| 668 return false; | 668 return false; |
| 669 } | 669 } |
| 670 | 670 |
| 671 #if defined(OS_CHROMEOS) | 671 #if defined(OS_CHROMEOS) |
| 672 // Report on Chrome OS GEM object graphics memory. /var/run/debugfs_gpu is a | 672 // Report on Chrome OS GEM object graphics memory. /run/debugfs_gpu is a |
| 673 // bind mount into /sys/kernel/debug and synchronously reading the in-memory | 673 // bind mount into /sys/kernel/debug and synchronously reading the in-memory |
| 674 // files in /sys is fast. | 674 // files in /sys is fast. |
| 675 #if defined(ARCH_CPU_ARM_FAMILY) | 675 #if defined(ARCH_CPU_ARM_FAMILY) |
| 676 FilePath geminfo_file("/var/run/debugfs_gpu/exynos_gem_objects"); | 676 FilePath geminfo_file("/run/debugfs_gpu/exynos_gem_objects"); |
| 677 #else | 677 #else |
| 678 FilePath geminfo_file("/var/run/debugfs_gpu/i915_gem_objects"); | 678 FilePath geminfo_file("/run/debugfs_gpu/i915_gem_objects"); |
| 679 #endif | 679 #endif |
| 680 std::string geminfo_data; | 680 std::string geminfo_data; |
| 681 meminfo->gem_objects = -1; | 681 meminfo->gem_objects = -1; |
| 682 meminfo->gem_size = -1; | 682 meminfo->gem_size = -1; |
| 683 if (ReadFileToString(geminfo_file, &geminfo_data)) { | 683 if (ReadFileToString(geminfo_file, &geminfo_data)) { |
| 684 int gem_objects = -1; | 684 int gem_objects = -1; |
| 685 long long gem_size = -1; | 685 long long gem_size = -1; |
| 686 int num_res = sscanf(geminfo_data.c_str(), | 686 int num_res = sscanf(geminfo_data.c_str(), |
| 687 "%d objects, %lld bytes", | 687 "%d objects, %lld bytes", |
| 688 &gem_objects, &gem_size); | 688 &gem_objects, &gem_size); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 #if defined(OS_LINUX) | 907 #if defined(OS_LINUX) |
| 908 int ProcessMetrics::GetIdleWakeupsPerSecond() { | 908 int ProcessMetrics::GetIdleWakeupsPerSecond() { |
| 909 uint64 wake_ups; | 909 uint64 wake_ups; |
| 910 const char kWakeupStat[] = "se.statistics.nr_wakeups"; | 910 const char kWakeupStat[] = "se.statistics.nr_wakeups"; |
| 911 return ReadProcSchedAndGetFieldAsUint64(process_, kWakeupStat, &wake_ups) ? | 911 return ReadProcSchedAndGetFieldAsUint64(process_, kWakeupStat, &wake_ups) ? |
| 912 CalculateIdleWakeupsPerSecond(wake_ups) : 0; | 912 CalculateIdleWakeupsPerSecond(wake_ups) : 0; |
| 913 } | 913 } |
| 914 #endif // defined(OS_LINUX) | 914 #endif // defined(OS_LINUX) |
| 915 | 915 |
| 916 } // namespace base | 916 } // namespace base |
| OLD | NEW |