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

Side by Side Diff: src/heap.cc

Issue 155764: Heap profiling: add logging of heap memory stats (capacity, used) under 'log-gc' flag. (Closed)
Patch Set: Created 11 years, 5 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
« no previous file with comments | « no previous file | src/log.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 3388 matching lines...) Expand 10 before | Expand all | Expand 10 after
3399 ASSERT(0 <= type && type <= LAST_TYPE); 3399 ASSERT(0 <= type && type <= LAST_TYPE);
3400 info[type].increment_number(1); 3400 info[type].increment_number(1);
3401 info[type].increment_bytes(obj->Size()); 3401 info[type].increment_bytes(obj->Size());
3402 } 3402 }
3403 #endif 3403 #endif
3404 3404
3405 3405
3406 #ifdef ENABLE_LOGGING_AND_PROFILING 3406 #ifdef ENABLE_LOGGING_AND_PROFILING
3407 void HeapProfiler::WriteSample() { 3407 void HeapProfiler::WriteSample() {
3408 LOG(HeapSampleBeginEvent("Heap", "allocated")); 3408 LOG(HeapSampleBeginEvent("Heap", "allocated"));
3409 LOG(HeapSampleStats(
3410 "Heap", "allocated", Heap::Capacity(), Heap::SizeOfObjects()));
3409 3411
3410 HistogramInfo info[LAST_TYPE+1]; 3412 HistogramInfo info[LAST_TYPE+1];
3411 #define DEF_TYPE_NAME(name) info[name].set_name(#name); 3413 #define DEF_TYPE_NAME(name) info[name].set_name(#name);
3412 INSTANCE_TYPE_LIST(DEF_TYPE_NAME) 3414 INSTANCE_TYPE_LIST(DEF_TYPE_NAME)
3413 #undef DEF_TYPE_NAME 3415 #undef DEF_TYPE_NAME
3414 3416
3415 HeapIterator iterator; 3417 HeapIterator iterator;
3416 while (iterator.has_next()) { 3418 while (iterator.has_next()) {
3417 CollectStats(iterator.next(), info); 3419 CollectStats(iterator.next(), info);
3418 } 3420 }
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
3715 #ifdef DEBUG 3717 #ifdef DEBUG
3716 bool Heap::GarbageCollectionGreedyCheck() { 3718 bool Heap::GarbageCollectionGreedyCheck() {
3717 ASSERT(FLAG_gc_greedy); 3719 ASSERT(FLAG_gc_greedy);
3718 if (Bootstrapper::IsActive()) return true; 3720 if (Bootstrapper::IsActive()) return true;
3719 if (disallow_allocation_failure()) return true; 3721 if (disallow_allocation_failure()) return true;
3720 return CollectGarbage(0, NEW_SPACE); 3722 return CollectGarbage(0, NEW_SPACE);
3721 } 3723 }
3722 #endif 3724 #endif
3723 3725
3724 } } // namespace v8::internal 3726 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698