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

Side by Side Diff: base/process_util_linux.cc

Issue 11293026: Revert 165244 - Create ash memory monitor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/process_util.h ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_util.h" 5 #include "base/process_util.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <malloc.h> 8 #include <malloc.h>
9 #include <sys/time.h> 9 #include <sys/time.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 // usually video memory otherwise invisible to the OS. Unfortunately, the 670 // usually video memory otherwise invisible to the OS. Unfortunately, the
671 // meminfo format varies on different hardware so we have to search for the 671 // meminfo format varies on different hardware so we have to search for the
672 // string. It always appears after "Cached:". 672 // string. It always appears after "Cached:".
673 for (size_t i = kMemCachedIndex+2; i < meminfo_fields.size(); i += 3) { 673 for (size_t i = kMemCachedIndex+2; i < meminfo_fields.size(); i += 3) {
674 if (meminfo_fields[i] == "Shmem:") { 674 if (meminfo_fields[i] == "Shmem:") {
675 base::StringToInt(meminfo_fields[i+1], &meminfo->shmem); 675 base::StringToInt(meminfo_fields[i+1], &meminfo->shmem);
676 break; 676 break;
677 } 677 }
678 } 678 }
679 #endif 679 #endif
680
681 // Check for gem data and report if present.
682 FilePath geminfo_file("/sys/kernel/debug/dri/0/i915_gem_objects");
683 std::string geminfo_data;
684 meminfo->gem_objects = -1;
685 meminfo->gem_size = -1;
686 if (file_util::ReadFileToString(geminfo_file, &geminfo_data)) {
687 int gem_objects = -1;
688 long long gem_size = -1;
689 int num_res = sscanf(geminfo_data.c_str(),
690 "%d objects, %lld bytes",
691 &gem_objects, &gem_size);
692 if (num_res == 2) {
693 meminfo->gem_objects = gem_objects;
694 meminfo->gem_size = gem_size;
695 }
696 }
697
698 return true; 680 return true;
699 } 681 }
700 682
701 size_t GetSystemCommitCharge() { 683 size_t GetSystemCommitCharge() {
702 SystemMemoryInfoKB meminfo; 684 SystemMemoryInfoKB meminfo;
703 if (!GetSystemMemoryInfo(&meminfo)) 685 if (!GetSystemMemoryInfo(&meminfo))
704 return 0; 686 return 0;
705 return meminfo.total - meminfo.free - meminfo.buffers - meminfo.cached; 687 return meminfo.total - meminfo.free - meminfo.buffers - meminfo.cached;
706 } 688 }
707 689
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 int score_len = static_cast<int>(score_str.length()); 840 int score_len = static_cast<int>(score_str.length());
859 return (score_len == file_util::WriteFile(oom_file, 841 return (score_len == file_util::WriteFile(oom_file,
860 score_str.c_str(), 842 score_str.c_str(),
861 score_len)); 843 score_len));
862 } 844 }
863 845
864 return false; 846 return false;
865 } 847 }
866 848
867 } // namespace base 849 } // namespace base
OLDNEW
« no previous file with comments | « base/process_util.h ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698