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

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: 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) 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"
11 11
12 #include <psapi.h> // NOLINT
12 #include <process.h> // NOLINT 13 #include <process.h> // NOLINT
13 14
14 #include "bin/builtin.h" 15 #include "bin/builtin.h"
15 #include "bin/dartutils.h" 16 #include "bin/dartutils.h"
16 #include "bin/eventhandler.h" 17 #include "bin/eventhandler.h"
17 #include "bin/lockers.h" 18 #include "bin/lockers.h"
18 #include "bin/log.h" 19 #include "bin/log.h"
19 #include "bin/socket.h" 20 #include "bin/socket.h"
20 #include "bin/thread.h" 21 #include "bin/thread.h"
21 #include "bin/utils.h" 22 #include "bin/utils.h"
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 void Process::TerminateExitCodeHandler() { 935 void Process::TerminateExitCodeHandler() {
935 // Nothing needs to be done on Windows. 936 // Nothing needs to be done on Windows.
936 } 937 }
937 938
938 939
939 intptr_t Process::CurrentProcessId() { 940 intptr_t Process::CurrentProcessId() {
940 return static_cast<intptr_t>(GetCurrentProcessId()); 941 return static_cast<intptr_t>(GetCurrentProcessId());
941 } 942 }
942 943
943 944
945 int64_t Process::CurrentRSS() {
946 PROCESS_MEMORY_COUNTERS pmc;
947 if (!GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
948 return -1;
949 }
950 return pmc.WorkingSetSize;
951 }
952
953
954 int64_t Process::MaxRSS() {
955 PROCESS_MEMORY_COUNTERS pmc;
956 if (!GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
957 return -1;
958 }
959 return pmc.PeakWorkingSetSize;
960 }
961
962
944 static SignalInfo* signal_handlers = NULL; 963 static SignalInfo* signal_handlers = NULL;
945 static Mutex* signal_mutex = new Mutex(); 964 static Mutex* signal_mutex = new Mutex();
946 965
947 966
948 SignalInfo::~SignalInfo() { 967 SignalInfo::~SignalInfo() {
949 FileHandle* file_handle = reinterpret_cast<FileHandle*>(fd_); 968 FileHandle* file_handle = reinterpret_cast<FileHandle*>(fd_);
950 file_handle->Close(); 969 file_handle->Close();
951 file_handle->Release(); 970 file_handle->Release();
952 } 971 }
953 972
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 } 1070 }
1052 delete handler; 1071 delete handler;
1053 } 1072 }
1054 1073
1055 } // namespace bin 1074 } // namespace bin
1056 } // namespace dart 1075 } // namespace dart
1057 1076
1058 #endif // defined(HOST_OS_WINDOWS) 1077 #endif // defined(HOST_OS_WINDOWS)
1059 1078
1060 #endif // !defined(DART_IO_DISABLED) 1079 #endif // !defined(DART_IO_DISABLED)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698