Commit b6f52210 authored by Yi Lin's avatar Yi Lin

running mutator time exp on this revision

parent b32e0068
......@@ -2145,7 +2145,6 @@ public final class RVMThread extends ThreadContext {
result = TERMINATED;
} else {
turnOnYieldpoints();
takeYieldpoint = 1;
// CAS the execStatus field
int newState = setBlockedExecStatus();
result = newState;
......@@ -3790,15 +3789,10 @@ public final class RVMThread extends ThreadContext {
@NoCheckStore
@Unpreemptible
public static void blockAllMutatorsForGC() {
YieldpointStatistics.mutatorTimeWithoutBlockingCost += (sysCall.sysCurrentTimeMillis() - YieldpointStatistics.mutatorStartTimeMillis);
// request block - timestamp
YieldpointStatistics.gcRequestBlockTime = Magic.getTimeBase();
// yieldpoints turned on - timestamp
long turnOnLatency = (Magic.getTimeBase() - YieldpointStatistics.gcRequestBlockTime);
if (turnOnLatency < 0)
turnOnLatency = 0;
YieldpointStatistics.yieldpointTurnedOnLatency += turnOnLatency;
RVMThread.handshakeLock.lockNoHandshake();
while (true) {
// (1) Find all the threads that need to be blocked for GC
......@@ -3856,6 +3850,8 @@ public final class RVMThread extends ThreadContext {
@NoCheckStore
@Unpreemptible
public static void unblockAllMutatorsForGC() {
YieldpointStatistics.mutatorStartTimeMillis = sysCall.sysCurrentTimeMillis();
RVMThread.handshakeLock.lockNoHandshake();
RVMThread.acctLock.lockNoHandshake();
int numToHandshake = 0;
......@@ -5627,23 +5623,14 @@ public final class RVMThread extends ThreadContext {
public void turnOnYieldpoints() {
// VM.sysWriteln("Turn on yieldpoints");
if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_PAGE_PROTECTION_READ_YP ||
org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_PAGE_PROTECTION_WRITE_YP) {
Address pageAddr = Magic.objectAsAddress(this).plus(PROTECT_PAGE_OFFSET_BL).toWord().and(Word.fromIntZeroExtend(0xfffff000)).toAddress();
Memory.mprotect(pageAddr, PROTECT_PAGE_SIZE, Memory.PROT_NONE);
} else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_YP) {
CompiledMethods.setNOP2INT();
}
}
public void turnOffYieldpoints() {
// VM.sysWriteln("Turn off yieldpoints");
if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_PAGE_PROTECTION_READ_YP ||
org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_PAGE_PROTECTION_WRITE_YP) {
Address pageAddr = Magic.objectAsAddress(this).plus(PROTECT_PAGE_OFFSET_BL).toWord().and(Word.fromIntZeroExtend(0xfffff000)).toAddress();
Memory.mprotect(pageAddr, PROTECT_PAGE_SIZE, Memory.PROT_EXEC | Memory.PROT_READ | Memory.PROT_WRITE);
} else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_YP) {
CompiledMethods.setINT2NOP();
}
// takeYieldpoint = 1;
//
// if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_PAGE_PROTECTION_READ_YP ||
// org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_PAGE_PROTECTION_WRITE_YP) {
// Address pageAddr = Magic.objectAsAddress(this).plus(PROTECT_PAGE_OFFSET_BL).toWord().and(Word.fromIntZeroExtend(0xfffff000)).toAddress();
// Memory.mprotect(pageAddr, PROTECT_PAGE_SIZE, Memory.PROT_NONE);
// } else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_YP) {
// CompiledMethods.setNOP2INT();
// }
}
}
......@@ -2,6 +2,9 @@ package org.jikesrvm.scheduler;
import org.jikesrvm.VM;
import org.jikesrvm.mm.mmtk.SynchronizedCounter;
import org.jikesrvm.runtime.SysCall;
import org.mmtk.utility.statistics.LongCounter;
import org.mmtk.utility.statistics.Timer;
import org.vmmagic.pragma.Inline;
import org.vmmagic.pragma.Interruptible;
import org.vmmagic.pragma.Uninterruptible;
......@@ -12,19 +15,23 @@ public class YieldpointStatistics {
public static SynchronizedCounter yieldpointTaken = new SynchronizedCounter();
public static long gcRequestBlockTime;
public static long resumeMutatorMillis;
public static long mutatorStartTimeMillis;
public static long yieldpointTurnedOnLatency = 0;
public static long allThreadBlockedLatency = 0;
public static long mutatorMillis = 0;
public static long mutatorTimeWithoutBlockingCost = 0;
@Interruptible
public static void reset() {
yieldpointTaken.reset();
gcRequestBlockTime = 0;
yieldpointTurnedOnLatency = 0;
allThreadBlockedLatency = 0;
mutatorTimeWithoutBlockingCost = 0;
mutatorStartTimeMillis = SysCall.sysCall.sysCurrentTimeMillis();
}
@Inline
......@@ -47,10 +54,12 @@ public class YieldpointStatistics {
printColumn("yieldpointTaken");
printColumn("yieldpointTurnedOnLatencySum");
printColumn("allThreadsBlockedLatencySum");
printColumn("mutatorTimeWithoutBlockingCost");
printNewLine();
printColumn(yieldpointTaken.peek());
printColumn(yieldpointTurnedOnLatency);
printColumn(allThreadBlockedLatency);
printColumn(mutatorTimeWithoutBlockingCost);
printNewLine();
VM.sysWriteln("------------------------------ End Tabulate Statistics -----------------------------");
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment