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

Side by Side Diff: runtime/bin/process_fuchsia.cc

Issue 2822943002: [dart:io] Adds ProcessInfo.{max,current}Rss. Adds OS::MaxRSS on Fuchsia. (Closed)
Patch Set: Fix Fuchsia build Created 3 years, 8 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
OLDNEW
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
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
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)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698