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

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

Issue 2822943002: [dart:io] Adds ProcessInfo.{max,current}Rss. Adds OS::MaxRSS on Fuchsia. (Closed)
Patch Set: Cleanup 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_WINDOWS) 8 #if defined(HOST_OS_WINDOWS)
9 9
10 #include "bin/process.h" 10 #include "bin/process.h"
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 void Process::TerminateExitCodeHandler() { 934 void Process::TerminateExitCodeHandler() {
935 // Nothing needs to be done on Windows. 935 // Nothing needs to be done on Windows.
936 } 936 }
937 937
938 938
939 intptr_t Process::CurrentProcessId() { 939 intptr_t Process::CurrentProcessId() {
940 return static_cast<intptr_t>(GetCurrentProcessId()); 940 return static_cast<intptr_t>(GetCurrentProcessId());
941 } 941 }
942 942
943 943
944 intptr_t Process::CurrentRss() {
945 PROCESS_MEMORY_COUNTERS pmc;
946 if (!GetProcessMemoryInfo(GetCurrentProcess(), &info, sizeof(pmc))) {
947 return -1;
948 }
949 return pmc.WorkingSetSize;
950 }
951
952
953 intptr_t Process::MaxRSS() {
954 PROCESS_MEMORY_COUNTERS pmc;
955 if (!GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
956 return -1;
957 }
958 return pmc.PeakWorkingSetSize;
959 }
960
961
944 static SignalInfo* signal_handlers = NULL; 962 static SignalInfo* signal_handlers = NULL;
945 static Mutex* signal_mutex = new Mutex(); 963 static Mutex* signal_mutex = new Mutex();
946 964
947 965
948 SignalInfo::~SignalInfo() { 966 SignalInfo::~SignalInfo() {
949 FileHandle* file_handle = reinterpret_cast<FileHandle*>(fd_); 967 FileHandle* file_handle = reinterpret_cast<FileHandle*>(fd_);
950 file_handle->Close(); 968 file_handle->Close();
951 file_handle->Release(); 969 file_handle->Release();
952 } 970 }
953 971
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 } 1069 }
1052 delete handler; 1070 delete handler;
1053 } 1071 }
1054 1072
1055 } // namespace bin 1073 } // namespace bin
1056 } // namespace dart 1074 } // namespace dart
1057 1075
1058 #endif // defined(HOST_OS_WINDOWS) 1076 #endif // defined(HOST_OS_WINDOWS)
1059 1077
1060 #endif // !defined(DART_IO_DISABLED) 1078 #endif // !defined(DART_IO_DISABLED)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698