activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r761678 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks: ./ activemq/wireformat/ activemq/wireformat/openwire/ activemq/wireformat/openwire/utils/
Date Fri, 03 Apr 2009 13:52:54 GMT
Author: tabish
Date: Fri Apr  3 13:52:53 2009
New Revision: 761678

URL: http://svn.apache.org/viewvc?rev=761678&view=rev
Log:
Add a benchmark for the string support class to validate some of the recent patches that have
been submitted.

Added:
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/activemq/wireformat/
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/activemq/wireformat/openwire/
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/activemq/wireformat/openwire/utils/
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/activemq/wireformat/openwire/utils/OpenWireStringSupportBenchmark.cpp
  (with props)
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/activemq/wireformat/openwire/utils/OpenWireStringSupportBenchmark.h
  (with props)
Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/Makefile.am
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/testRegistry.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/Makefile.am?rev=761678&r1=761677&r2=761678&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/Makefile.am Fri Apr  3 13:52:53
2009
@@ -16,6 +16,7 @@
 # ---------------------------------------------------------------------------
 
 cc_sources = \
+  activemq/wireformat/openwire/utils/OpenWireStringSupportBenchmark.cpp \
   activemq/util/PrimitiveMapBenchmark.cpp \
   decaf/lang/BooleanBenchmark.cpp \
   decaf/util/PropertiesBenchmark.cpp \
@@ -29,6 +30,7 @@
   main.cpp
 
 hh_sources = \
+  activemq/wireformat/openwire/utils/OpenWireStringSupportBenchmark.h \
   activemq/util/PrimitiveMapBenchmark.h \
   decaf/lang/BooleanBenchmark.h \
   decaf/util/PropertiesBenchmark.h \

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/activemq/wireformat/openwire/utils/OpenWireStringSupportBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/activemq/wireformat/openwire/utils/OpenWireStringSupportBenchmark.cpp?rev=761678&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/activemq/wireformat/openwire/utils/OpenWireStringSupportBenchmark.cpp
(added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/activemq/wireformat/openwire/utils/OpenWireStringSupportBenchmark.cpp
Fri Apr  3 13:52:53 2009
@@ -0,0 +1,85 @@
+/*
+ * 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 "OpenWireStringSupportBenchmark.h"
+
+#include <decaf/io/ByteArrayInputStream.h>
+#include <decaf/io/ByteArrayOutputStream.h>
+#include <decaf/io/DataInputStream.h>
+#include <decaf/io/DataOutputStream.h>
+
+#include <decaf/util/Random.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::io;
+using namespace decaf::util;
+using namespace activemq;
+using namespace activemq::wireformat;
+using namespace activemq::wireformat::openwire;
+using namespace activemq::wireformat::openwire::utils;
+
+////////////////////////////////////////////////////////////////////////////////
+OpenWireStringSupportBenchmark::OpenWireStringSupportBenchmark() {
+    this->dataIn = NULL;
+    this->dataOut = NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+OpenWireStringSupportBenchmark::~OpenWireStringSupportBenchmark() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void OpenWireStringSupportBenchmark::setUp(){
+    this->dataIn = new DataInputStream( &bytesIn );
+    this->dataOut = new DataOutputStream( &bytesOut );
+
+    Random randGen;
+    const int bufferSize = 32876;
+
+    for( int i = 0; i < bufferSize; ++i ) {
+        this->buffer.push_back( (char)( randGen.nextInt( 254 ) + 1 ) );
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void OpenWireStringSupportBenchmark::tearDown(){
+
+    delete this->dataIn;
+    delete this->dataOut;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void OpenWireStringSupportBenchmark::run() {
+
+    string testStr = "This is a test string for Openwire";
+
+//    OpenwireStringSupport::writeString( *dataOut, &testStr );
+//
+//    // Move the output back to the input.
+//    bytesIn.setByteArray( bytesOut.toByteArray(), bytesOut.size() );
+//
+//    string resultStr = OpenwireStringSupport::readString( *dataIn );
+//
+//    CPPUNIT_ASSERT( testStr == resultStr );
+
+//    this->bytesOut.reset();
+    OpenwireStringSupport::writeString( *dataOut, &buffer );
+    bytesIn.setByteArray( bytesOut.toByteArray(), bytesOut.size() );
+    string resultStr = OpenwireStringSupport::readString( *dataIn );
+
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/activemq/wireformat/openwire/utils/OpenWireStringSupportBenchmark.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/activemq/wireformat/openwire/utils/OpenWireStringSupportBenchmark.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/activemq/wireformat/openwire/utils/OpenWireStringSupportBenchmark.h?rev=761678&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/activemq/wireformat/openwire/utils/OpenWireStringSupportBenchmark.h
(added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/activemq/wireformat/openwire/utils/OpenWireStringSupportBenchmark.h
Fri Apr  3 13:52:53 2009
@@ -0,0 +1,62 @@
+/*
+ * 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_WIREFORMAT_OPENWIRE_UTILS_OPENWIRESTRINGSUPPORTBENCHMARK_H_
+#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_UTILS_OPENWIRESTRINGSUPPORTBENCHMARK_H_
+
+#include <benchmark/BenchmarkBase.h>
+
+#include <activemq/wireformat/openwire/utils/OpenwireStringSupport.h>
+#include <decaf/io/ByteArrayInputStream.h>
+#include <decaf/io/ByteArrayOutputStream.h>
+#include <decaf/io/DataInputStream.h>
+#include <decaf/io/DataOutputStream.h>
+
+#include <vector>
+
+namespace activemq {
+namespace wireformat {
+namespace openwire {
+namespace utils {
+
+    class OpenWireStringSupportBenchmark : public benchmark::BenchmarkBase<
+        activemq::wireformat::openwire::utils::OpenWireStringSupportBenchmark, OpenwireStringSupport
> {
+
+    private:
+
+        decaf::io::ByteArrayInputStream bytesIn;
+        decaf::io::ByteArrayOutputStream bytesOut;
+
+        decaf::io::DataInputStream* dataIn;
+        decaf::io::DataOutputStream* dataOut;
+
+        std::string buffer;
+
+    public:
+
+        OpenWireStringSupportBenchmark();
+        virtual ~OpenWireStringSupportBenchmark();
+
+        void setUp();
+        void tearDown();
+
+        void run();
+    };
+
+}}}}
+
+#endif /* _ACTIVEMQ_WIREFORMAT_OPENWIRE_UTILS_OPENWIRESTRINGSUPPORTBENCHMARK_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/activemq/wireformat/openwire/utils/OpenWireStringSupportBenchmark.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/testRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/testRegistry.cpp?rev=761678&r1=761677&r2=761678&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/testRegistry.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/testRegistry.cpp Fri Apr
 3 13:52:53 2009
@@ -15,6 +15,9 @@
  * limitations under the License.
  */
 
+#include <activemq/wireformat/openwire/utils/OpenWireStringSupportBenchmark.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::wireformat::openwire::utils::OpenWireStringSupportBenchmark
);
+
 #include <activemq/util/PrimitiveMapBenchmark.h>
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::PrimitiveMapBenchmark );
 



Mime
View raw message