From: <mar...@us...> - 2010-09-08 14:46:46
|
Revision: 3517 http://bigdata.svn.sourceforge.net/bigdata/?rev=3517&view=rev Author: martyncutcher Date: 2010-09-08 14:46:40 +0000 (Wed, 08 Sep 2010) Log Message: ----------- add allocation stats output for debug Modified Paths: -------------- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/AllocBlock.java branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/FixedAllocator.java branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/AllocBlock.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/AllocBlock.java 2010-09-08 13:27:18 UTC (rev 3516) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/AllocBlock.java 2010-09-08 14:46:40 UTC (rev 3517) @@ -193,7 +193,7 @@ final int total = m_ints * 32; final int allocBits = getAllocBits(); - return "Addr : " + m_addr + " [" + allocBits + "::" + total + "]"; + return " - start addr : " + RWStore.convertAddr(m_addr) + " [" + allocBits + "::" + total + "]"; } public void addAddresses(final ArrayList addrs, final int rootAddr) { Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/FixedAllocator.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/FixedAllocator.java 2010-09-08 13:27:18 UTC (rev 3516) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/FixedAllocator.java 2010-09-08 14:46:40 UTC (rev 3517) @@ -490,7 +490,18 @@ } public void appendShortStats(StringBuffer str) { - str.append("Index: " + m_index + ", address: " + getStartAddr() + ", " + m_size + "\n"); + str.append("Index: " + m_index + ", " + m_size); + + Iterator<AllocBlock> blocks = m_allocBlocks.iterator(); + while (blocks.hasNext()) { + AllocBlock block = blocks.next(); + if (block.m_addr != 0) { + str.append(block.getStats()); + } else { + break; + } + } + str.append("\n"); } public int getAllocatedBlocks() { Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java 2010-09-08 13:27:18 UTC (rev 3516) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java 2010-09-08 14:46:40 UTC (rev 3517) @@ -713,6 +713,9 @@ protected void readAllocationBlocks() throws IOException { assert m_allocs.size() == 0; + + System.out.println("readAllocationBlocks, m_metaBits.length: " + + m_metaBits.length); /** * Allocators are sorted in StartAddress order (which MUST be the order @@ -721,7 +724,8 @@ * the metaAllocation if two allocation blocks were loaded for the same * address (must be two version of same Allocator). * - * Meta-Allocations stored as {int address; int[8] bits} + * Meta-Allocations stored as {int address; int[8] bits}, so each block + * holds 8*32=256 allocation slots of 1K totalling 256K. */ for (int b = 0; b < m_metaBits.length; b += 9) { long blockStart = convertAddr(m_metaBits[b]); @@ -772,6 +776,13 @@ for (int index = 0; index < m_allocs.size(); index++) { ((Allocator) m_allocs.get(index)).setIndex(index); } + + if (false) { + StringBuffer tmp = new StringBuffer(); + showAllocators(tmp); + + System.out.println("Allocators: " + tmp.toString()); + } } /** @@ -1997,9 +2008,10 @@ static boolean tstBit(int[] bits, int bitnum) { int index = bitnum / 32; int bit = bitnum % 32; - + if (index >= bits.length) - throw new IllegalArgumentException(); + throw new IllegalArgumentException("Accessing bit index: " + index + + " of array length: " + bits.length); return (bits[(int) index] & 1 << bit) != 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |