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

Side by Side Diff: runtime/bin/process.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "bin/process.h" 7 #include "bin/process.h"
8 8
9 #include "bin/dartutils.h" 9 #include "bin/dartutils.h"
10 #include "bin/io_buffer.h" 10 #include "bin/io_buffer.h"
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 DartUtils::NewInternalError("StringToSystemEncoding failed")); 359 DartUtils::NewInternalError("StringToSystemEncoding failed"));
360 } 360 }
361 uint8_t* buffer = NULL; 361 uint8_t* buffer = NULL;
362 Dart_Handle external_array = IOBuffer::Allocate(system_len, &buffer); 362 Dart_Handle external_array = IOBuffer::Allocate(system_len, &buffer);
363 if (!Dart_IsError(external_array)) { 363 if (!Dart_IsError(external_array)) {
364 memmove(buffer, system_string, system_len); 364 memmove(buffer, system_string, system_len);
365 } 365 }
366 Dart_SetReturnValue(args, external_array); 366 Dart_SetReturnValue(args, external_array);
367 } 367 }
368 368
369
370 void FUNCTION_NAME(ProcessInfo_CurrentRSS)(Dart_NativeArguments args) {
371 int64_t current_rss = Process::CurrentRSS();
372 if (current_rss < 0) {
373 Dart_SetReturnValue(args, DartUtils::NewDartOSError());
374 return;
375 }
376 Dart_SetIntegerReturnValue(args, current_rss);
377 }
378
379
380 void FUNCTION_NAME(ProcessInfo_MaxRSS)(Dart_NativeArguments args) {
381 int64_t max_rss = Process::MaxRSS();
382 if (max_rss < 0) {
383 Dart_SetReturnValue(args, DartUtils::NewDartOSError());
384 return;
385 }
386 Dart_SetIntegerReturnValue(args, max_rss);
387 }
388
369 } // namespace bin 389 } // namespace bin
370 } // namespace dart 390 } // namespace dart
371 391
372 #endif // !defined(DART_IO_DISABLED) 392 #endif // !defined(DART_IO_DISABLED)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698