Index: chrome/browser/process_info_snapshot_mac.cc |
diff --git a/chrome/browser/process_info_snapshot_mac.cc b/chrome/browser/process_info_snapshot_mac.cc |
index 74d93bf6ac039c5917fe73804c0f20432e27ea38..6ee0e05d3a3f7affe0e94ddf2eb4009d0eab4e51 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) { |