test_icl_core_logging_performance.cpp
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of FZIs ic_workspace.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00012 //
00013 // -- END LICENSE BLOCK ------------------------------------------------
00014 
00015 //----------------------------------------------------------------------
00022 //----------------------------------------------------------------------
00023 #include <icl_core/BaseTypes.h>
00024 #include <icl_core/internal_raw_debug.h>
00025 #include <icl_core/os_lxrt.h>
00026 #include <icl_core_config/Config.h>
00027 #include <icl_core_logging/Logging.h>
00028 #include <icl_core_thread/Thread.h>
00029 
00030 DECLARE_LOG_STREAM(PerformanceTest);
00031 REGISTER_LOG_STREAM(PerformanceTest)
00032 
00033 using icl_core::logging::Default;
00034 using icl_core::logging::endl;
00035 
00036 int main(int argc, char *argv[])
00037 {
00038   icl_core::os::lxrtStartup();
00039 
00040   icl_core::config::addParameter(icl_core::config::ConfigParameter("message-count:", "c", "/TestLogging/MessageCount", "Number of messages to be logged."));
00041 
00042   icl_core::logging::initialize(argc, argv);
00043 
00044   size_t message_count = icl_core::config::getDefault<size_t>("/TestLogging/MessageCount", 100000);
00045 
00046   LOGGING_INFO(Default, "Running performance test with " << message_count << " iterations..." << endl);
00047   for (size_t i = 0; i < message_count; ++i)
00048   {
00049     LOGGING_INFO(PerformanceTest, "Test loop " << i << endl);
00050   }
00051   LOGGING_INFO(Default, "Performance test finished." << endl);
00052 
00053   icl_core::logging::tLoggingManager::instance().shutdown();
00054   icl_core::os::lxrtShutdown();
00055 
00056   return 0;
00057 }


fzi_icl_core
Author(s):
autogenerated on Tue Aug 8 2017 02:28:04