@Test public void singleRun() { TestMemory mem = new TestMemory(); mem.setLimit(16 << 10); for(int i = 0; i != 16; ++i) { verify(mem, i << 10, 1 << 10); } System.out.println(mem.getFaultCount()); }
public void setLimit(long vsize) { eof = vsize; int n = (int) (vsize >> pageBits); if (n >= bufferMap.length) { int nsize = Math.max(n + 1, (3 * bufferMap.length) / 4); bufferMap = Arrays.copyOf(bufferMap, nsize); hitCounts = Arrays.copyOf(hitCounts, nsize); pageMap = Arrays.copyOf(pageMap, nsize); } }
PagedVirtualMemory { public void setLimit(long vsize) { eof = vsize; int n = (int) (vsize >> pageBits); if (n >= bufferMap.length) { int nsize = Math.max(n + 1, (3 * bufferMap.length) / 4); bufferMap = Arrays.copyOf(bufferMap, nsize); hitCounts = Arrays.copyOf(hitCounts, nsize); pageMap = Arrays.copyOf(pageMap, nsize); } } }
PagedVirtualMemory { public void setLimit(long vsize) { eof = vsize; int n = (int) (vsize >> pageBits); if (n >= bufferMap.length) { int nsize = Math.max(n + 1, (3 * bufferMap.length) / 4); bufferMap = Arrays.copyOf(bufferMap, nsize); hitCounts = Arrays.copyOf(hitCounts, nsize); pageMap = Arrays.copyOf(pageMap, nsize); } } PagedVirtualMemory(PagePool pagePool); }
PagedVirtualMemory { public void setLimit(long vsize) { eof = vsize; int n = (int) (vsize >> pageBits); if (n >= bufferMap.length) { int nsize = Math.max(n + 1, (3 * bufferMap.length) / 4); bufferMap = Arrays.copyOf(bufferMap, nsize); hitCounts = Arrays.copyOf(hitCounts, nsize); pageMap = Arrays.copyOf(pageMap, nsize); } } PagedVirtualMemory(PagePool pagePool); void setLimit(long vsize); char readChar(long index); double readDouble(long index); float readFloat(long index); int readInt(long index); long readLong(long index); short readShort(long index); byte readByte(long index); void readBytes(long position, byte[] chars); }
PagedVirtualMemory { public void setLimit(long vsize) { eof = vsize; int n = (int) (vsize >> pageBits); if (n >= bufferMap.length) { int nsize = Math.max(n + 1, (3 * bufferMap.length) / 4); bufferMap = Arrays.copyOf(bufferMap, nsize); hitCounts = Arrays.copyOf(hitCounts, nsize); pageMap = Arrays.copyOf(pageMap, nsize); } } PagedVirtualMemory(PagePool pagePool); void setLimit(long vsize); char readChar(long index); double readDouble(long index); float readFloat(long index); int readInt(long index); long readLong(long index); short readShort(long index); byte readByte(long index); void readBytes(long position, byte[] chars);  }