From cc9de9bc6803212f0233e0e1bf06aa63fe8b7a6a Mon Sep 17 00:00:00 2001 From: Varun Gudisena Date: Wed, 30 Aug 2017 20:49:32 -0500 Subject: Add Initial Code Import Intial Code import for dmaapClient Issue-id: DMAAP-82 Change-Id: Ib627672d37e233b796619f93dd91f5caaf1592e4 Signed-off-by: Varun Gudisena --- src/main/cpp/loopingPostClient.cpp | 92 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 src/main/cpp/loopingPostClient.cpp (limited to 'src/main/cpp/loopingPostClient.cpp') diff --git a/src/main/cpp/loopingPostClient.cpp b/src/main/cpp/loopingPostClient.cpp new file mode 100644 index 0000000..1396eea --- /dev/null +++ b/src/main/cpp/loopingPostClient.cpp @@ -0,0 +1,92 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed 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. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ + +#include +#include +#include +#include "cambria.h" + +const char* kAlarm = + "" + "12.123.70.213" + "ptdor306me1.els-an.att.net" + "1364716208" + " V1" + " 9" + " .1.3.6.1.4.1.9.9.187" + " 6" + " 2" + " 167" + " 0" + " 0" + " 0" + " 1554393204" + " 10" + " nidVeskaf0" + " " + " .1.3.6.1.2.1.15.3.1.14.32.4.52.58" + " OCTET_STRING_HEX" + " 02 02 " + " " + " " + " .1.3.6.1.2.1.15.3.1.2.32.4.52.58" + " INTEGER" + " 1" + " " + " " + " .1.3.6.1.4.1.9.9.187.1.2.1.1.7.32.4.52.58" + " OCTET_STRING_ASCII" + " peer in wrong AS" + " " + " " + " .1.3.6.1.4.1.9.9.187.1.2.1.1.8.32.4.52.58" + " INTEGER" + " 4" + " " + ""; + +int main ( int argc, const char* argv[] ) +{ + char** msgs = new char* [ 100 ]; + for ( int i=0; i<100; i++ ) + { + msgs[i] = new char [ ::strlen ( kAlarm + 1 ) ]; + ::strcpy ( msgs[i], kAlarm ); + } + + std::time_t start = std::time ( NULL ); + for ( int i=0; i<5000; i++ ) + { + ::cambriaSimpleSendMultiple ( "localhost", 8080, "topic", "streamName", (const char**)msgs, 100 ); + if ( i % 50 == 0 ) + { + std::time_t end = std::time ( NULL ); + double seconds = difftime ( end, start ); + ::printf ( "%.f seconds for %u posts.\n", seconds, i*100 ); + } + } + std::time_t end = std::time ( NULL ); + double seconds = difftime ( end, start ); + ::printf ( "%.f seconds for 1,000,000 posts.\n", seconds ); + + return 0; +} -- cgit 1.2.3-korg