| OLD | NEW |
| 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 #include "vm/class_table.h" | 5 #include "vm/class_table.h" |
| 6 #include "vm/flags.h" | 6 #include "vm/flags.h" |
| 7 #include "vm/freelist.h" | 7 #include "vm/freelist.h" |
| 8 #include "vm/heap.h" | 8 #include "vm/heap.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/raw_object.h" | 10 #include "vm/raw_object.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // Accumulate allocations. | 214 // Accumulate allocations. |
| 215 accumulated.old_count += recent.old_count - last_reset.old_count; | 215 accumulated.old_count += recent.old_count - last_reset.old_count; |
| 216 accumulated.old_size += recent.old_size - last_reset.old_size; | 216 accumulated.old_size += recent.old_size - last_reset.old_size; |
| 217 last_reset.ResetOld(); | 217 last_reset.ResetOld(); |
| 218 post_gc.ResetOld(); | 218 post_gc.ResetOld(); |
| 219 recent.ResetOld(); | 219 recent.ResetOld(); |
| 220 } | 220 } |
| 221 | 221 |
| 222 | 222 |
| 223 void ClassHeapStats::UpdateSize(intptr_t instance_size) { | 223 void ClassHeapStats::UpdateSize(intptr_t instance_size) { |
| 224 ASSERT(instance_size > 0); | 224 pre_gc.UpdateSize(instance_size); |
| 225 // For classes with fixed instance size we do not emit code to update | 225 post_gc.UpdateSize(instance_size); |
| 226 // the size statistics. Update them here. | 226 recent.UpdateSize(instance_size); |
| 227 pre_gc.old_size = pre_gc.old_count * instance_size; | 227 accumulated.UpdateSize(instance_size); |
| 228 pre_gc.new_size = pre_gc.new_count * instance_size; | 228 last_reset.UpdateSize(instance_size); |
| 229 post_gc.old_size = post_gc.old_count * instance_size; | |
| 230 post_gc.new_size = post_gc.new_count * instance_size; | |
| 231 recent.new_size = recent.new_count * instance_size; | |
| 232 recent.old_size = recent.old_count * instance_size; | |
| 233 } | 229 } |
| 234 | 230 |
| 235 | 231 |
| 236 void ClassHeapStats::ResetAccumulator() { | 232 void ClassHeapStats::ResetAccumulator() { |
| 237 // Remember how much was allocated so we can subtract this from the result | 233 // Remember how much was allocated so we can subtract this from the result |
| 238 // when printing. | 234 // when printing. |
| 239 last_reset.new_count = recent.new_count; | 235 last_reset.new_count = recent.new_count; |
| 240 last_reset.new_size = recent.new_size; | 236 last_reset.new_size = recent.new_size; |
| 241 last_reset.old_count = recent.old_count; | 237 last_reset.old_count = recent.old_count; |
| 242 last_reset.old_size = recent.old_size; | 238 last_reset.old_size = recent.old_size; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 | 426 |
| 431 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { | 427 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { |
| 432 ClassHeapStats* stats = StatsAt(cid); | 428 ClassHeapStats* stats = StatsAt(cid); |
| 433 ASSERT(stats != NULL); | 429 ASSERT(stats != NULL); |
| 434 ASSERT(size >= 0); | 430 ASSERT(size >= 0); |
| 435 stats->post_gc.AddNew(size); | 431 stats->post_gc.AddNew(size); |
| 436 } | 432 } |
| 437 | 433 |
| 438 | 434 |
| 439 } // namespace dart | 435 } // namespace dart |
| OLD | NEW |