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

Side by Side Diff: base/process_util.h

Issue 467058: Linux: Adjust /proc/pid/oom_adj to sacrifice plugin and renderer processes to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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 | « no previous file | base/process_util_linux.cc » ('j') | sandbox/linux/suid/process_util_linux.c » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This file/namespace contains utility functions for enumerating, ending and 5 // This file/namespace contains utility functions for enumerating, ending and
6 // computing statistics of processes. 6 // computing statistics of processes.
7 7
8 #ifndef BASE_PROCESS_UTIL_H_ 8 #ifndef BASE_PROCESS_UTIL_H_
9 #define BASE_PROCESS_UTIL_H_ 9 #define BASE_PROCESS_UTIL_H_
10 10
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // Returns the ID for the parent of the given process. 93 // Returns the ID for the parent of the given process.
94 ProcessId GetParentProcessId(ProcessHandle process); 94 ProcessId GetParentProcessId(ProcessHandle process);
95 95
96 // Returns the path to the executable of the given process. 96 // Returns the path to the executable of the given process.
97 FilePath GetProcessExecutablePath(ProcessHandle process); 97 FilePath GetProcessExecutablePath(ProcessHandle process);
98 98
99 // Parse the data found in /proc/<pid>/stat and return the sum of the 99 // Parse the data found in /proc/<pid>/stat and return the sum of the
100 // CPU-related ticks. Returns -1 on parse error. 100 // CPU-related ticks. Returns -1 on parse error.
101 // Exposed for testing. 101 // Exposed for testing.
102 int ParseProcStatCPU(const std::string& input); 102 int ParseProcStatCPU(const std::string& input);
103
104 static const char kAdjustOOMScoreSwitch[] = "--adjust-oom-score";
105
106 // This adjusts /proc/process/oom_adj so the Linux OOM killer will prefer
107 // certain process types over others. The range for the adjustment is
108 // [-17,15], with [0,15] being user accessible.
109 bool AdjustOOMScore(ProcessId process, int score);
103 #endif 110 #endif
104 111
105 #if defined(OS_POSIX) 112 #if defined(OS_POSIX)
106 // Sets all file descriptors to close on exec except for stdin, stdout 113 // Sets all file descriptors to close on exec except for stdin, stdout
107 // and stderr. 114 // and stderr.
108 // TODO(agl): remove this function 115 // TODO(agl): remove this function
109 // WARNING: do not use. It's inherently race-prone in the face of 116 // WARNING: do not use. It's inherently race-prone in the face of
110 // multi-threading. 117 // multi-threading.
111 void SetAllFDsToCloseOnExec(); 118 void SetAllFDsToCloseOnExec();
112 // Close all file descriptors, expect those which are a destination in the 119 // Close all file descriptors, expect those which are a destination in the
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 // instance running inside the parent. The parent's Breakpad instance should 466 // instance running inside the parent. The parent's Breakpad instance should
460 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler 467 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler
461 // in the child after forking will restore the standard exception handler. 468 // in the child after forking will restore the standard exception handler.
462 // See http://crbug.com/20371/ for more details. 469 // See http://crbug.com/20371/ for more details.
463 void RestoreDefaultExceptionHandler(); 470 void RestoreDefaultExceptionHandler();
464 #endif 471 #endif
465 472
466 } // namespace base 473 } // namespace base
467 474
468 #endif // BASE_PROCESS_UTIL_H_ 475 #endif // BASE_PROCESS_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/process_util_linux.cc » ('j') | sandbox/linux/suid/process_util_linux.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698