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

Side by Side Diff: src/api.cc

Issue 10961042: Implement committed physical memory stats for Linux. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix formatting. Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4288 matching lines...) Expand 10 before | Expand all | Expand 10 after
4299 "Use v8::Isolate::Dispose() for a non-default isolate.")) { 4299 "Use v8::Isolate::Dispose() for a non-default isolate.")) {
4300 return false; 4300 return false;
4301 } 4301 }
4302 i::V8::TearDown(); 4302 i::V8::TearDown();
4303 return true; 4303 return true;
4304 } 4304 }
4305 4305
4306 4306
4307 HeapStatistics::HeapStatistics(): total_heap_size_(0), 4307 HeapStatistics::HeapStatistics(): total_heap_size_(0),
4308 total_heap_size_executable_(0), 4308 total_heap_size_executable_(0),
4309 committed_physical_size_(0),
4309 used_heap_size_(0), 4310 used_heap_size_(0),
4310 heap_size_limit_(0) { } 4311 heap_size_limit_(0) { }
4311 4312
4312 4313
4313 void v8::V8::GetHeapStatistics(HeapStatistics* heap_statistics) { 4314 void v8::V8::GetHeapStatistics(HeapStatistics* heap_statistics) {
4314 if (!i::Isolate::Current()->IsInitialized()) { 4315 if (!i::Isolate::Current()->IsInitialized()) {
4315 // Isolate is unitialized thus heap is not configured yet. 4316 // Isolate is unitialized thus heap is not configured yet.
4316 heap_statistics->set_total_heap_size(0); 4317 heap_statistics->set_total_heap_size(0);
4317 heap_statistics->set_total_heap_size_executable(0); 4318 heap_statistics->set_total_heap_size_executable(0);
4319 heap_statistics->set_committed_physical_size(0);
4318 heap_statistics->set_used_heap_size(0); 4320 heap_statistics->set_used_heap_size(0);
4319 heap_statistics->set_heap_size_limit(0); 4321 heap_statistics->set_heap_size_limit(0);
4320 return; 4322 return;
4321 } 4323 }
4322 4324
4323 i::Heap* heap = i::Isolate::Current()->heap(); 4325 i::Heap* heap = i::Isolate::Current()->heap();
4324 heap_statistics->set_total_heap_size(heap->CommittedMemory()); 4326 heap_statistics->set_total_heap_size(heap->CommittedMemory());
4325 heap_statistics->set_total_heap_size_executable( 4327 heap_statistics->set_total_heap_size_executable(
4326 heap->CommittedMemoryExecutable()); 4328 heap->CommittedMemoryExecutable());
4329 heap_statistics->set_committed_physical_size(heap->CommittedPhysicalMemory());
4327 heap_statistics->set_used_heap_size(heap->SizeOfObjects()); 4330 heap_statistics->set_used_heap_size(heap->SizeOfObjects());
4328 heap_statistics->set_heap_size_limit(heap->MaxReserved()); 4331 heap_statistics->set_heap_size_limit(heap->MaxReserved());
4329 } 4332 }
4330 4333
4331 4334
4332 void v8::V8::VisitExternalResources(ExternalResourceVisitor* visitor) { 4335 void v8::V8::VisitExternalResources(ExternalResourceVisitor* visitor) {
4333 i::Isolate* isolate = i::Isolate::Current(); 4336 i::Isolate* isolate = i::Isolate::Current();
4334 IsDeadCheck(isolate, "v8::V8::VisitExternalResources"); 4337 IsDeadCheck(isolate, "v8::V8::VisitExternalResources");
4335 isolate->heap()->VisitExternalResources(visitor); 4338 isolate->heap()->VisitExternalResources(visitor);
4336 } 4339 }
(...skipping 2253 matching lines...) Expand 10 before | Expand all | Expand 10 after
6590 6593
6591 v->VisitPointers(blocks_.first(), first_block_limit_); 6594 v->VisitPointers(blocks_.first(), first_block_limit_);
6592 6595
6593 for (int i = 1; i < blocks_.length(); i++) { 6596 for (int i = 1; i < blocks_.length(); i++) {
6594 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 6597 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
6595 } 6598 }
6596 } 6599 }
6597 6600
6598 6601
6599 } } // namespace v8::internal 6602 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698