Author: timfox
Date: 2009-12-02 05:40:48 -0500 (Wed, 02 Dec 2009)
New Revision: 8497
Added:
trunk/tests/src/org/hornetq/tests/unit/util/sizeof/MessageReferenceSizeOf.java
Modified:
trunk/tests/src/org/hornetq/tests/unit/util/sizeof/SizeOfBase.java
Log:
some additions to sizeof tests
Added: trunk/tests/src/org/hornetq/tests/unit/util/sizeof/MessageReferenceSizeOf.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/util/sizeof/MessageReferenceSizeOf.java
(rev 0)
+++
trunk/tests/src/org/hornetq/tests/unit/util/sizeof/MessageReferenceSizeOf.java 2009-12-02
10:40:48 UTC (rev 8497)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.unit.util.sizeof;
+
+import org.hornetq.core.server.impl.MessageReferenceImpl;
+
+
+/**
+ *
+ * A MessageReferenceSizeOf
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class MessageReferenceSizeOf extends SizeOfBase
+{
+
+ @Override
+ protected Object newObject()
+ {
+ return new MessageReferenceImpl();
+ }
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/tests/src/org/hornetq/tests/unit/util/sizeof/SizeOfBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/util/sizeof/SizeOfBase.java 2009-12-02 10:36:54
UTC (rev 8496)
+++ trunk/tests/src/org/hornetq/tests/unit/util/sizeof/SizeOfBase.java 2009-12-02 10:40:48
UTC (rev 8497)
@@ -50,10 +50,17 @@
long totalMemory1 = 0;
long totalMemory2 = 0;
-
- final Object obj[] = new Object[numberOfObjects];
- // make sure we load the classes before
-
+ //First we do a dry run then throw away the results
+
+ Object[] obj = new Object[numberOfObjects];
+
+ for (i = 0; i < numberOfObjects; i++)
+ {
+ obj[i] = newObject();
+ }
+
+ obj = new Object[numberOfObjects];
+
heap1 = getMemorySize();
totalMemory1 = runtime.totalMemory();