summaryrefslogtreecommitdiffstats
path: root/runtime/hprof/hprof.cc
diff options
context:
space:
mode:
authorHiroshi Yamauchi <yamauchi@google.com>2015-01-09 14:03:35 -0800
committerHiroshi Yamauchi <yamauchi@google.com>2015-01-23 14:07:32 -0800
commit2cd334ae2d4287216523882f0d298cf3901b7ab1 (patch)
treeb72d3d07e5a04151caca96cae345075b6e4452b0 /runtime/hprof/hprof.cc
parent604e2828896fbb8663897d1e75112da7305ead4c (diff)
downloadandroid_art-2cd334ae2d4287216523882f0d298cf3901b7ab1.tar.gz
android_art-2cd334ae2d4287216523882f0d298cf3901b7ab1.tar.bz2
android_art-2cd334ae2d4287216523882f0d298cf3901b7ab1.zip
More of the concurrent copying collector.
Bug: 12687968 Change-Id: I62f70274d47df6d6cab714df95c518b750ce3105
Diffstat (limited to 'runtime/hprof/hprof.cc')
-rw-r--r--runtime/hprof/hprof.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc
index 0b04276a83..d2e93bc14c 100644
--- a/runtime/hprof/hprof.cc
+++ b/runtime/hprof/hprof.cc
@@ -507,7 +507,7 @@ class Hprof {
Env env = { this, output };
runtime->VisitRoots(RootVisitor, &env);
- runtime->GetHeap()->VisitObjects(VisitObjectCallback, &env);
+ runtime->GetHeap()->VisitObjectsPaused(VisitObjectCallback, &env);
output->StartNewRecord(HPROF_TAG_HEAP_DUMP_END, kHprofTime);
output->EndRecord();
@@ -1151,10 +1151,20 @@ void Hprof::VisitRoot(const mirror::Object* obj, const RootInfo& info, EndianOut
void DumpHeap(const char* filename, int fd, bool direct_to_ddms) {
CHECK(filename != nullptr);
+ Thread* self = Thread::Current();
+ gc::Heap* heap = Runtime::Current()->GetHeap();
+ if (heap->IsGcConcurrentAndMoving()) {
+ // Need to take a heap dump while GC isn't running. See the
+ // comment in Heap::VisitObjects().
+ heap->IncrementDisableMovingGC(self);
+ }
Runtime::Current()->GetThreadList()->SuspendAll();
Hprof hprof(filename, fd, direct_to_ddms);
hprof.Dump();
Runtime::Current()->GetThreadList()->ResumeAll();
+ if (heap->IsGcConcurrentAndMoving()) {
+ heap->DecrementDisableMovingGC(self);
+ }
}
} // namespace hprof