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

Side by Side Diff: chrome/browser/process_info_snapshot_mac.cc

Issue 3056029: Move the number conversions from string_util to a new file.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 months 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/process_info_snapshot.h" 5 #include "chrome/browser/process_info_snapshot.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/string_number_conversions.h"
11 #include "base/string_util.h" 12 #include "base/string_util.h"
12 #include "base/thread.h" 13 #include "base/thread.h"
13 14
14 // Implementation for the Mac; calls '/bin/ps' for information when 15 // Implementation for the Mac; calls '/bin/ps' for information when
15 // |Sample()| is called. 16 // |Sample()| is called.
16 17
17 // Default constructor. 18 // Default constructor.
18 ProcessInfoSnapshot::ProcessInfoSnapshot() { } 19 ProcessInfoSnapshot::ProcessInfoSnapshot() { }
19 20
20 // Destructor: just call |Reset()| to release everything. 21 // Destructor: just call |Reset()| to release everything.
(...skipping 22 matching lines...) Expand all
43 std::vector<std::string> argv; 44 std::vector<std::string> argv;
44 argv.push_back(kPsPathName); 45 argv.push_back(kPsPathName);
45 // Get PID, PPID, (real) UID, effective UID, resident set size, virtual memory 46 // Get PID, PPID, (real) UID, effective UID, resident set size, virtual memory
46 // size, and command. 47 // size, and command.
47 argv.push_back("-o"); 48 argv.push_back("-o");
48 argv.push_back("pid=,ppid=,ruid=,uid=,rss=,vsz=,comm="); 49 argv.push_back("pid=,ppid=,ruid=,uid=,rss=,vsz=,comm=");
49 // Only display the specified PIDs. 50 // Only display the specified PIDs.
50 for (std::vector<base::ProcessId>::iterator it = pid_list.begin(); 51 for (std::vector<base::ProcessId>::iterator it = pid_list.begin();
51 it != pid_list.end(); ++it) { 52 it != pid_list.end(); ++it) {
52 argv.push_back("-p"); 53 argv.push_back("-p");
53 argv.push_back(Int64ToString(static_cast<int64>(*it))); 54 argv.push_back(base::Int64ToString(static_cast<int64>(*it)));
54 } 55 }
55 56
56 std::string output; 57 std::string output;
57 CommandLine command_line(argv); 58 CommandLine command_line(argv);
58 // Limit output read to a megabyte for safety. 59 // Limit output read to a megabyte for safety.
59 if (!base::GetAppOutputRestricted(command_line, &output, 1024 * 1024)) { 60 if (!base::GetAppOutputRestricted(command_line, &output, 1024 * 1024)) {
60 LOG(ERROR) << "Failure running " << kPsPathName << " to acquire data."; 61 LOG(ERROR) << "Failure running " << kPsPathName << " to acquire data.";
61 return false; 62 return false;
62 } 63 }
63 64
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 ws_usage->shareable = 0; 161 ws_usage->shareable = 0;
161 ws_usage->shared = 0; 162 ws_usage->shared = 0;
162 return false; 163 return false;
163 } 164 }
164 165
165 ws_usage->priv = 0; 166 ws_usage->priv = 0;
166 ws_usage->shareable = proc_info.rss; 167 ws_usage->shareable = proc_info.rss;
167 ws_usage->shared = 0; 168 ws_usage->shared = 0;
168 return true; 169 return true;
169 } 170 }
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/native_backend_gnome_x.cc ('k') | chrome/browser/renderer_host/render_sandbox_host_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698