activemq-commits mailing list archives

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

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

More tests

Modified:
    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/testRegistry.cpp

Modified: 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=diff&rev=555015&r1=555014&r2=555015
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataInputStreamBenchmark.cpp
(original)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataInputStreamBenchmark.cpp
Tue Jul 10 10:43:48 2007
@@ -16,7 +16,6 @@
  */
 
 #include "DataInputStreamBenchmark.h"
-#include <activemq/io/ByteArrayInputStream.h>
 
 using namespace std;
 using namespace activemq;
@@ -29,13 +28,14 @@
 ////////////////////////////////////////////////////////////////////////////////
 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';
+    buffer = new unsigned char[bufferSize];
+
+    // init to full String Buffer
+    for( int ix = 0; ix < bufferSize - 1; ++ix ) {
+        buffer[ix] = 65;
+    }
+    buffer[bufferSize-1] = 0;
+    bis.setByteArray( buffer, bufferSize );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -47,7 +47,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 void DataInputStreamBenchmark::run(){
 
-    ByteArrayInputStream bis( buffer, bufferSize );
     DataInputStream dis( &bis );
 
     bool boolResult = 0;
@@ -61,51 +60,53 @@
     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();
+    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();
+
+    for( int i = 0; i < 5; ++i ) {
+        stringResult = dis.readString();
+        bis.reset();
+    }
 }

Modified: 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=diff&rev=555015&r1=555014&r2=555015
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataInputStreamBenchmark.h
(original)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataInputStreamBenchmark.h
Tue Jul 10 10:43:48 2007
@@ -20,6 +20,7 @@
 
 #include <benchmark/BenchmarkBase.h>
 #include <activemq/io/DataInputStream.h>
+#include <activemq/io/ByteArrayInputStream.h>
 
 namespace activemq{
 namespace io{
@@ -30,8 +31,9 @@
     {
     private:
 
-        const unsigned char* buffer;
-        static const int bufferSize = 2000000;
+        unsigned char* buffer;
+        static const int bufferSize = 200000;
+        ByteArrayInputStream bis;
 
     public:
 

Modified: 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=diff&rev=555015&r1=555014&r2=555015
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataOutputStreamBenchmark.cpp
(original)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/io/DataOutputStreamBenchmark.cpp
Tue Jul 10 10:43:48 2007
@@ -29,45 +29,56 @@
 ////////////////////////////////////////////////////////////////////////////////
 void DataOutputStreamBenchmark::setUp(){
 
-//    for( size_t i = 0; i < 1024; ++i ) {
-//        testString += 'a';
-//    }
+    for( size_t i = 0; i < 8096; ++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();
+    std::vector<unsigned char> outputBuffer;
+    int numRuns = 500;
+
+    ByteArrayOutputStream bos( outputBuffer );
+    DataOutputStream dos( &bos );
+
+    for( int iy = 0; iy < numRuns * 40; ++iy ){
+        dos.writeLong( 0xFF00FF00FF00FF00LL );
+    }
+    for( int iy = 0; iy < numRuns * 40; ++iy ){
+        dos.writeInt( 312568 );
+    }
+    for( int iy = 0; iy < numRuns * 40; ++iy ){
+        dos.writeShort( 12568 );
+    }
+    for( int iy = 0; iy < numRuns * 40; ++iy ){
+        dos.writeUnsignedShort( 12568 );
+    }
+    for( int iy = 0; iy < numRuns * 40; ++iy ){
+        dos.writeBoolean( true );
+    }
+    for( int iy = 0; iy < numRuns * 40; ++iy ){
+        dos.writeDouble( 10.34235234 );
+    }
+    for( int iy = 0; iy < numRuns + 40; ++iy ){
+        dos.writeFloat( 32.4f );
+    }
+
+    outputBuffer.clear();
+
+    for( int iy = 0; iy < numRuns; ++iy ){
+        dos.writeChars( testString );
+        outputBuffer.clear();
+    }
+    for( int iy = 0; iy < numRuns; ++iy ){
+        dos.writeBytes( testString );
+        outputBuffer.clear();
+    }
+    for( int iy = 0; iy < numRuns; ++iy ){
+        dos.writeUTF( testString );
+        outputBuffer.clear();
+    }
+
+    outputBuffer.clear();
 }

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=555015&r1=555014&r2=555015
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/testRegistry.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/testRegistry.cpp Tue Jul 10 10:43:48 2007
@@ -30,5 +30,5 @@
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::SetBenchmark );
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::MapBenchmark );
 
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::io::DataInputStreamBenchmark );
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::io::DataOutputStreamBenchmark );
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::io::DataInputStreamBenchmark );
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::io::DataOutputStreamBenchmark );



Mime
View raw message