< prev index next >
src/hotspot/share/gc/z/zHeap.cpp
Print this page
@@ -33,20 +33,22 @@
#include "gc/z/zRelocationSet.inline.hpp"
#include "gc/z/zRelocationSetSelector.inline.hpp"
#include "gc/z/zResurrection.hpp"
#include "gc/z/zStat.hpp"
#include "gc/z/zThread.inline.hpp"
+#include "gc/z/zTask.hpp"
#include "gc/z/zVerify.hpp"
#include "gc/z/zWorkers.inline.hpp"
#include "logging/log.hpp"
#include "memory/iterator.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/handshake.hpp"
#include "runtime/safepoint.hpp"
#include "runtime/thread.hpp"
#include "utilities/debug.hpp"
+class ZTask;
static const ZStatSampler ZSamplerHeapUsedBeforeMark("Memory", "Heap Used Before Mark", ZStatUnitBytes);
static const ZStatSampler ZSamplerHeapUsedAfterMark("Memory", "Heap Used After Mark", ZStatUnitBytes);
static const ZStatSampler ZSamplerHeapUsedBeforeRelocation("Memory", "Heap Used Before Relocation", ZStatUnitBytes);
static const ZStatSampler ZSamplerHeapUsedAfterRelocation("Memory", "Heap Used After Relocation", ZStatUnitBytes);
static const ZStatCounter ZCounterUndoPageAllocation("Memory", "Undo Page Allocation", ZStatUnitOpsPerSecond);
@@ -204,10 +206,32 @@
void ZHeap::print_worker_threads_on(outputStream* st) const {
_workers.print_threads_on(st);
}
+// A delegate class for AbstractGangTask to Ztask.
+class DelegatedZAbstractGangTask : public ZTask {
+ private:
+ AbstractGangTask* _task;
+
+ public:
+ DelegatedZAbstractGangTask(AbstractGangTask* task) :
+ ZTask(task->name()),
+ _task(task) { }
+
+ virtual void work() {
+ _task->work(ZThread::worker_id());
+ }
+};
+
+Tickspan ZHeap::run_task(AbstractGangTask* task) {
+ Ticks start = Ticks::now();
+ DelegatedZAbstractGangTask dtask(task);
+ _workers.run_parallel(&dtask);
+ return Ticks::now() - start;
+}
+
void ZHeap::out_of_memory() {
ResourceMark rm;
ZStatInc(ZCounterOutOfMemory);
log_info(gc)("Out Of Memory (%s)", Thread::current()->name());
< prev index next >