Chromium Code Reviews| Index: runtime/vm/heap.cc |
| diff --git a/runtime/vm/heap.cc b/runtime/vm/heap.cc |
| index ef4e14cbe5d21520d732074f25da7c7a9fa3b4de..5535d930748dfdc6f81bd6c86f5fdab54dea0a2a 100644 |
| --- a/runtime/vm/heap.cc |
| +++ b/runtime/vm/heap.cc |
| @@ -381,6 +381,7 @@ void Heap::CollectNewSpaceGarbage(Thread* thread, |
| UpdatePretenurePolicy(); |
| RecordAfterGC(kNew); |
| PrintStats(); |
| + NOT_IN_PRODUCT(PrintStatsToTimeline(&tds)); |
| EndNewSpaceGC(); |
| if ((reason == kNewSpace) && old_space_.NeedsGarbageCollection()) { |
| // Old collections should call the API callbacks. |
| @@ -403,6 +404,7 @@ void Heap::CollectOldSpaceGarbage(Thread* thread, |
| old_space_.MarkSweep(invoke_api_callbacks); |
| RecordAfterGC(kOld); |
| PrintStats(); |
| + NOT_IN_PRODUCT(PrintStatsToTimeline(&tds)); |
| EndOldSpaceGC(); |
| } |
| } |
| @@ -834,6 +836,64 @@ void Heap::PrintStats() { |
| } |
| +void Heap::PrintStatsToTimeline(TimelineEventScope* event) { |
| + if ((event == NULL) || !event->enabled()) { |
| + return; |
| + } |
| + event->SetNumArguments(12); |
| + event->FormatArgument(0, |
| + "Before.New.Used", |
| + "%" Pd "", |
|
rmacnak
2016/05/09 19:32:17
It's hard to figure out the units just from lookin
Ivan Posva
2016/05/09 19:39:58
I guess another option is to put the unit on the n
Cutch
2016/05/09 20:45:01
Done.
|
| + RoundWordsToKB(stats_.before_.new_.used_in_words)); |
| + event->FormatArgument(1, |
| + "After.New.Used", |
| + "%" Pd "", |
| + RoundWordsToKB(stats_.after_.new_.used_in_words)); |
| + event->FormatArgument(2, |
| + "Before.Old.Used", |
| + "%" Pd "", |
| + RoundWordsToKB(stats_.before_.old_.used_in_words)); |
| + event->FormatArgument(3, |
| + "After.Old.Used", |
| + "%" Pd "", |
| + RoundWordsToKB(stats_.after_.old_.used_in_words)); |
| + |
| + event->FormatArgument(4, |
| + "Before.New.Capacity", |
| + "%" Pd "", |
| + RoundWordsToKB(stats_.before_.new_.capacity_in_words)); |
| + event->FormatArgument(5, |
| + "After.New.Capacity", |
| + "%" Pd "", |
| + RoundWordsToKB(stats_.after_.new_.capacity_in_words)); |
| + event->FormatArgument(6, |
| + "Before.Old.Capacity", |
| + "%" Pd "", |
| + RoundWordsToKB(stats_.before_.old_.capacity_in_words)); |
| + event->FormatArgument(7, |
| + "After.Old.Capacity", |
| + "%" Pd "", |
| + RoundWordsToKB(stats_.after_.old_.capacity_in_words)); |
| + |
| + event->FormatArgument(8, |
| + "Before.New.External", |
| + "%" Pd "", |
| + RoundWordsToKB(stats_.before_.new_.external_in_words)); |
| + event->FormatArgument(9, |
| + "After.New.External", |
| + "%" Pd "", |
| + RoundWordsToKB(stats_.after_.new_.external_in_words)); |
| + event->FormatArgument(10, |
| + "Before.Old.External", |
| + "%" Pd "", |
| + RoundWordsToKB(stats_.before_.old_.external_in_words)); |
| + event->FormatArgument(11, |
| + "After.Old.External", |
| + "%" Pd "", |
| + RoundWordsToKB(stats_.after_.old_.external_in_words)); |
|
Ivan Posva
2016/05/09 19:39:58
I would also like to add the times_ values, but th
Cutch
2016/05/09 20:45:01
Acknowledged.
|
| +} |
| + |
| + |
| NoHeapGrowthControlScope::NoHeapGrowthControlScope() |
| : StackResource(Thread::Current()) { |
| Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); |