diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-09 20:27:26 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-09 20:27:26 +0000 |
commit | beee7a9de8c1fb91f05ffa7eeb657a5679c1dfe4 (patch) | |
tree | 98bfad12c48d26401a5d0520f2ee85641c364b18 /chrome/browser/process_info_snapshot_mac.cc | |
parent | 5f818b93158695864a8b8958e7f62b6a1741420f (diff) | |
download | chromium_src-beee7a9de8c1fb91f05ffa7eeb657a5679c1dfe4.zip chromium_src-beee7a9de8c1fb91f05ffa7eeb657a5679c1dfe4.tar.gz chromium_src-beee7a9de8c1fb91f05ffa7eeb657a5679c1dfe4.tar.bz2 |
mac: Delete more 10.5-only code
BUG=137676
TBR=tony, sky
Review URL: https://chromiumcodereview.appspot.com/10837158
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150878 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/process_info_snapshot_mac.cc')
-rw-r--r-- | chrome/browser/process_info_snapshot_mac.cc | 76 |
1 files changed, 1 insertions, 75 deletions
diff --git a/chrome/browser/process_info_snapshot_mac.cc b/chrome/browser/process_info_snapshot_mac.cc index 74d93bf..6ee0e05 100644 --- a/chrome/browser/process_info_snapshot_mac.cc +++ b/chrome/browser/process_info_snapshot_mac.cc @@ -10,7 +10,6 @@ #include "base/command_line.h" #include "base/logging.h" -#include "base/mac/mac_util.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/threading/thread.h" @@ -268,75 +267,6 @@ static bool GetProcessMemoryInfoUsingTop( return true; } -static bool GetProcessMemoryInfoUsingTop_10_5( - std::map<int,ProcessInfoSnapshot::ProcInfoEntry>& proc_info_entries) { - const FilePath kProgram("/usr/bin/top"); - CommandLine command_line(kProgram); - - // -p tells top to print just the given fields as ordered. - command_line.AppendArg("-p"); - command_line.AppendArg( - "^aaaaaaaaaaaaaaaaaaaa " // Process ID (PID) - "^jjjjjjjjjjjjjjjjjjjj " // Resident memory (RSIZE) - "^iiiiiiiiiiiiiiiiiiii " // Resident shared memory (RSHRD) - "^hhhhhhhhhhhhhhhhhhhh " // Resident private memory (RPRVT) - "^llllllllllllllllllll"); // Total virtual memory (VSIZE) - // Run top in logging (non-interactive) mode. - command_line.AppendArg("-l"); - command_line.AppendArg("1"); - // Set the delay between updates to 0. - command_line.AppendArg("-s"); - command_line.AppendArg("0"); - - std::string output; - // Limit output read to a megabyte for safety. - if (!base::GetAppOutputRestricted(command_line, &output, 1024 * 1024)) { - LOG(ERROR) << "Failure running " << kProgram.value() << " to acquire data."; - return false; - } - - // Process lines until done. Lines should look something like this: - // PID RSIZE RSHRD RPRVT VSIZE - // 16943 815104 262144 290816 18489344 - // 16922 954368 720896 278528 18976768 - std::istringstream top_in(output, std::istringstream::in); - std::string line; - while (std::getline(top_in, line)) { - std::istringstream in(line, std::istringstream::in); - - // Try to read the PID. - pid_t pid; - in >> pid; - if (in.fail()) - continue; - - // Make sure that caller is interested in this process. - if (proc_info_entries.find(pid) == proc_info_entries.end()) - continue; - - uint64_t values[4]; - size_t i; - for (i = 0; i < arraysize(values); i++) { - in >> values[i]; - if (in.fail()) - break; - } - if (i != arraysize(values)) - continue; - - ProcessInfoSnapshot::ProcInfoEntry proc_info = proc_info_entries[pid]; - proc_info.rss = values[0]; - proc_info.rshrd = values[1]; - proc_info.rprvt = values[2]; - proc_info.vsize = values[3]; - // Record the process information. - proc_info_entries[proc_info.pid] = proc_info; - } - - return true; -} - - bool ProcessInfoSnapshot::Sample(std::vector<base::ProcessId> pid_list) { Reset(); @@ -379,11 +309,7 @@ bool ProcessInfoSnapshot::Sample(std::vector<base::ProcessId> pid_list) { } // Get memory information using top. - bool memory_info_success = false; - if (base::mac::IsOSLeopardOrEarlier()) - memory_info_success = GetProcessMemoryInfoUsingTop_10_5(proc_info_entries_); - else - memory_info_success = GetProcessMemoryInfoUsingTop(proc_info_entries_); + bool memory_info_success = GetProcessMemoryInfoUsingTop(proc_info_entries_); // If top didn't work then fall back to ps. if (!memory_info_success) { |