activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r555002 - in /activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io: DataInputStreamBenchmark.cpp DataInputStreamBenchmark.h DataOutputStreamBenchmark.cpp DataOutputStreamBenchmark.h
Date Tue, 10 Jul 2007 16:49:11 GMT
Author: tabish
Date: Tue Jul 10 09:49:10 2007
New Revision: 555002

URL: http://svn.apache.org/viewvc?view=rev&rev=555002
Log: (empty)

Added:
    activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataInputStreamBenchmark.cpp
    activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataInputStreamBenchmark.h
    activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataOutputStreamBenchmark.cpp
    activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataOutputStreamBenchmark.h

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataInputStreamBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataInputStreamBenchmark.cpp?view=auto&rev=555002
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataInputStreamBenchmark.cpp
(added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataInputStreamBenchmark.cpp
Tue Jul 10 09:49:10 2007
@@ -0,0 +1,111 @@
+/*
+ * 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 "DataInputStreamBenchmark.h"
+#include <activemq/io/ByteArrayInputStream.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::io;
+
+////////////////////////////////////////////////////////////////////////////////
+DataInputStreamBenchmark::DataInputStreamBenchmark(){
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamBenchmark::setUp(){
+
+//    unsigned char* buffer = new unsigned char[bufferSize];
+//
+//    // init to full String Buffer
+//    for( int ix = 0; ix < bufferSize - 1; ++ix ) {
+//        buffer[ix] = 'z';
+//    }
+//    buffer[bufferSize-1] = '\0';
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamBenchmark::tearDown(){
+
+    delete buffer;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamBenchmark::run(){
+
+    ByteArrayInputStream bis( buffer, bufferSize );
+    DataInputStream dis( &bis );
+
+    bool boolResult = 0;
+    char charResult = 0;
+    unsigned char byteResult = 0;
+    unsigned short ushortResult = 0;
+    short shortResult = 0;
+    int intResult = 0;
+    long long longResult = 0;
+    double doubleResult = 0.0;
+    float floatResult = 0.0f;
+    std::string stringResult = "";
+
+//    for( size_t iy = 0; iy < bufferSize / sizeof( boolResult ); ++iy ){
+//        boolResult = dis.readBoolean();
+//    }
+//    bis.reset();
+//
+//    for( size_t iy = 0; iy < bufferSize / sizeof( charResult ); ++iy ){
+//        charResult = dis.readChar();
+//    }
+//    bis.reset();
+//
+//    for( size_t iy = 0; iy < bufferSize / sizeof( byteResult ); ++iy ){
+//        byteResult = dis.readByte();
+//    }
+//    bis.reset();
+//
+//    for( size_t iy = 0; iy < bufferSize / sizeof( ushortResult ); ++iy ){
+//        ushortResult = dis.readUnsignedShort();
+//    }
+//    bis.reset();
+//
+//    for( size_t iy = 0; iy < bufferSize / sizeof( shortResult ); ++iy ){
+//        shortResult = dis.readShort();
+//    }
+//    bis.reset();
+//
+//    for( size_t iy = 0; iy < bufferSize / sizeof( intResult ); ++iy ){
+//        intResult = dis.readInt();
+//    }
+//    bis.reset();
+//
+//    for( size_t iy = 0; iy < bufferSize / sizeof( longResult ); ++iy ){
+//        longResult = dis.readLong();
+//    }
+//    bis.reset();
+//
+//    for( size_t iy = 0; iy < bufferSize / sizeof( floatResult ); ++iy ){
+//        floatResult = dis.readFloat();
+//    }
+//    bis.reset();
+//
+//    for( size_t iy = 0; iy < bufferSize / sizeof( doubleResult ); ++iy ){
+//        doubleResult = dis.readDouble();
+//    }
+//    bis.reset();
+//
+//    stringResult = dis.readString();
+//    bis.reset();
+}

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataInputStreamBenchmark.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataInputStreamBenchmark.h?view=auto&rev=555002
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataInputStreamBenchmark.h
(added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataInputStreamBenchmark.h
Tue Jul 10 09:49:10 2007
@@ -0,0 +1,48 @@
+/*
+ * 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_IO_DATAINPUTSTREAMBENCHMARK_H_
+#define _ACTIVEMQ_IO_DATAINPUTSTREAMBENCHMARK_H_
+
+#include <benchmark/BenchmarkBase.h>
+#include <activemq/io/DataInputStream.h>
+
+namespace activemq{
+namespace io{
+
+    class DataInputStreamBenchmark :
+        public benchmark::BenchmarkBase<
+            activemq::io::DataInputStreamBenchmark, DataInputStream >
+    {
+    private:
+
+        const unsigned char* buffer;
+        static const int bufferSize = 2000000;
+
+    public:
+
+        DataInputStreamBenchmark();
+        virtual ~DataInputStreamBenchmark() {}
+
+        virtual void setUp();
+        virtual void tearDown();
+        virtual void run();
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_IO_DATAINPUTSTREAMBENCHMARK_H_*/

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataOutputStreamBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataOutputStreamBenchmark.cpp?view=auto&rev=555002
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataOutputStreamBenchmark.cpp
(added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataOutputStreamBenchmark.cpp
Tue Jul 10 09:49:10 2007
@@ -0,0 +1,73 @@
+/*
+ * 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 "DataOutputStreamBenchmark.h"
+#include <activemq/io/ByteArrayOutputStream.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::io;
+
+////////////////////////////////////////////////////////////////////////////////
+DataOutputStreamBenchmark::DataOutputStreamBenchmark(){
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataOutputStreamBenchmark::setUp(){
+
+//    for( size_t i = 0; i < 1024; ++i ) {
+//        testString += 'a';
+//    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataOutputStreamBenchmark::run(){
+
+//    std::vector<unsigned char> outputBuffer;
+//    int numRuns = 500;
+//
+//    ByteArrayOutputStream bos( outputBuffer );
+//    DataOutputStream dos( &bos );
+//
+//    for( int iy = 0; iy < numRuns * 10; ++iy ){
+//        dos.writeLong( 0xFF00FF00FF00FF00LL );
+//    }
+//    for( int iy = 0; iy < numRuns * 10; ++iy ){
+//        dos.writeInt( 312568 );
+//    }
+//    for( int iy = 0; iy < numRuns * 10; ++iy ){
+//        dos.writeShort( 12568 );
+//    }
+//    for( int iy = 0; iy < numRuns * 10; ++iy ){
+//        dos.writeUnsignedShort( 12568 );
+//    }
+//    for( int iy = 0; iy < numRuns * 10; ++iy ){
+//        dos.writeBoolean( true );
+//    }
+//    for( int iy = 0; iy < numRuns * 10; ++iy ){
+//        dos.writeDouble( 10.34235234 );
+//    }
+//    for( int iy = 0; iy < numRuns; ++iy ){
+//        dos.writeFloat( 32.4f );
+//    }
+//
+//    dos.writeChars( testString );
+//    dos.writeBytes( testString );
+//    dos.writeUTF( testString );
+//
+//    outputBuffer.clear();
+}

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataOutputStreamBenchmark.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataOutputStreamBenchmark.h?view=auto&rev=555002
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataOutputStreamBenchmark.h
(added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataOutputStreamBenchmark.h
Tue Jul 10 09:49:10 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_IO_DATAOUTPUTSTREAMBENCHMARK_H_
+#define _ACTIVEMQ_IO_DATAOUTPUTSTREAMBENCHMARK_H_
+
+#include <benchmark/BenchmarkBase.h>
+#include <activemq/io/DataOutputStream.h>
+
+namespace activemq{
+namespace io{
+
+    class DataOutputStreamBenchmark :
+        public benchmark::BenchmarkBase<
+            activemq::io::DataOutputStreamBenchmark, DataOutputStream >
+    {
+    private:
+
+        std::string testString;
+
+    public:
+
+        DataOutputStreamBenchmark();
+        virtual ~DataOutputStreamBenchmark() {}
+
+        virtual void setUp();
+        virtual void run();
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_IO_DATAOUTPUTSTREAMBENCHMARK_H_*/



Mime
View raw message