| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 // TODO(ager): The only reason for this class is that we | 7 // TODO(ager): The only reason for this class is that we |
| 8 // cannot patch a top-level at this point. | 8 // cannot patch a top-level at this point. |
| 9 class _ProcessUtils { | 9 class _ProcessUtils { |
| 10 external static void _exit(int status); | 10 external static void _exit(int status); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 _ProcessUtils._sleep(milliseconds); | 94 _ProcessUtils._sleep(milliseconds); |
| 95 } | 95 } |
| 96 | 96 |
| 97 /** | 97 /** |
| 98 * Returns the PID of the current process. | 98 * Returns the PID of the current process. |
| 99 */ | 99 */ |
| 100 int get pid => _ProcessUtils._pid(null); | 100 int get pid => _ProcessUtils._pid(null); |
| 101 | 101 |
| 102 /** | 102 /** |
| 103 * [ProcessInfo] provides methods for retrieving information about the |
| 104 * current process. |
| 105 */ |
| 106 class ProcessInfo { |
| 107 /** |
| 108 * The current resident set size of memory for the process. |
| 109 * |
| 110 * Note that the meaning of this field is platform dependent. For example, |
| 111 * some memory acounted for here may be shared with other processes, or if |
| 112 * the same page is mapped into a process's address space, it may be counted |
| 113 * twice. |
| 114 */ |
| 115 external static int get currentRss; |
| 116 |
| 117 /** |
| 118 * The high-watermark in bytes for the resident set size of memory for the |
| 119 * process. |
| 120 * |
| 121 * Note that the meaning of this field is platform dependent. For example, |
| 122 * some memory acounted for here may be shared with other processes, or if |
| 123 * the same page is mapped into a process's address space, it may be counted |
| 124 * twice. |
| 125 */ |
| 126 external static int get maxRss; |
| 127 } |
| 128 |
| 129 /** |
| 103 * Modes for running a new process. | 130 * Modes for running a new process. |
| 104 */ | 131 */ |
| 105 enum ProcessStartMode { | 132 enum ProcessStartMode { |
| 106 /// Normal child process. | 133 /// Normal child process. |
| 107 NORMAL, | 134 NORMAL, |
| 108 | 135 |
| 109 /// Detached child process with no open communication channel. | 136 /// Detached child process with no open communication channel. |
| 110 DETACHED, | 137 DETACHED, |
| 111 | 138 |
| 112 /// Detached child process with stdin, stdout and stderr still open | 139 /// Detached child process with stdin, stdout and stderr still open |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 final int errorCode; | 593 final int errorCode; |
| 567 | 594 |
| 568 const ProcessException(this.executable, this.arguments, | 595 const ProcessException(this.executable, this.arguments, |
| 569 [this.message = "", this.errorCode = 0]); | 596 [this.message = "", this.errorCode = 0]); |
| 570 String toString() { | 597 String toString() { |
| 571 var msg = (message == null) ? 'OS error code: $errorCode' : message; | 598 var msg = (message == null) ? 'OS error code: $errorCode' : message; |
| 572 var args = arguments.join(' '); | 599 var args = arguments.join(' '); |
| 573 return "ProcessException: $msg\n Command: $executable $args"; | 600 return "ProcessException: $msg\n Command: $executable $args"; |
| 574 } | 601 } |
| 575 } | 602 } |
| OLD | NEW |