Attempted fix for broken TestHeapSize up on jenkins
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1138647 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7b6f6d6e19
commit
bf9654474c
@ -3592,9 +3592,11 @@ public class HRegion implements HeapSize { // , Writable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static final long FIXED_OVERHEAD = ClassSize.align(
|
public static final long FIXED_OVERHEAD = ClassSize.align(
|
||||||
(4 * Bytes.SIZEOF_LONG) + ClassSize.ARRAY +
|
ClassSize.OBJECT +
|
||||||
ClassSize.align(27 * ClassSize.REFERENCE) + ClassSize.OBJECT +
|
ClassSize.ARRAY +
|
||||||
ClassSize.align(Bytes.SIZEOF_INT));
|
ClassSize.align(27 * ClassSize.REFERENCE) +
|
||||||
|
(4 * Bytes.SIZEOF_LONG) +
|
||||||
|
Bytes.SIZEOF_BOOLEAN);
|
||||||
|
|
||||||
public static final long DEEP_OVERHEAD = FIXED_OVERHEAD +
|
public static final long DEEP_OVERHEAD = FIXED_OVERHEAD +
|
||||||
ClassSize.OBJECT + // closeLock
|
ClassSize.OBJECT + // closeLock
|
||||||
|
@ -185,12 +185,13 @@ public class ClassSize {
|
|||||||
int arrays = 0;
|
int arrays = 0;
|
||||||
//The number of references that a new object takes
|
//The number of references that a new object takes
|
||||||
int references = nrOfRefsPerObj;
|
int references = nrOfRefsPerObj;
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
for ( ; null != cl; cl = cl.getSuperclass()) {
|
for ( ; null != cl; cl = cl.getSuperclass()) {
|
||||||
Field[] field = cl.getDeclaredFields();
|
Field[] field = cl.getDeclaredFields();
|
||||||
if (null != field) {
|
if (null != field) {
|
||||||
for (Field aField : field) {
|
for (Field aField : field) {
|
||||||
if (!Modifier.isStatic(aField.getModifiers())) {
|
if (Modifier.isStatic(aField.getModifiers())) continue;
|
||||||
Class fieldClass = aField.getType();
|
Class fieldClass = aField.getType();
|
||||||
if (fieldClass.isArray()) {
|
if (fieldClass.isArray()) {
|
||||||
arrays++;
|
arrays++;
|
||||||
@ -220,10 +221,10 @@ public class ClassSize {
|
|||||||
if (debug) {
|
if (debug) {
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
// Write out region name as string and its encoded name.
|
// Write out region name as string and its encoded name.
|
||||||
LOG.debug(aField.getName() + "\n\t" + aField.getType());
|
LOG.debug("" + index + " " + aField.getName() + " " + aField.getType());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -240,17 +241,17 @@ public class ClassSize {
|
|||||||
* @return the size estimate, in bytes
|
* @return the size estimate, in bytes
|
||||||
*/
|
*/
|
||||||
private static long estimateBaseFromCoefficients(int [] coeff, boolean debug) {
|
private static long estimateBaseFromCoefficients(int [] coeff, boolean debug) {
|
||||||
long size = coeff[0] + align(coeff[1]*ARRAY) + coeff[2]*REFERENCE;
|
long prealign_size = coeff[0] + align(coeff[1] * ARRAY) + coeff[2] * REFERENCE;
|
||||||
|
|
||||||
// Round up to a multiple of 8
|
// Round up to a multiple of 8
|
||||||
size = align(size);
|
long size = align(prealign_size);
|
||||||
if(debug) {
|
if(debug) {
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
// Write out region name as string and its encoded name.
|
// Write out region name as string and its encoded name.
|
||||||
LOG.debug("Primitives " + coeff[0] + ", arrays " + coeff[1] +
|
LOG.debug("Primitives=" + coeff[0] + ", arrays=" + coeff[1] +
|
||||||
", references(includes " + nrOfRefsPerObj +
|
", references(includes " + nrOfRefsPerObj +
|
||||||
" for object overhead) " + coeff[2] + ", refSize " + REFERENCE +
|
" for object overhead)=" + coeff[2] + ", refSize " + REFERENCE +
|
||||||
", size " + size);
|
", size=" + size + ", prealign_size=" + prealign_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
@ -291,6 +292,5 @@ public class ClassSize {
|
|||||||
//stored and sent together
|
//stored and sent together
|
||||||
return ((num + 7) >> 3) << 3;
|
return ((num + 7) >> 3) << 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +315,5 @@ public class TestHeapSize extends TestCase {
|
|||||||
// accounted for. But we have satisfied our two core requirements.
|
// accounted for. But we have satisfied our two core requirements.
|
||||||
// Sizing is quite accurate now, and our tests will throw errors if
|
// Sizing is quite accurate now, and our tests will throw errors if
|
||||||
// any of these classes are modified without updating overhead sizes.
|
// any of these classes are modified without updating overhead sizes.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user