1772 void VM_HeapDumper::doit() {
1773
1774 CollectedHeap* ch = Universe::heap();
1775
1776 ch->ensure_parsability(false); // must happen, even if collection does
1777 // not happen (e.g. due to GCLocker)
1778
1779 if (_gc_before_heap_dump) {
1780 if (GCLocker::is_active()) {
1781 warning("GC locker is held; pre-heapdump GC was skipped");
1782 } else {
1783 ch->collect_as_vm_thread(GCCause::_heap_dump);
1784 }
1785 }
1786
1787 // At this point we should be the only dumper active, so
1788 // the following should be safe.
1789 set_global_dumper();
1790 set_global_writer();
1791
1792 WorkGang* gang = ch->get_safepoint_workers();
1793
1794 if (gang == NULL) {
1795 work(0);
1796 } else {
1797 gang->run_task(this, gang->active_workers(), true);
1798 }
1799
1800 // Now we clear the global variables, so that a future dumper can run.
1801 clear_global_dumper();
1802 clear_global_writer();
1803 }
1804
1805 void VM_HeapDumper::work(uint worker_id) {
1806 if (!Thread::current()->is_VM_thread()) {
1807 writer()->writer_loop();
1808 return;
1809 }
1810
1811 // Write the file header - we always use 1.0.2
1812 const char* header = "JAVA PROFILE 1.0.2";
|
1772 void VM_HeapDumper::doit() {
1773
1774 CollectedHeap* ch = Universe::heap();
1775
1776 ch->ensure_parsability(false); // must happen, even if collection does
1777 // not happen (e.g. due to GCLocker)
1778
1779 if (_gc_before_heap_dump) {
1780 if (GCLocker::is_active()) {
1781 warning("GC locker is held; pre-heapdump GC was skipped");
1782 } else {
1783 ch->collect_as_vm_thread(GCCause::_heap_dump);
1784 }
1785 }
1786
1787 // At this point we should be the only dumper active, so
1788 // the following should be safe.
1789 set_global_dumper();
1790 set_global_writer();
1791
1792 WorkGang* gang = ch->safepoint_workers();
1793
1794 if (gang == NULL) {
1795 work(0);
1796 } else {
1797 gang->run_task(this, gang->active_workers(), true);
1798 }
1799
1800 // Now we clear the global variables, so that a future dumper can run.
1801 clear_global_dumper();
1802 clear_global_writer();
1803 }
1804
1805 void VM_HeapDumper::work(uint worker_id) {
1806 if (!Thread::current()->is_VM_thread()) {
1807 writer()->writer_loop();
1808 return;
1809 }
1810
1811 // Write the file header - we always use 1.0.2
1812 const char* header = "JAVA PROFILE 1.0.2";
|