From commits-return-6217-apmail-activemq-commits-archive=activemq.apache.org@activemq.apache.org Sat Jun 09 22:31:34 2007 Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 11194 invoked from network); 9 Jun 2007 22:31:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Jun 2007 22:31:33 -0000 Received: (qmail 92556 invoked by uid 500); 9 Jun 2007 22:31:37 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 92530 invoked by uid 500); 9 Jun 2007 22:31:37 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 92519 invoked by uid 99); 9 Jun 2007 22:31:37 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 09 Jun 2007 15:31:37 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 09 Jun 2007 15:31:31 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id F40E21A981A; Sat, 9 Jun 2007 15:31:10 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r545802 - in /activemq/activemq-cpp/trunk/src/decaf: Makefile.am configure.ac src/examples/main.cpp Date: Sat, 09 Jun 2007 22:31:10 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070609223110.F40E21A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tabish Date: Sat Jun 9 15:31:07 2007 New Revision: 545802 URL: http://svn.apache.org/viewvc?view=rev&rev=545802 Log: https://issues.apache.org/activemq/browse/AMQCPP-103 Building up the Decaf Library Added: activemq/activemq-cpp/trunk/src/decaf/src/examples/main.cpp Modified: activemq/activemq-cpp/trunk/src/decaf/Makefile.am activemq/activemq-cpp/trunk/src/decaf/configure.ac Modified: activemq/activemq-cpp/trunk/src/decaf/Makefile.am URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/Makefile.am?view=diff&rev=545802&r1=545801&r2=545802 ============================================================================== --- activemq/activemq-cpp/trunk/src/decaf/Makefile.am (original) +++ activemq/activemq-cpp/trunk/src/decaf/Makefile.am Sat Jun 9 15:31:07 2007 @@ -18,7 +18,7 @@ # Since we don't strictly follow the GNU standard of having 'NEWS README AUTHORS ChangeLog' files AUTOMAKE_OPTIONS = foreign -SUBDIRS = src/main +SUBDIRS = src/main src/examples if BUILD_CPPUNIT_TESTS SUBDIRS += src/test endif Modified: activemq/activemq-cpp/trunk/src/decaf/configure.ac URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/configure.ac?view=diff&rev=545802&r1=545801&r2=545802 ============================================================================== --- activemq/activemq-cpp/trunk/src/decaf/configure.ac (original) +++ activemq/activemq-cpp/trunk/src/decaf/configure.ac Sat Jun 9 15:31:07 2007 @@ -165,6 +165,7 @@ AC_CONFIG_FILES(Makefile) AC_CONFIG_FILES(decaf.pc) AC_CONFIG_FILES(src/main/Makefile) +AC_CONFIG_FILES(src/examples/Makefile) if test x$cppunit = xyes then Added: activemq/activemq-cpp/trunk/src/decaf/src/examples/main.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/examples/main.cpp?view=auto&rev=545802 ============================================================================== --- activemq/activemq-cpp/trunk/src/decaf/src/examples/main.cpp (added) +++ activemq/activemq-cpp/trunk/src/decaf/src/examples/main.cpp Sat Jun 9 15:31:07 2007 @@ -0,0 +1,88 @@ +/* + * 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. + */ + +// START SNIPPET: demo + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +using namespace decaf::lang; +using namespace decaf::io; +using namespace decaf::util; +using namespace decaf::util::concurrent; +using namespace std; + +int main(int argc DECAF_UNUSED, char* argv[] DECAF_UNUSED) { + + std::cout << "=====================================================\n"; + std::cout << "Starting the example:" << std::endl; + std::cout << "-----------------------------------------------------\n"; + + const int bufferSize = 1024 * 2000; + const int totalRuns = 100; + + const unsigned char* buffer = new unsigned char[bufferSize]; + unsigned char* recvBuffer = new unsigned char[bufferSize]; + long long startTime = 0LL; + long long endTime = 0LL; + long long totalDelta = 0LL; + long long average = 0LL; + + ByteArrayInputStream bis( buffer, bufferSize ); + std::vector deltaTs; + + for( int i = 0; i < totalRuns; ++i ) { + startTime = Date::getCurrentTimeMilliseconds(); + + // Time a large read + bis.read( recvBuffer, bufferSize ); + + endTime = Date::getCurrentTimeMilliseconds(); + + // Save the result + deltaTs.push_back( endTime - startTime ); + + bis.reset(); + } + + // Sum the Time Deltas for all runs. + for( int j = 0; j < totalRuns; ++j ) { + totalDelta += deltaTs[j]; + } + + average = totalDelta / totalRuns; + + std::cout << "Averqage time of competion was: " + << average << " Milliseconds." << std::endl; + + delete [] buffer; + delete [] recvBuffer; + + std::cout << "-----------------------------------------------------\n"; + std::cout << "Finished with the example\n"; + std::cout << "=====================================================\n"; +} + +// END SNIPPET: demo