activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r554422 - in /activemq/activemq-cpp/trunk/src/test-benchmarks: Makefile.am activemq/util/SetBenchmark.cpp activemq/util/SetBenchmark.h testRegistry.cpp
Date Sun, 08 Jul 2007 19:31:19 GMT
Author: tabish
Date: Sun Jul  8 12:31:18 2007
New Revision: 554422

URL: http://svn.apache.org/viewvc?view=rev&rev=554422
Log:
http://issues.apache.org/activemq/browse/AMQCPP-128

Set class perf test

Added:
    activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.cpp
    activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.h
Modified:
    activemq/activemq-cpp/trunk/src/test-benchmarks/Makefile.am
    activemq/activemq-cpp/trunk/src/test-benchmarks/testRegistry.cpp

Modified: activemq/activemq-cpp/trunk/src/test-benchmarks/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/Makefile.am?view=diff&rev=554422&r1=554421&r2=554422
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/Makefile.am Sun Jul  8 12:31:18 2007
@@ -19,6 +19,7 @@
   activemq/util/PrimitiveMapBenchmark.cpp \
   activemq/util/PropertiesBenchmark.cpp \
   activemq/util/QueueBenchmark.cpp \
+  activemq/util/SetBenchmark.cpp \
   benchmark/PerformanceTimer.cpp \
   testRegistry.cpp \
   main.cpp
@@ -27,6 +28,7 @@
   activemq/util/PrimitiveMapBenchmark.h \
   activemq/util/PropertiesBenchmark.h \
   activemq/util/QueueBenchmark.h \
+  activemq/util/SetBenchmark.h \
   benchmark/BenchmarkBase.h \
   benchmark/PerformanceTimer.h
 

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.cpp?view=auto&rev=554422
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.cpp Sun Jul
 8 12:31:18 2007
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.
+ */
+
+#include "SetBenchmark.h"
+
+#include <activemq/util/Integer.h>
+
+using namespace activemq;
+using namespace activemq::util;
+
+////////////////////////////////////////////////////////////////////////////////
+SetBenchmark::SetBenchmark(){
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SetBenchmark::run(){
+
+    int numRuns = 500;
+    std::string test = "test";
+    std::string resultStr = "";
+    Set<std::string> stringCopy;
+    Set<int> intCopy;
+
+    for( int i = 0; i < numRuns; ++i ) {
+        stringSet.add( test + Integer::toString(i) );
+        intSet.add( 100 + i );
+        stringSet.contains( test + Integer::toString(i) );
+        intSet.contains( 100 + i );
+    }
+
+    for( int i = 0; i < numRuns; ++i ) {
+        stringSet.remove( test + Integer::toString(i) );
+        intSet.remove( 100 + i );
+        stringSet.contains( test + Integer::toString(i) );
+        intSet.contains( 100 + i );
+    }
+
+    for( int i = 0; i < numRuns; ++i ) {
+        stringSet.add( test + Integer::toString(i) );
+        intSet.add( 100 + i );
+    }
+
+    std::vector<std::string> stringVec;
+    std::vector<int> intVec;
+
+    for( int i = 0; i < numRuns; ++i ) {
+        stringVec = stringSet.toArray();
+        intVec = intSet.toArray();
+    }
+
+    for( int i = 0; i < numRuns; ++i ) {
+        stringCopy.copy( stringSet );
+        stringCopy.clear();
+        intCopy.copy( intSet );
+        intCopy.clear();
+    }
+
+}

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.h?view=auto&rev=554422
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.h (added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.h Sun Jul 
8 12:31:18 2007
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.
+ */
+
+#ifndef _ACTIVEMQ_UTIL_SETBENCHMARK_H_
+#define _ACTIVEMQ_UTIL_SETBENCHMARK_H_
+
+#include <benchmark/BenchmarkBase.h>
+#include <activemq/util/Set.h>
+
+namespace activemq{
+namespace util{
+
+    class SetBenchmark :
+        public benchmark::BenchmarkBase<
+            activemq::util::SetBenchmark, Set<int> >
+    {
+    private:
+
+        Set<int> intSet;
+        Set<std::string> stringSet;
+
+    public:
+
+        SetBenchmark();
+        virtual ~SetBenchmark() {}
+
+        virtual void run();
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_UTIL_SETBENCHMARK_H_*/

Modified: activemq/activemq-cpp/trunk/src/test-benchmarks/testRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/testRegistry.cpp?view=diff&rev=554422&r1=554421&r2=554422
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/testRegistry.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/testRegistry.cpp Sun Jul  8 12:31:18 2007
@@ -18,7 +18,9 @@
 #include <activemq/util/PrimitiveMapBenchmark.h>
 #include <activemq/util/PropertiesBenchmark.h>
 #include <activemq/util/QueueBenchmark.h>
+#include <activemq/util/SetBenchmark.h>
 
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::PrimitiveMapBenchmark );
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::PropertiesBenchmark );
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::QueueBenchmark );
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::SetBenchmark );



Mime
View raw message