 Chromium Code Reviews
 Chromium Code Reviews Issue 2379823004:
  [Tracing] Integrate GC object statistics with tracing.  (Closed)
    
  
    Issue 2379823004:
  [Tracing] Integrate GC object statistics with tracing.  (Closed) 
  | OLD | NEW | 
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "src/heap/mark-compact.h" | 5 #include "src/heap/mark-compact.h" | 
| 6 | 6 | 
| 7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" | 
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" | 
| 9 #include "src/base/sys-info.h" | 9 #include "src/base/sys-info.h" | 
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" | 
| (...skipping 2224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2235 while (space_it.has_next()) { | 2235 while (space_it.has_next()) { | 
| 2236 std::unique_ptr<ObjectIterator> it(space_it.next()->GetObjectIterator()); | 2236 std::unique_ptr<ObjectIterator> it(space_it.next()->GetObjectIterator()); | 
| 2237 ObjectIterator* obj_it = it.get(); | 2237 ObjectIterator* obj_it = it.get(); | 
| 2238 while ((obj = obj_it->Next()) != nullptr) { | 2238 while ((obj = obj_it->Next()) != nullptr) { | 
| 2239 visitor->Visit(obj); | 2239 visitor->Visit(obj); | 
| 2240 } | 2240 } | 
| 2241 } | 2241 } | 
| 2242 } | 2242 } | 
| 2243 | 2243 | 
| 2244 void MarkCompactCollector::RecordObjectStats() { | 2244 void MarkCompactCollector::RecordObjectStats() { | 
| 2245 if (FLAG_track_gc_object_stats) { | 2245 if (FLAG_track_gc_object_stats) { | 
| 
ssid
2016/09/29 21:45:31
I thought you wanted to enable this flag when trac
 
lpy
2016/09/29 22:45:42
currently I don't think we can do that, but my pla
 
fmeawad
2016/09/30 00:44:05
Add a comment in the CL description that to test t
 
lpy
2016/09/30 18:21:58
Done.
 | |
| 2246 ObjectStatsVisitor visitor(heap(), heap()->live_object_stats_, | 2246 ObjectStatsVisitor visitor(heap(), heap()->live_object_stats_, | 
| 2247 heap()->dead_object_stats_); | 2247 heap()->dead_object_stats_); | 
| 2248 VisitAllObjects(&visitor); | 2248 VisitAllObjects(&visitor); | 
| 2249 std::stringstream live, dead; | |
| 2250 heap()->live_object_stats_->Dump(live); | |
| 2251 heap()->dead_object_stats_->Dump(dead); | |
| 2252 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("v8.gc_stats"), | |
| 
ssid
2016/09/29 21:45:31
Do we really need a new category? can we just use
 
lpy
2016/09/29 22:45:42
We can use v8.gc, but, v8.gc will add a bunch of o
 
fmeawad
2016/09/30 00:44:05
I think gc_stats is fine.
But I wonder if TRACE_EV
 
lpy
2016/09/30 18:21:58
Acknowledged.
 | |
| 2253 "V8.GC_Objects_Stats", TRACE_EVENT_SCOPE_THREAD, | |
| 2254 "live", TRACE_STR_COPY(live.str().c_str()), "dead", | |
| 2255 TRACE_STR_COPY(dead.str().c_str())); | |
| 2249 if (FLAG_trace_gc_object_stats) { | 2256 if (FLAG_trace_gc_object_stats) { | 
| 2250 heap()->live_object_stats_->PrintJSON("live"); | 2257 heap()->live_object_stats_->PrintJSON("live"); | 
| 2251 heap()->dead_object_stats_->PrintJSON("dead"); | 2258 heap()->dead_object_stats_->PrintJSON("dead"); | 
| 2252 } | 2259 } | 
| 2253 heap()->live_object_stats_->CheckpointObjectStats(); | 2260 heap()->live_object_stats_->CheckpointObjectStats(); | 
| 2254 heap()->dead_object_stats_->ClearObjectStats(); | 2261 heap()->dead_object_stats_->ClearObjectStats(); | 
| 2255 } | 2262 } | 
| 2256 } | 2263 } | 
| 2257 | 2264 | 
| 2258 void MarkCompactCollector::MarkLiveObjects() { | 2265 void MarkCompactCollector::MarkLiveObjects() { | 
| (...skipping 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3998 // The target is always in old space, we don't have to record the slot in | 4005 // The target is always in old space, we don't have to record the slot in | 
| 3999 // the old-to-new remembered set. | 4006 // the old-to-new remembered set. | 
| 4000 DCHECK(!heap()->InNewSpace(target)); | 4007 DCHECK(!heap()->InNewSpace(target)); | 
| 4001 RecordRelocSlot(host, &rinfo, target); | 4008 RecordRelocSlot(host, &rinfo, target); | 
| 4002 } | 4009 } | 
| 4003 } | 4010 } | 
| 4004 } | 4011 } | 
| 4005 | 4012 | 
| 4006 } // namespace internal | 4013 } // namespace internal | 
| 4007 } // namespace v8 | 4014 } // namespace v8 | 
| OLD | NEW |