OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 #if !defined(DART_IO_DISABLED) | 5 #if !defined(DART_IO_DISABLED) |
6 | 6 |
7 #include "platform/globals.h" | 7 #include "platform/globals.h" |
8 #if defined(HOST_OS_FUCHSIA) | 8 #if defined(HOST_OS_FUCHSIA) |
9 | 9 |
10 #include "bin/process.h" | 10 #include "bin/process.h" |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 void Process::TerminateExitCodeHandler() { | 424 void Process::TerminateExitCodeHandler() { |
425 ExitCodeHandler::Terminate(); | 425 ExitCodeHandler::Terminate(); |
426 } | 426 } |
427 | 427 |
428 | 428 |
429 intptr_t Process::CurrentProcessId() { | 429 intptr_t Process::CurrentProcessId() { |
430 return static_cast<intptr_t>(getpid()); | 430 return static_cast<intptr_t>(getpid()); |
431 } | 431 } |
432 | 432 |
433 | 433 |
| 434 int64_t Process::CurrentRSS() { |
| 435 mx_info_task_stats_t task_stats; |
| 436 mx_handle_t process = mx_process_self(); |
| 437 mx_status_t status = mx_object_get_info( |
| 438 process, MX_INFO_TASK_STATS, &task_stats, sizeof(task_stats), NULL, NULL); |
| 439 if (status != NO_ERROR) { |
| 440 // TODO(zra): Translate this to a Unix errno. |
| 441 errno = status; |
| 442 return -1; |
| 443 } |
| 444 return task_stats.mem_committed_bytes; |
| 445 } |
| 446 |
| 447 |
| 448 int64_t Process::MaxRSS() { |
| 449 // There is currently no way to get the high watermark value on Fuchsia, so |
| 450 // just return the current RSS value. |
| 451 return CurrentRSS(); |
| 452 } |
| 453 |
| 454 |
434 static bool ProcessWaitCleanup(intptr_t out, | 455 static bool ProcessWaitCleanup(intptr_t out, |
435 intptr_t err, | 456 intptr_t err, |
436 intptr_t exit_event, | 457 intptr_t exit_event, |
437 intptr_t epoll_fd) { | 458 intptr_t epoll_fd) { |
438 int e = errno; | 459 int e = errno; |
439 VOID_NO_RETRY_EXPECTED(close(out)); | 460 VOID_NO_RETRY_EXPECTED(close(out)); |
440 VOID_NO_RETRY_EXPECTED(close(err)); | 461 VOID_NO_RETRY_EXPECTED(close(err)); |
441 VOID_NO_RETRY_EXPECTED(close(exit_event)); | 462 VOID_NO_RETRY_EXPECTED(close(exit_event)); |
442 VOID_NO_RETRY_EXPECTED(close(epoll_fd)); | 463 VOID_NO_RETRY_EXPECTED(close(epoll_fd)); |
443 errno = e; | 464 errno = e; |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 | 836 |
816 void Process::ClearSignalHandler(intptr_t signal) { | 837 void Process::ClearSignalHandler(intptr_t signal) { |
817 } | 838 } |
818 | 839 |
819 } // namespace bin | 840 } // namespace bin |
820 } // namespace dart | 841 } // namespace dart |
821 | 842 |
822 #endif // defined(HOST_OS_FUCHSIA) | 843 #endif // defined(HOST_OS_FUCHSIA) |
823 | 844 |
824 #endif // !defined(DART_IO_DISABLED) | 845 #endif // !defined(DART_IO_DISABLED) |
OLD | NEW |