From fda2b2c123a025dfc4866b001d774bd853da9fcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radovan=20=C4=8Cerven=C3=BD?= <radovan.cerveny@gmail.com> Date: Tue, 9 Feb 2016 16:47:19 +0100 Subject: [PATCH] replaced old measurements --- aarbology2/src/aarbology.cpp | 76 +++++++------- acast2/src/acast.cpp | 19 ++-- acompaction2/src/acompaction.cpp | 20 ++-- acompare2/src/acompare.cpp | 17 ++-- aconversions2/src/ConversionHandler.cpp | 81 +++++++-------- aconversions2/src/aconversion.cpp | 11 ++- aconvert2/src/aconvert.cpp | 63 ++++++------ aderivation2/src/aderivation.cpp | 19 ++-- adeterminize2/src/adeterminize.cpp | 14 ++- aecho2/src/aecho.cpp | 17 ++-- aepsilon2/src/aepsilon.cpp | 55 ++++++----- agenerate2/src/agenerate.cpp | 27 ++--- agraphbench2/src/agraphbench.cpp | 13 +-- aintegral2/src/aintegral.cpp | 19 ++-- alangop2/src/alangop.cpp | 67 ++++++------- alib2data/src/factory/XmlDataFactory.hpp | 9 +- alib2data/src/sax/SaxComposeInterface.cpp | 5 +- alib2data/src/sax/SaxParseInterface.cpp | 5 +- alib2measure/src/measure | 10 ++ .../src/measurements/MeasurementCmdLine.hpp | 58 ----------- .../src/measurements/measurements.cpp | 35 +++++++ .../src/measurements/measurements.hpp | 21 +--- alib2std/src/extensions/chrono.cpp | 8 +- alib2std/src/extensions/chrono.hpp | 8 +- alib2std/test-src/extensions/ChronoTest.cpp | 6 +- alphabetManip2/src/alphabetManip.cpp | 27 ++--- aminimize2/src/aminimize.cpp | 23 ++--- anormalize2/src/anormalize.cpp | 83 ++++++++-------- arand2/src/arand.cpp | 57 +++++------ araw2/src/araw.cpp | 19 ++-- arename2/src/arename.cpp | 19 ++-- areverse2/src/areverse.cpp | 19 ++-- arun2/src/arun.cpp | 27 ++--- astat2/src/astat.cpp | 43 ++++---- astringology2/src/astringology.cpp | 99 ++++++++++--------- atrim2/src/atrim.cpp | 39 ++++---- tniceprint/src/tniceprint.cpp | 19 ++-- 37 files changed, 575 insertions(+), 582 deletions(-) create mode 100644 alib2measure/src/measure delete mode 100644 alib2measure/src/measurements/MeasurementCmdLine.hpp create mode 100644 alib2measure/src/measurements/measurements.cpp diff --git a/aarbology2/src/aarbology.cpp b/aarbology2/src/aarbology.cpp index 10c6274c94..83d603607c 100644 --- a/aarbology2/src/aarbology.cpp +++ b/aarbology2/src/aarbology.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <vector> #include <factory/XmlDataFactory.hpp> @@ -24,7 +25,6 @@ #include <arbology/exact/ExactSubtreeAutomaton.h> #include <arbology/exact/ExactTreePatternAutomaton.h> #include <arbology/transform/BeginToEndIndex.h> -#include <chrono> int main ( int argc, char * argv[] ) { try { @@ -76,8 +76,8 @@ int main ( int argc, char * argv[] ) { } else { } - std::chrono::measurements::start ( "Overal", std::chrono::measurements::Type::OVERALL ); - std::chrono::measurements::start ( "Input read", std::chrono::measurements::Type::AUXILARY ); + measurements::start ( "Overal", measurements::Type::OVERALL ); + measurements::start ( "Input read", measurements::Type::AUXILIARY ); std::deque < std::deque < sax::Token > > subjectTokens; @@ -121,108 +121,108 @@ int main ( int argc, char * argv[] ) { tree::Tree subject = alib::XmlDataFactory::fromTokens < tree::Tree > ( subjectTokens.front ( ) ); tree::Tree pattern = alib::XmlDataFactory::fromTokens < tree::Tree > ( patternTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); std::set < unsigned > res = arbology::exact::ExactSubtreeMatch::match ( subject, pattern ); if( ends.isSet ( ) ) res = arbology::transform::BeginToEndIndex::transform(subject, res); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( algorithm.getValue ( ) == "exactPatternMatch" ) { tree::Tree subject = alib::XmlDataFactory::fromTokens < tree::Tree > ( subjectTokens.front ( ) ); tree::Tree pattern = alib::XmlDataFactory::fromTokens < tree::Tree > ( patternTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); std::set < unsigned > res = arbology::exact::ExactPatternMatch::match ( subject, pattern ); if( ends.isSet ( ) ) res = arbology::transform::BeginToEndIndex::transform(subject, res); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( algorithm.getValue ( ) == "boyerMooreHorspool" ) { tree::Tree subject = alib::XmlDataFactory::fromTokens < tree::Tree > ( subjectTokens.front ( ) ); tree::Tree pattern = alib::XmlDataFactory::fromTokens < tree::Tree > ( patternTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); std::set < unsigned > res = arbology::exact::BoyerMooreHorspool::match ( subject, pattern ); if( ends.isSet ( ) ) res = arbology::transform::BeginToEndIndex::transform(subject, res); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( algorithm.getValue ( ) == "knuthMorrisPratt" ) { tree::Tree subject = alib::XmlDataFactory::fromTokens < tree::Tree > ( subjectTokens.front ( ) ); tree::Tree pattern = alib::XmlDataFactory::fromTokens < tree::Tree > ( patternTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); std::set < unsigned > res = arbology::exact::KnuthMorrisPratt::match ( subject, pattern ); if( ends.isSet ( ) ) res = arbology::transform::BeginToEndIndex::transform(subject, res); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( algorithm.getValue ( ) == "exactSubtreeMatchingAutomaton" ) { tree::Tree pattern = alib::XmlDataFactory::fromTokens < tree::Tree > ( patternTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); automaton::Automaton res = arbology::exact::ExactSubtreeMatchingAutomaton::construct ( pattern ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( algorithm.getValue ( ) == "exactPatternMatchingAutomaton" ) { tree::Tree pattern = alib::XmlDataFactory::fromTokens < tree::Tree > ( patternTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); automaton::Automaton res = arbology::exact::ExactPatternMatchingAutomaton::construct ( pattern ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( algorithm.getValue ( ) == "exactSubtreeAutomaton" ) { tree::Tree subject = alib::XmlDataFactory::fromTokens < tree::Tree > ( subjectTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); automaton::Automaton res = arbology::exact::ExactSubtreeAutomaton::construct ( subject ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( algorithm.getValue ( ) == "exactTreePatternAutomaton" ) { tree::Tree subject = alib::XmlDataFactory::fromTokens < tree::Tree > ( subjectTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); automaton::Automaton res = arbology::exact::ExactTreePatternAutomaton::construct ( subject ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else { @@ -230,10 +230,10 @@ int main ( int argc, char * argv[] ) { return 1; } - std::chrono::measurements::end ( ); - std::chrono::measurements::end ( ); + measurements::end ( ); + measurements::end ( ); - if ( measure.getValue ( ) ) std::clog << std::chrono::measurements::results ( ) << std::endl; + if ( measure.getValue ( ) ) std::clog << measurements::results ( ) << std::endl; return 0; } catch ( const exception::AlibException & exception ) { diff --git a/acast2/src/acast.cpp b/acast2/src/acast.cpp index 39e3d92b6b..a49542c8aa 100644 --- a/acast2/src/acast.cpp +++ b/acast2/src/acast.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <string> #include <exception/AlibException.h> #include <factory/XmlDataFactory.hpp> @@ -40,8 +41,8 @@ int main(int argc, char** argv) { if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start("Overal", std::chrono::measurements::Type::OVERALL); - std::chrono::measurements::start("Input read", std::chrono::measurements::Type::AUXILARY); + measurements::start("Overal", measurements::Type::OVERALL); + measurements::start("Input read", measurements::Type::AUXILIARY); std::deque<sax::Token> tokens; if(input.isSet()) { if(input.getValue() == "-") { @@ -55,20 +56,20 @@ int main(int argc, char** argv) { alib::Object in = alib::XmlDataFactory::fromTokens<alib::Object>(tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Cast", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Cast", measurements::Type::MAIN); alib::Object res = alib::castApi::getCastPool(type.getValue()).cast(in.getData()); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(res); - std::chrono::measurements::end(); - std::chrono::measurements::end(); + measurements::end(); + measurements::end(); - if(measure.getValue()) std::clog << std::chrono::measurements::results() << std::endl; + if(measure.getValue()) std::clog << measurements::results() << std::endl; return 0; } catch(const exception::AlibException& exception) { diff --git a/acompaction2/src/acompaction.cpp b/acompaction2/src/acompaction.cpp index a6e6245e4e..fa1761d4a2 100644 --- a/acompaction2/src/acompaction.cpp +++ b/acompaction2/src/acompaction.cpp @@ -7,12 +7,12 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <iostream> #include "exception/AlibException.h" #include "factory/XmlDataFactory.hpp" #include "automaton/transform/Compaction.h" -#include <chrono> int main(int argc, char** argv) { @@ -35,8 +35,8 @@ int main(int argc, char** argv) { if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start("Overal", std::chrono::measurements::Type::OVERALL); - std::chrono::measurements::start("Input read", std::chrono::measurements::Type::AUXILARY); + measurements::start("Overal", measurements::Type::OVERALL); + measurements::start("Input read", measurements::Type::AUXILIARY); std::deque<sax::Token> tokens; if(input.isSet()) { @@ -51,20 +51,20 @@ int main(int argc, char** argv) { automaton::Automaton automaton = alib::XmlDataFactory::fromTokens<automaton::Automaton>(tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); automaton::Automaton res = automaton::transform::Compaction::convert(automaton); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(res); - std::chrono::measurements::end(); - std::chrono::measurements::end(); + measurements::end(); + measurements::end(); - if(measure.getValue()) std::clog << std::chrono::measurements::results() << std::endl; + if(measure.getValue()) std::clog << measurements::results() << std::endl; return 0; } catch (const exception::AlibException& exception) { diff --git a/acompare2/src/acompare.cpp b/acompare2/src/acompare.cpp index 308b1cb365..1a75f8b3cf 100644 --- a/acompare2/src/acompare.cpp +++ b/acompare2/src/acompare.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include "factory/XmlDataFactory.hpp" #include "exception/AlibException.h" @@ -39,8 +40,8 @@ int main(int argc, char** argv) { if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start("Overal", std::chrono::measurements::Type::OVERALL); - std::chrono::measurements::start("Input read", std::chrono::measurements::Type::AUXILARY); + measurements::start("Overal", measurements::Type::OVERALL); + measurements::start("Input read", measurements::Type::AUXILIARY); std::deque<sax::Token> tokens1; if(input1.isSet()) { @@ -78,24 +79,24 @@ int main(int argc, char** argv) { automaton::Automaton automaton1 = alib::XmlDataFactory::fromTokens<automaton::Automaton>(tokens1); automaton::Automaton automaton2 = alib::XmlDataFactory::fromTokens<automaton::Automaton>(tokens2); - std::chrono::measurements::end(); - std::chrono::measurements::start("Compare", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Compare", measurements::Type::MAIN); res = AutomatonCompare::compare(automaton1, automaton2); } else if(alib::XmlDataFactory::first<grammar::Grammar>(tokens1) && alib::XmlDataFactory::first<grammar::Grammar>(tokens2)) { grammar::Grammar grammar1 = alib::XmlDataFactory::fromTokens<grammar::Grammar>(tokens1); grammar::Grammar grammar2 = alib::XmlDataFactory::fromTokens<grammar::Grammar>(tokens2); - std::chrono::measurements::end(); - std::chrono::measurements::start("Compare", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Compare", measurements::Type::MAIN); res = GrammarCompare::compare(grammar1, grammar2); } else { throw exception::AlibException("Only automata and grammars can be compared."); } - std::chrono::measurements::end(); - std::chrono::measurements::end(); + measurements::end(); + measurements::end(); return res; } catch (const exception::AlibException& exception) { diff --git a/aconversions2/src/ConversionHandler.cpp b/aconversions2/src/ConversionHandler.cpp index 4ac215a036..cb0bd615b5 100644 --- a/aconversions2/src/ConversionHandler.cpp +++ b/aconversions2/src/ConversionHandler.cpp @@ -5,6 +5,7 @@ * Author: Tomas Pecka */ +#include <measure> #include "ConversionHandler.h" #include "automaton/convert/ToRegExpStateElimination.h" @@ -101,15 +102,15 @@ void ConversionHandler::convertFAtoRE( void ) { const automaton::Automaton automaton = alib::XmlDataFactory::fromTokens<automaton::Automaton>(m_tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); switch( m_algorithm ) { case BRZOZOWSKI_ALGEBRAIC: { regexp::RegExp regexp = automaton::convert::ToRegExpAlgebraic::convert( automaton ); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(regexp); break; @@ -118,8 +119,8 @@ void ConversionHandler::convertFAtoRE( void ) case DEFAULT: { regexp::RegExp regexp = automaton::convert::ToRegExpStateElimination::convert(automaton); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( regexp ); break; @@ -133,15 +134,15 @@ void ConversionHandler::convertFAtoRG( void ) { const automaton::Automaton fsm = alib::XmlDataFactory::fromTokens<automaton::Automaton>( m_tokens ); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); switch( m_algorithm ) { case INCOMING_TRANSITIONS: { grammar::LeftRG grammar = automaton::convert::ToGrammarLeftRG::convert(fsm); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( grammar ); break; @@ -150,8 +151,8 @@ void ConversionHandler::convertFAtoRG( void ) case DEFAULT: { grammar::RightRG grammar = automaton::convert::ToGrammarRightRG::convert(fsm); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(grammar); break; @@ -167,15 +168,15 @@ void ConversionHandler::convertREtoFA( void ) { const regexp::RegExp regexp = alib::XmlDataFactory::fromTokens<regexp::RegExp>(m_tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); switch( m_algorithm ) { case BRZOZOWSKI_DERIVATION: { automaton::DFA automaton = regexp::convert::ToAutomatonDerivation::convert(regexp); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(automaton); break; @@ -183,8 +184,8 @@ void ConversionHandler::convertREtoFA( void ) case THOMPSON_NFA: { automaton::EpsilonNFA automaton = regexp::convert::ToAutomatonThompson::convert(regexp); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(automaton); break; @@ -193,8 +194,8 @@ void ConversionHandler::convertREtoFA( void ) case DEFAULT: { automaton::NFA automaton = regexp::convert::ToAutomatonGlushkov::convert(regexp); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(automaton); break; @@ -208,15 +209,15 @@ void ConversionHandler::convertREtoRG( void ) { const regexp::RegExp regexp = alib::XmlDataFactory::fromTokens<regexp::RegExp>(m_tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); switch(m_algorithm) { case BRZOZOWSKI_DERIVATION: { grammar::RightRG grammar = regexp::convert::ToGrammarRightRGDerivation::convert(regexp); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( grammar ); break; @@ -225,8 +226,8 @@ void ConversionHandler::convertREtoRG( void ) case DEFAULT: { grammar::RightRG grammar = regexp::convert::ToGrammarRightRGGlushkov::convert(regexp); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( grammar ); break; @@ -241,15 +242,15 @@ void ConversionHandler::convertREtoRG( void ) void ConversionHandler::convertRGtoFA( void ) { const grammar::Grammar grammar = alib::XmlDataFactory::fromTokens<grammar::Grammar>(m_tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); switch( m_algorithm ) { case DEFAULT: { automaton::Automaton automaton = grammar::convert::ToAutomaton::convert(grammar); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( automaton ); break; @@ -262,16 +263,16 @@ void ConversionHandler::convertRGtoFA( void ) { void ConversionHandler::convertRGtoRE( void ) { const grammar::Grammar grammar = alib::XmlDataFactory::fromTokens<grammar::Grammar>(m_tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); switch( m_algorithm ) { case BRZOZOWSKI_ALGEBRAIC: case DEFAULT: { regexp::RegExp regexp = grammar::convert::ToRegExpAlgebraic::convert(grammar); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( regexp ); break; @@ -285,16 +286,16 @@ void ConversionHandler::convertCFGtoPDA( void ) { const grammar::Grammar grammar = alib::XmlDataFactory::fromTokens<grammar::Grammar>(m_tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); switch( m_algorithm ) { case TOP_DOWN: { automaton::Automaton automaton = grammar::convert::ToAutomaton::convert(grammar); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( automaton ); break; @@ -302,8 +303,8 @@ void ConversionHandler::convertCFGtoPDA( void ) case BOTTOM_UP: { automaton::Automaton automaton = grammar::convert::ToAutomatonBottomUp::convert(grammar); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( automaton ); break; diff --git a/aconversions2/src/aconversion.cpp b/aconversions2/src/aconversion.cpp index 284dca48c5..d557b727db 100644 --- a/aconversions2/src/aconversion.cpp +++ b/aconversions2/src/aconversion.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <sax/SaxParseInterface.h> #include <sax/ParserException.h> @@ -45,8 +46,8 @@ int main(int argc, char* argv[]) if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start("Overal", std::chrono::measurements::Type::OVERALL); - std::chrono::measurements::start("Input read", std::chrono::measurements::Type::AUXILARY); + measurements::start("Overal", measurements::Type::OVERALL); + measurements::start("Input read", measurements::Type::AUXILIARY); std::deque<sax::Token> inputTokens; if(input.isSet()) { @@ -62,10 +63,10 @@ int main(int argc, char* argv[]) ConversionHandler conv( inputTokens, target.getValue(), algorithm.getValue() ); conv.convert( ); - std::chrono::measurements::end(); - std::chrono::measurements::end(); + measurements::end(); + measurements::end(); - if(measure.getValue()) std::clog << std::chrono::measurements::results() << std::endl; + if(measure.getValue()) std::clog << measurements::results() << std::endl; return 0; } catch(const exception::AlibException& exception) { diff --git a/aconvert2/src/aconvert.cpp b/aconvert2/src/aconvert.cpp index 9c2965ea8a..86ec3db5ab 100644 --- a/aconvert2/src/aconvert.cpp +++ b/aconvert2/src/aconvert.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <fstream> #include "factory/XmlDataFactory.hpp" @@ -20,8 +21,8 @@ void automatonFromString ( std::istream & in, std::ostream & out ) { automaton::Automaton automaton = alib::StringDataFactory::fromStream < automaton::Automaton > ( in ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStream ( automaton, out ); } @@ -29,8 +30,8 @@ void automatonFromString ( std::istream & in, std::ostream & out ) { void grammarFromString ( std::istream & in, std::ostream & out ) { grammar::Grammar grammar = alib::StringDataFactory::fromStream < grammar::Grammar > ( in ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStream ( grammar, out ); } @@ -38,8 +39,8 @@ void grammarFromString ( std::istream & in, std::ostream & out ) { void regexpFromString ( std::istream & in, std::ostream & out ) { regexp::RegExp regexp = alib::StringDataFactory::fromStream < regexp::RegExp > ( in ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStream ( regexp, out ); } @@ -47,8 +48,8 @@ void regexpFromString ( std::istream & in, std::ostream & out ) { void stringFromString ( std::istream & in, std::ostream & out ) { string::String string = alib::StringDataFactory::fromStream < string::String > ( in ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStream ( string, out ); } @@ -56,8 +57,8 @@ void stringFromString ( std::istream & in, std::ostream & out ) { void treeFromString ( std::istream & in, std::ostream & out ) { tree::Tree tree = alib::StringDataFactory::fromStream < tree::Tree > ( in ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStream ( tree, out ); } @@ -65,8 +66,8 @@ void treeFromString ( std::istream & in, std::ostream & out ) { void automatonToString ( std::istream & in, std::ostream & out ) { automaton::Automaton automaton = alib::XmlDataFactory::fromStream < automaton::Automaton > ( in ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::StringDataFactory::toStream ( automaton, out ); } @@ -74,8 +75,8 @@ void automatonToString ( std::istream & in, std::ostream & out ) { void grammarToString ( std::istream & in, std::ostream & out ) { grammar::Grammar grammar = alib::XmlDataFactory::fromStream < grammar::Grammar > ( in ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::StringDataFactory::toStream ( grammar, out ); } @@ -83,8 +84,8 @@ void grammarToString ( std::istream & in, std::ostream & out ) { void regexpToString ( std::istream & in, std::ostream & out ) { regexp::RegExp regexp = alib::XmlDataFactory::fromStream < regexp::RegExp > ( in ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::StringDataFactory::toStream ( regexp, out ); } @@ -92,8 +93,8 @@ void regexpToString ( std::istream & in, std::ostream & out ) { void stringToString ( std::istream & in, std::ostream & out ) { string::String string = alib::XmlDataFactory::fromStream < string::String > ( in ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::StringDataFactory::toStream ( string, out ); } @@ -101,8 +102,8 @@ void stringToString ( std::istream & in, std::ostream & out ) { void treeToString ( std::istream & in, std::ostream & out ) { tree::Tree tree = alib::XmlDataFactory::fromStream < tree::Tree > ( in ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::StringDataFactory::toStream ( tree, out ); } @@ -110,8 +111,8 @@ void treeToString ( std::istream & in, std::ostream & out ) { void automatonToDot ( std::istream & in, std::ostream & out ) { automaton::Automaton automaton = alib::XmlDataFactory::fromStream < automaton::Automaton > ( in ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); DotConverter::convert ( out, automaton ); } @@ -119,8 +120,8 @@ void automatonToDot ( std::istream & in, std::ostream & out ) { void automatonToGasTex ( std::istream & in, std::ostream & out ) { automaton::Automaton automaton = alib::XmlDataFactory::fromStream < automaton::Automaton > ( in ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); GasTexConverter::convert ( out, automaton ); } @@ -128,8 +129,8 @@ void automatonToGasTex ( std::istream & in, std::ostream & out ) { void automatonToTikZ ( std::istream & in, std::ostream & out ) { automaton::Automaton automaton = alib::XmlDataFactory::fromStream < automaton::Automaton > ( in ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); TikZConverter::convert ( out, automaton ); } @@ -194,8 +195,8 @@ int main ( int argc, char * argv[] ) { if ( measure.isSet ( ) ) common::GlobalData::measure = true; - std::chrono::measurements::start ( "Overal", std::chrono::measurements::Type::OVERALL ); - std::chrono::measurements::start ( "Input read", std::chrono::measurements::Type::AUXILARY ); + measurements::start ( "Overal", measurements::Type::OVERALL ); + measurements::start ( "Input read", measurements::Type::AUXILIARY ); std::istream * in = NULL; @@ -238,10 +239,10 @@ int main ( int argc, char * argv[] ) { if ( input.isSet ( ) && ( input.getValue ( ) != "-" ) ) delete in; - std::chrono::measurements::end ( ); - std::chrono::measurements::end ( ); + measurements::end ( ); + measurements::end ( ); - if ( measure.getValue ( ) ) std::clog << std::chrono::measurements::results ( ) << std::endl; + if ( measure.getValue ( ) ) std::clog << measurements::results ( ) << std::endl; return 0; } catch ( const exception::AlibException & exception ) { diff --git a/aderivation2/src/aderivation.cpp b/aderivation2/src/aderivation.cpp index 215aa49294..b90ad9ec1d 100644 --- a/aderivation2/src/aderivation.cpp +++ b/aderivation2/src/aderivation.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <factory/XmlDataFactory.hpp> #include <exception/AlibException.h> @@ -35,8 +36,8 @@ int main(int argc, char** argv) { if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start("Overal", std::chrono::measurements::Type::OVERALL); - std::chrono::measurements::start("Input read", std::chrono::measurements::Type::AUXILARY); + measurements::start("Overal", measurements::Type::OVERALL); + measurements::start("Input read", measurements::Type::AUXILIARY); std::deque<sax::Token> stringTokens; if(string.isSet()) { @@ -63,20 +64,20 @@ int main(int argc, char** argv) { string::LinearString stringData = alib::XmlDataFactory::fromTokens<string::LinearString>(stringTokens); regexp::RegExp regexpData = alib::XmlDataFactory::fromTokens<regexp::RegExp>(regexpTokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); regexp::RegExp result = regexp::RegExpDerivation::derivation(regexpData, stringData); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(result); - std::chrono::measurements::end(); - std::chrono::measurements::end(); + measurements::end(); + measurements::end(); - if(measure.getValue()) std::clog << std::chrono::measurements::results() << std::endl; + if(measure.getValue()) std::clog << measurements::results() << std::endl; return 0; } catch(const exception::AlibException& exception) { diff --git a/adeterminize2/src/adeterminize.cpp b/adeterminize2/src/adeterminize.cpp index c5f8ae615a..acb18c9f73 100644 --- a/adeterminize2/src/adeterminize.cpp +++ b/adeterminize2/src/adeterminize.cpp @@ -7,15 +7,13 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include "automaton/Automaton.h" #include "factory/XmlDataFactory.hpp" #include "exception/AlibException.h" #include "automaton/determinize/Determinize.h" -#include "measurements/measurements.hpp" -#include "measurements/MeasurementCmdLine.hpp" - int main(int argc, char** argv) { try { TCLAP::CmdLine cmd("Automaton determinize binary", ' ', "0.01"); @@ -23,18 +21,18 @@ int main(int argc, char** argv) { TCLAP::ValueArg<std::string> input( "i", "input", "Automaton to determinize", false, "-", "file"); cmd.add( input ); - measurements::MeasurementCmdLine::setupTCLAPArgs(cmd); + TCLAP::SwitchArg measure( "m", "measure", "Measure times", false); + cmd.add( measure ); TCLAP::SwitchArg verbose( "v", "verbose", "Be verbose", false); cmd.add( verbose ); cmd.parse(argc, argv); - measurements::MeasurementCmdLine::setupGlobalData(); - if(verbose.isSet()) common::GlobalData::verbose = true; - + if(measure.isSet()) + common::GlobalData::measure = true; measurements::start("Overal", measurements::Type::OVERALL); measurements::start("Input read", measurements::Type::AUXILIARY); @@ -65,7 +63,7 @@ int main(int argc, char** argv) { measurements::end(); measurements::end(); - measurements::MeasurementCmdLine::outputMeasurements(); + if(measure.getValue()) std::clog << measurements::results() << std::endl; return 0; } catch (const exception::AlibException& exception) { diff --git a/aecho2/src/aecho.cpp b/aecho2/src/aecho.cpp index a293e20238..08f6950c0c 100644 --- a/aecho2/src/aecho.cpp +++ b/aecho2/src/aecho.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <string> #include <exception/AlibException.h> #include <factory/XmlDataFactory.hpp> @@ -14,8 +15,6 @@ #include <sax/ParserException.h> #include <object/Object.h> -#include <chrono> - int main(int argc, char** argv) { try { TCLAP::CmdLine cmd("echo binary", ' ', "0.01"); @@ -36,8 +35,8 @@ int main(int argc, char** argv) { if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start("Overal", std::chrono::measurements::Type::OVERALL); - std::chrono::measurements::start("Input read", std::chrono::measurements::Type::AUXILARY); + measurements::start("Overal", measurements::Type::OVERALL); + measurements::start("Input read", measurements::Type::AUXILIARY); std::deque<sax::Token> tokens; if(input.isSet()) { @@ -52,15 +51,15 @@ int main(int argc, char** argv) { alib::Object object = alib::XmlDataFactory::fromTokens<alib::Object>(tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(object); - std::chrono::measurements::end(); - std::chrono::measurements::end(); + measurements::end(); + measurements::end(); - if(measure.getValue()) std::clog << std::chrono::measurements::results() << std::endl; + if(measure.getValue()) std::clog << measurements::results() << std::endl; return 0; } catch(const exception::AlibException& exception) { diff --git a/aepsilon2/src/aepsilon.cpp b/aepsilon2/src/aepsilon.cpp index 1ed3a7c0f8..8d726502b3 100644 --- a/aepsilon2/src/aepsilon.cpp +++ b/aepsilon2/src/aepsilon.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <factory/XmlDataFactory.hpp> #include <exception/AlibException.h> @@ -46,8 +47,8 @@ int main(int argc, char** argv) { if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start("Overal", std::chrono::measurements::Type::OVERALL); - std::chrono::measurements::start("Input read", std::chrono::measurements::Type::AUXILARY); + measurements::start("Overal", measurements::Type::OVERALL); + measurements::start("Input read", measurements::Type::AUXILIARY); std::deque<sax::Token> tokens; if(input.isSet()) { @@ -63,42 +64,42 @@ int main(int argc, char** argv) { if(algorithm.getValue() == "outgoing") { automaton::Automaton automaton = alib::XmlDataFactory::fromTokens<automaton::Automaton>(tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); if(efficient.getValue()) { automaton::Automaton res = automaton::simplify::efficient::EpsilonRemoverOutgoing::remove(automaton); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(res); } else { automaton::Automaton res = automaton::simplify::EpsilonRemoverOutgoing::remove(automaton); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(res); } } else if(algorithm.getValue() == "incoming") { automaton::Automaton automaton = alib::XmlDataFactory::fromTokens<automaton::Automaton>(tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); if(efficient.getValue()) { automaton::Automaton res = automaton::simplify::efficient::EpsilonRemoverIncoming::remove(automaton); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(res); } else { automaton::Automaton res = automaton::simplify::EpsilonRemoverIncoming::remove(automaton); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(res); } @@ -106,34 +107,34 @@ int main(int argc, char** argv) { if(alib::XmlDataFactory::first<automaton::Automaton>(tokens)) { automaton::Automaton automaton = alib::XmlDataFactory::fromTokens<automaton::Automaton>(tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); if(efficient.getValue()) { automaton::Automaton res = automaton::simplify::EpsilonRemoverIncoming::remove(automaton); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(res); } else { automaton::Automaton res = automaton::simplify::efficient::EpsilonRemoverIncoming::remove(automaton); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(res); } } else if(alib::XmlDataFactory::first<grammar::Grammar>(tokens)) { grammar::Grammar grammar = alib::XmlDataFactory::fromTokens<grammar::Grammar>(tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); grammar::Grammar res = grammar::simplify::EpsilonRemover::remove(grammar); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(res); } else @@ -142,10 +143,10 @@ int main(int argc, char** argv) { throw exception::AlibException("Invalid algorithm"); } - std::chrono::measurements::end(); - std::chrono::measurements::end(); + measurements::end(); + measurements::end(); - if(measure.getValue()) std::clog << std::chrono::measurements::results() << std::endl; + if(measure.getValue()) std::clog << measurements::results() << std::endl; return 0; } catch (const exception::AlibException& exception) { diff --git a/agenerate2/src/agenerate.cpp b/agenerate2/src/agenerate.cpp index 93ec7fbc01..dde984e7ac 100644 --- a/agenerate2/src/agenerate.cpp +++ b/agenerate2/src/agenerate.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <vector> #include <factory/XmlDataFactory.hpp> @@ -53,8 +54,8 @@ int main ( int argc, char * argv[] ) { if ( measure.isSet ( ) ) common::GlobalData::measure = true; - std::chrono::measurements::start ( "Overal", std::chrono::measurements::Type::OVERALL ); - std::chrono::measurements::start ( "Input read", std::chrono::measurements::Type::AUXILARY ); + measurements::start ( "Overal", measurements::Type::OVERALL ); + measurements::start ( "Input read", measurements::Type::AUXILIARY ); std::deque < sax::Token > stringTokens; @@ -79,36 +80,36 @@ int main ( int argc, char * argv[] ) { if ( ( type.getValue ( ) == "upTo" ) && upto.isSet ( ) ) { grammar::Grammar grammar = alib::XmlDataFactory::fromTokens < grammar::Grammar > ( grammarTokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); std::set < string::LinearString > res = grammar::generate::GenerateUpToLength::generate ( grammar, upto.getValue ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( type.getValue ( ) == "CYK" ) { grammar::Grammar grammar = alib::XmlDataFactory::fromTokens < grammar::Grammar > ( grammarTokens ); string::LinearString string = alib::XmlDataFactory::fromTokens < string::LinearString > ( stringTokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); bool res = grammar::generate::CockeYoungerKasami::generate ( grammar, string ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else { throw exception::AlibException ( "Invalid run type" ); } - std::chrono::measurements::end ( ); - std::chrono::measurements::end ( ); + measurements::end ( ); + measurements::end ( ); - if ( measure.getValue ( ) ) std::clog << std::chrono::measurements::results ( ) << std::endl; + if ( measure.getValue ( ) ) std::clog << measurements::results ( ) << std::endl; return 0; } catch ( const exception::AlibException & exception ) { diff --git a/agraphbench2/src/agraphbench.cpp b/agraphbench2/src/agraphbench.cpp index 8efb0e1c05..f20e46754a 100644 --- a/agraphbench2/src/agraphbench.cpp +++ b/agraphbench2/src/agraphbench.cpp @@ -1,5 +1,6 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <string> #include <exception/AlibException.h> #include <factory/XmlDataFactory.hpp> @@ -34,18 +35,18 @@ int main(int argc, char** argv) { graph::UndirectedGraph ug2 = graph::generate::RandomGraphFactory::generateUndirectedIsomorphicGraph(ug1); ug2.setEmbedding(graph::embedding::HopcroftTarjan::hopcrofttarjan(ug2)); - std::chrono::measurements::start("HopcroftWong", std::chrono::measurements::Type::OVERALL); + measurements::start("HopcroftWong", measurements::Type::OVERALL); if (!graph::isomorphism::HopcroftWong::hopcroftwong(ug1, ug2)) std::cout << "FAIL: hopcroftwong returned false!" << std::endl; - std::chrono::measurements::end(); - std::clog << std::chrono::measurements::results() << std::endl; + measurements::end(); + std::clog << measurements::results() << std::endl; if (!onlyhopcroft.isSet()) { - std::chrono::measurements::start("RecursiveByDefinition", std::chrono::measurements::Type::OVERALL); + measurements::start("RecursiveByDefinition", measurements::Type::OVERALL); if (!graph::isomorphism::Isomorphism::isomorphism(ug1, ug2)) std::cout << "FAIL: isomorphism returned false!" << std::endl; - std::chrono::measurements::end(); - std::clog << std::chrono::measurements::results() << std::endl; + measurements::end(); + std::clog << measurements::results() << std::endl; } return 0; diff --git a/aintegral2/src/aintegral.cpp b/aintegral2/src/aintegral.cpp index 7cecf8ecf1..fbdfa7c757 100644 --- a/aintegral2/src/aintegral.cpp +++ b/aintegral2/src/aintegral.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <factory/XmlDataFactory.hpp> #include <exception/AlibException.h> @@ -35,8 +36,8 @@ int main(int argc, char** argv) { if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start("Overal", std::chrono::measurements::Type::OVERALL); - std::chrono::measurements::start("Input read", std::chrono::measurements::Type::AUXILARY); + measurements::start("Overal", measurements::Type::OVERALL); + measurements::start("Input read", measurements::Type::AUXILIARY); std::deque<sax::Token> stringTokens; if(string.isSet()) { @@ -63,20 +64,20 @@ int main(int argc, char** argv) { string::LinearString stringData = alib::XmlDataFactory::fromTokens<string::LinearString>(stringTokens); regexp::RegExp regexpData = alib::XmlDataFactory::fromTokens<regexp::RegExp>(regexpTokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); regexp::RegExp res = regexp::RegExpIntegral::integral(regexpData, stringData); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(res); - std::chrono::measurements::end(); - std::chrono::measurements::end(); + measurements::end(); + measurements::end(); - if(measure.getValue()) std::clog << std::chrono::measurements::results() << std::endl; + if(measure.getValue()) std::clog << measurements::results() << std::endl; return 0; } catch(const exception::AlibException& exception) { diff --git a/alangop2/src/alangop.cpp b/alangop2/src/alangop.cpp index 52642cea1e..58fcf79462 100644 --- a/alangop2/src/alangop.cpp +++ b/alangop2/src/alangop.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <vector> #include <factory/XmlDataFactory.hpp> @@ -57,8 +58,8 @@ int main(int argc, char* argv[]) { if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start("Overal", std::chrono::measurements::Type::OVERALL); - std::chrono::measurements::start("Input read", std::chrono::measurements::Type::AUXILARY); + measurements::start("Overal", measurements::Type::OVERALL); + measurements::start("Input read", measurements::Type::AUXILIARY); std::deque<sax::Token> a1Tokens, a2Tokens; if(a1.isSet()) { @@ -86,94 +87,94 @@ int main(int argc, char* argv[]) { if( algorithm.getValue() == "unionEpsilon") { automaton::Automaton automaton2 = alib::XmlDataFactory::fromTokens<automaton::Automaton>(a2Tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); automaton::Automaton res = automaton::transform::AutomataUnionEpsilonTransition::unification(automaton1, automaton2); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( res ); } else if( algorithm.getValue() == "unionCartesian") { automaton::Automaton automaton2 = alib::XmlDataFactory::fromTokens<automaton::Automaton>(a2Tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); automaton::Automaton res = automaton::transform::AutomataUnionCartesianProduct::unification(automaton1, automaton2); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( res ); } else if( algorithm.getValue() == "concatenationEpsilon") { automaton::Automaton automaton2 = alib::XmlDataFactory::fromTokens<automaton::Automaton>(a2Tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); automaton::Automaton res = automaton::transform::AutomataConcatenationEpsilonTransition::concatenation(automaton1, automaton2); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( res ); } else if( algorithm.getValue() == "concatenation") { automaton::Automaton automaton2 = alib::XmlDataFactory::fromTokens<automaton::Automaton>(a2Tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); automaton::Automaton res = automaton::transform::AutomataConcatenation::concatenation(automaton1, automaton2); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( res ); } else if( algorithm.getValue() == "intersectionCartesian") { automaton::Automaton automaton2 = alib::XmlDataFactory::fromTokens<automaton::Automaton>(a2Tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); automaton::Automaton res = automaton::transform::AutomataIntersectionCartesianProduct::intersection(automaton1, automaton2); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( res ); } else if( algorithm.getValue() == "iteration") { - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); automaton::Automaton res = automaton::transform::AutomatonIteration::iteration(automaton1); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( res ); } else if( algorithm.getValue() == "iterationEpsilon") { - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); automaton::Automaton res = automaton::transform::AutomatonIterationEpsilonTransition::iteration(automaton1); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( res ); } else { throw exception::AlibException( "Invalid algorithm" ); } - std::chrono::measurements::end(); - std::chrono::measurements::end(); + measurements::end(); + measurements::end(); - if(measure.getValue()) std::clog << std::chrono::measurements::results() << std::endl; + if(measure.getValue()) std::clog << measurements::results() << std::endl; return 0; } catch( const exception::AlibException & exception ) { diff --git a/alib2data/src/factory/XmlDataFactory.hpp b/alib2data/src/factory/XmlDataFactory.hpp index d859be15a8..165fb01404 100644 --- a/alib2data/src/factory/XmlDataFactory.hpp +++ b/alib2data/src/factory/XmlDataFactory.hpp @@ -16,7 +16,6 @@ #include "../sax/SaxComposeInterface.h" #include "../XmlApi.hpp" #include "../exception/AlibException.h" -#include <chrono> namespace alib { @@ -88,9 +87,9 @@ public: if ( alib::xmlApi < exception::AlibException >::first ( context ) ) throw alib::xmlApi < exception::AlibException >::parse ( context ); - std::chrono::measurements::start ( "XML Parser", std::chrono::measurements::Type::INIT ); + // measurements::start ( "XML Parser", measurements::Type::INIT ); T res = alib::xmlApi < T >::parse ( context ); - std::chrono::measurements::end ( ); + // measurements::end ( ); if ( context != tokens.end ( ) ) throw exception::AlibException ( "Unexpeted tokens at the end of the xml" ); @@ -160,9 +159,9 @@ public: template < class T > static std::deque < sax::Token > toTokens ( const T & data ) { xmlApiOutputContext context; - std::chrono::measurements::start ( "XML Composer", std::chrono::measurements::Type::FINALIZE ); + // measurements::start ( "XML Composer", measurements::Type::FINALIZE ); alib::xmlApi < T >::compose ( context, data ); - std::chrono::measurements::end ( ); + // measurements::end ( ); return context; } diff --git a/alib2data/src/sax/SaxComposeInterface.cpp b/alib2data/src/sax/SaxComposeInterface.cpp index 2400cd45e2..71db7496bc 100644 --- a/alib2data/src/sax/SaxComposeInterface.cpp +++ b/alib2data/src/sax/SaxComposeInterface.cpp @@ -13,7 +13,6 @@ #include <sstream> #include <deque> #include "ComposerException.h" -#include <chrono> namespace sax { @@ -52,7 +51,7 @@ void SaxComposeInterface::printStream(std::ostream& out, const std::deque<Token> } void SaxComposeInterface::xmlSAXUserPrint(xmlTextWriterPtr writer, const std::deque<Token>& in) { - std::chrono::measurements::start("Sax Composer", std::chrono::measurements::Type::FINALIZE); + // measurements::start("Sax Composer", measurements::Type::FINALIZE); xmlTextWriterStartDocument(writer, NULL, NULL, NULL); #ifdef DEBUG std::deque<Token> stack; @@ -95,7 +94,7 @@ void SaxComposeInterface::xmlSAXUserPrint(xmlTextWriterPtr writer, const std::de } } xmlTextWriterEndDocument(writer); - std::chrono::measurements::end(); + // measurements::end(); } } /* namespace sax */ diff --git a/alib2data/src/sax/SaxParseInterface.cpp b/alib2data/src/sax/SaxParseInterface.cpp index ff0cefeb29..ecd9171937 100644 --- a/alib2data/src/sax/SaxParseInterface.cpp +++ b/alib2data/src/sax/SaxParseInterface.cpp @@ -13,7 +13,6 @@ #include <iostream> #include <algorithm> #include "../exception/AlibException.h" -#include <chrono> namespace sax { @@ -55,7 +54,7 @@ void SaxParseInterface::parseStream(std::istream& in, std::deque<Token>& out) { int SaxParseInterface::xmlSAXUserParse(xmlTextReaderPtr reader, std::deque<Token>& out) { int ret = xmlTextReaderRead(reader); - std::chrono::measurements::start("Sax Parser", std::chrono::measurements::Type::INIT); + // measurements::start("Sax Parser", measurements::Type::INIT); while (ret == 1) { xmlChar* name = xmlTextReaderName(reader); xmlChar* value; @@ -92,7 +91,7 @@ int SaxParseInterface::xmlSAXUserParse(xmlTextReaderPtr reader, std::deque<Token ret = xmlTextReaderRead(reader); } - std::chrono::measurements::end(); + // measurements::end(); return ret; } diff --git a/alib2measure/src/measure b/alib2measure/src/measure new file mode 100644 index 0000000000..dff12f84bd --- /dev/null +++ b/alib2measure/src/measure @@ -0,0 +1,10 @@ +/* + * Author: Radovan Cerveny + */ + +#ifndef MEASURE_HPP_ +#define MEASURE_HPP_ + +#include "measurements/measurements.hpp" + +#endif /* MEASURE_HPP_ */ diff --git a/alib2measure/src/measurements/MeasurementCmdLine.hpp b/alib2measure/src/measurements/MeasurementCmdLine.hpp deleted file mode 100644 index cda34b4122..0000000000 --- a/alib2measure/src/measurements/MeasurementCmdLine.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Author: Radovan Cerveny - */ - -#ifndef MEASUREMENT_CMD_LINE_HPP_ -#define MEASUREMENT_CMD_LINE_HPP_ - -#include <tclap/CmdLine.h> -#include <common/GlobalData.h> -#include <vector> -#include "sax/SaxComposeInterface.h" -#include "measurements.hpp" -#include "MeasurementResults.hpp" - -namespace measurements { - -class MeasurementCmdLine { - TCLAP::SwitchArg measure; - - std::vector< std::string > measurementOutputOptions; - TCLAP::ValuesConstraint< std::string > measurementOutputOptionsVals; - TCLAP::ValueArg< std::string > measurementOutput; - - MeasurementCmdLine ( ) : measure ( "m", "measure", "Measure times", false ), - measurementOutputOptions{"list", "tree", "xml"}, - measurementOutputOptionsVals ( measurementOutputOptions ), - measurementOutput ( "", "measurement-output", "How to output measurement data", false, "list", &measurementOutputOptionsVals ) {} - - static MeasurementCmdLine INSTANCE; - -public: - static void setupTCLAPArgs ( TCLAP::CmdLine& cmd ) { - cmd.add ( INSTANCE.measure ); - cmd.add ( INSTANCE.measurementOutput ); - } - - static void setupGlobalData ( ) { - if ( INSTANCE.measure.isSet ( ) ) - common::GlobalData::measure = true; - } - - static void outputMeasurements ( ) { - if ( INSTANCE.measure.getValue ( ) ) { - const std::string& output = INSTANCE.measurementOutput.getValue ( ); - if ( output == "list" ) - std::clog << measurements::MeasurementFormat::LIST << measurements::results ( ) << std::endl; - else if ( output == "tree" ) - std::clog << measurements::MeasurementFormat::TREE << measurements::results ( ) << std::endl; - else if ( output == "xml" ) - std::clog << measurements::MeasurementFormat::XML << measurements::results ( ) << std::endl; - } - } -}; - -MeasurementCmdLine MeasurementCmdLine::INSTANCE; -} - -#endif /* MEASUREMENT_CMD_LINE_HPP_ */ diff --git a/alib2measure/src/measurements/measurements.cpp b/alib2measure/src/measurements/measurements.cpp new file mode 100644 index 0000000000..1f41abdfe7 --- /dev/null +++ b/alib2measure/src/measurements/measurements.cpp @@ -0,0 +1,35 @@ +/* + * Author: Radovan Cerveny + */ + +#include "measurements.hpp" + +namespace measurements { + +void start ( measurements::stealth_string name, measurements::Type type ) { + MeasurementEngine::INSTANCE.push_measurement_frame ( std::move ( name ), type ); +} + +void end ( ) { + MeasurementEngine::INSTANCE.pop_measurement_frame ( ); +} + +void reset ( ) { + MeasurementEngine::INSTANCE.reset_measurements ( ); +} + +MeasurementResults results ( ) { + return MeasurementEngine::INSTANCE.get_results ( ); +} + +template < typename Hint > +void hint ( Hint hint ) { + MeasurementEngine::INSTANCE.hint ( std::move ( hint ) ); +} + +template < > +void hint ( MemoryHint hint ) { + MeasurementEngine::INSTANCE.hint ( std::move ( hint ) ); +} + +} diff --git a/alib2measure/src/measurements/measurements.hpp b/alib2measure/src/measurements/measurements.hpp index f3bf7f2a6d..e2de451428 100644 --- a/alib2measure/src/measurements/measurements.hpp +++ b/alib2measure/src/measurements/measurements.hpp @@ -9,27 +9,16 @@ namespace measurements { -void start ( measurements::stealth_string name, measurements::Type type ) { - MeasurementEngine::INSTANCE.push_measurement_frame ( std::move ( name ), type ); -} +void start ( measurements::stealth_string name, measurements::Type type ); -void end ( ) { - MeasurementEngine::INSTANCE.pop_measurement_frame ( ); -} +void end ( ); -void reset ( ) { - MeasurementEngine::INSTANCE.reset_measurements ( ); -} +void reset ( ); -MeasurementResults results ( ) { - return MeasurementEngine::INSTANCE.get_results ( ); -} +MeasurementResults results ( ); template < typename Hint > -void hint ( Hint hint ) { - MeasurementEngine::INSTANCE.hint ( std::move ( hint ) ); -} - +void hint ( Hint hint ); } #endif /* MEASUREMENTS_HPP_ */ diff --git a/alib2std/src/extensions/chrono.cpp b/alib2std/src/extensions/chrono.cpp index abc4563800..66eafc1899 100644 --- a/alib2std/src/extensions/chrono.cpp +++ b/alib2std/src/extensions/chrono.cpp @@ -26,8 +26,8 @@ measurements::Filter measurements::Filter::FINALIZE = { true, measurements::Type measurements::Filter measurements::Filter::NO_FINALIZE = { false, measurements::Type::FINALIZE }; measurements::Filter measurements::Filter::MAIN = { true, measurements::Type::MAIN }; measurements::Filter measurements::Filter::NO_MAIN = { false, measurements::Type::MAIN }; -measurements::Filter measurements::Filter::AUXILARY = { true, measurements::Type::AUXILARY }; -measurements::Filter measurements::Filter::NO_AUXILARY = { false, measurements::Type::AUXILARY }; +measurements::Filter measurements::Filter::AUXILIARY = { true, measurements::Type::AUXILIARY }; +measurements::Filter measurements::Filter::NO_AUXILIARY = { false, measurements::Type::AUXILIARY }; const int measurements::measurements_format_index = std::ios::xalloc(); const int measurements::measurements_filter_index = std::ios::xalloc(); @@ -120,8 +120,8 @@ std::ostream& operator<<(std::ostream& out, measurements::Type type) { case measurements::Type::MAIN: out << "MAIN"; break; - case measurements::Type::AUXILARY: - out << "AUXILARY"; + case measurements::Type::AUXILIARY: + out << "AUXILIARY"; break; case measurements::Type::OVERALL: out << "OVERALL"; diff --git a/alib2std/src/extensions/chrono.hpp b/alib2std/src/extensions/chrono.hpp index 5c8660c39a..8567fe74da 100644 --- a/alib2std/src/extensions/chrono.hpp +++ b/alib2std/src/extensions/chrono.hpp @@ -38,12 +38,12 @@ public: INIT = 2, FINALIZE = 4, MAIN = 8, - AUXILARY = 16 + AUXILIARY = 16 }; struct Format { unsigned type; - + static Format LIST; static Format TREE; }; @@ -62,8 +62,8 @@ public: static Filter NO_FINALIZE; static Filter MAIN; static Filter NO_MAIN; - static Filter AUXILARY; - static Filter NO_AUXILARY; + static Filter AUXILIARY; + static Filter NO_AUXILIARY; }; diff --git a/alib2std/test-src/extensions/ChronoTest.cpp b/alib2std/test-src/extensions/ChronoTest.cpp index 9797999410..e64b6e7841 100644 --- a/alib2std/test-src/extensions/ChronoTest.cpp +++ b/alib2std/test-src/extensions/ChronoTest.cpp @@ -33,11 +33,11 @@ void ChronoTest::testChrono2() { std::chrono::measurements::start("main", std::chrono::measurements::Type::MAIN); std::this_thread::sleep_for(std::chrono::milliseconds(20)); - std::chrono::measurements::start("aux", std::chrono::measurements::Type::AUXILARY); + std::chrono::measurements::start("aux", std::chrono::measurements::Type::AUXILIARY); std::this_thread::sleep_for(std::chrono::milliseconds(40)); std::chrono::measurements::end(); std::this_thread::sleep_for(std::chrono::milliseconds(80)); - std::chrono::measurements::start("aux", std::chrono::measurements::Type::AUXILARY); + std::chrono::measurements::start("aux", std::chrono::measurements::Type::AUXILIARY); std::this_thread::sleep_for(std::chrono::milliseconds(40)); std::chrono::measurements::end(); std::this_thread::sleep_for(std::chrono::milliseconds(80)); @@ -45,7 +45,7 @@ void ChronoTest::testChrono2() { std::chrono::measurements::start("fin", std::chrono::measurements::Type::FINALIZE); std::this_thread::sleep_for(std::chrono::milliseconds(30)); - std::chrono::measurements::start("aux", std::chrono::measurements::Type::AUXILARY); + std::chrono::measurements::start("aux", std::chrono::measurements::Type::AUXILIARY); std::this_thread::sleep_for(std::chrono::milliseconds(40)); std::chrono::measurements::end(); std::this_thread::sleep_for(std::chrono::milliseconds(80)); diff --git a/alphabetManip2/src/alphabetManip.cpp b/alphabetManip2/src/alphabetManip.cpp index e53c459501..02c2ca2095 100644 --- a/alphabetManip2/src/alphabetManip.cpp +++ b/alphabetManip2/src/alphabetManip.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <vector> #include <factory/XmlDataFactory.hpp> @@ -23,25 +24,25 @@ void process ( T & data, TCLAP::ValueArg < std::string > & operation, std::deque typedef typename std::remove_const < typename std::remove_reference < decltype ( data.getAlphabet ( ) ) >::type >::type alphabetType; if ( operation.getValue ( ) == "get" ) { - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); const alphabetType & res = data.getAlphabet ( ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( operation.getValue ( ) == "add" ) { alphabetType symbols = alib::XmlDataFactory::fromTokens < alphabetType > ( argumentTokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); data.extendAlphabet ( symbols ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( data ); } else if ( operation.getValue ( ) == "set" ) { @@ -84,8 +85,8 @@ int main ( int argc, char * argv[] ) { if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start ( "Overal", std::chrono::measurements::Type::OVERALL ); - std::chrono::measurements::start ( "Input read", std::chrono::measurements::Type::AUXILARY ); + measurements::start ( "Overal", measurements::Type::OVERALL ); + measurements::start ( "Input read", measurements::Type::AUXILIARY ); std::deque < sax::Token > inputTokens; @@ -120,10 +121,10 @@ int main ( int argc, char * argv[] ) { throw exception::AlibException ( "Invalid data type" ); } - std::chrono::measurements::end ( ); - std::chrono::measurements::end ( ); + measurements::end ( ); + measurements::end ( ); - if ( measure.getValue ( ) ) std::clog << std::chrono::measurements::results ( ) << std::endl; + if ( measure.getValue ( ) ) std::clog << measurements::results ( ) << std::endl; return 0; } catch ( const exception::AlibException & exception ) { diff --git a/aminimize2/src/aminimize.cpp b/aminimize2/src/aminimize.cpp index c67a8d9aa7..0ef5e1c857 100644 --- a/aminimize2/src/aminimize.cpp +++ b/aminimize2/src/aminimize.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <exception/AlibException.h> #include <factory/XmlDataFactory.hpp> @@ -40,8 +41,8 @@ int main(int argc, char** argv) { if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start("Overal", std::chrono::measurements::Type::OVERALL); - std::chrono::measurements::start("Input read", std::chrono::measurements::Type::AUXILARY); + measurements::start("Overal", measurements::Type::OVERALL); + measurements::start("Input read", measurements::Type::AUXILIARY); std::deque<sax::Token> tokens; if(input.isSet()) { @@ -56,31 +57,31 @@ int main(int argc, char** argv) { automaton::Automaton automaton = alib::XmlDataFactory::fromTokens<automaton::Automaton>(tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); if(algorithm.getValue() == "hopcroft") { automaton::Automaton res = automaton::simplify::Minimize::minimize(automaton); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(res); } else if(algorithm.getValue() == "brzozowski") { automaton::Automaton res = automaton::simplify::MinimizeBrzozowski::minimize(automaton); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(res); } else { throw exception::AlibException("Unknown algorithm selected."); } - std::chrono::measurements::end(); - std::chrono::measurements::end(); + measurements::end(); + measurements::end(); - if(measure.getValue()) std::clog << std::chrono::measurements::results() << std::endl; + if(measure.getValue()) std::clog << measurements::results() << std::endl; return 0; } catch (const exception::AlibException& exception) { diff --git a/anormalize2/src/anormalize.cpp b/anormalize2/src/anormalize.cpp index d233ca8a0a..f4d8ff3b07 100644 --- a/anormalize2/src/anormalize.cpp +++ b/anormalize2/src/anormalize.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include "exception/AlibException.h" #include "factory/XmlDataFactory.hpp" @@ -65,8 +66,8 @@ int main ( int argc, char * * argv ) { if ( measure.isSet ( ) ) common::GlobalData::measure = true; - std::chrono::measurements::start ( "Overal", std::chrono::measurements::Type::OVERALL ); - std::chrono::measurements::start ( "Input read", std::chrono::measurements::Type::AUXILARY ); + measurements::start ( "Overal", measurements::Type::OVERALL ); + measurements::start ( "Input read", measurements::Type::AUXILIARY ); std::deque < sax::Token > tokens; @@ -82,119 +83,119 @@ int main ( int argc, char * * argv ) { if ( labels.getValue ( ) == "automaton" ) { automaton::Automaton automaton = alib::XmlDataFactory::fromTokens < automaton::Automaton > ( tokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); automaton::Automaton res = automaton::simplify::Normalize::normalize ( automaton ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( labels.getValue ( ) == "grammar" ) { // grammar::Grammar grammar = alib::XmlDataFactory::fromTokens<grammar::Grammar>( tokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); // grammar::Grammar res = grammar::simplify::Normalize::normalize(grammar); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); // alib::XmlDataFactory::toStdout(res); } else if ( alphabet.getValue ( ) == "string" ) { string::String string = alib::XmlDataFactory::fromTokens < string::String > ( tokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); string::String res = string::simplify::NormalizeAlphabet::normalize ( string ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( form.getValue ( ) == "leftRG" ) { grammar::Grammar grammar = alib::XmlDataFactory::fromTokens < grammar::Grammar > ( tokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); grammar::LeftRG res = grammar::convert::ToGrammarLeftRG::convert ( grammar ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( form.getValue ( ) == "rightRG" ) { grammar::Grammar grammar = alib::XmlDataFactory::fromTokens < grammar::Grammar > ( tokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); grammar::RightRG res = grammar::convert::ToGrammarRightRG::convert ( grammar ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( form.getValue ( ) == "singleInitialState" ) { automaton::Automaton automaton = alib::XmlDataFactory::fromTokens < automaton::Automaton > ( tokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); automaton::Automaton res = automaton::simplify::SingleInitialState::convert ( automaton ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( form.getValue ( ) == "CNF" ) { grammar::Grammar grammar = alib::XmlDataFactory::fromTokens < grammar::Grammar > ( tokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); grammar::Grammar res = grammar::simplify::ToCNF::convert ( grammar ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( form.getValue ( ) == "GNF" ) { grammar::Grammar grammar = alib::XmlDataFactory::fromTokens < grammar::Grammar > ( tokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); grammar::Grammar res = grammar::simplify::ToGNF::convert ( grammar ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( form.getValue ( ) == "LL1" ) { grammar::Grammar grammar = alib::XmlDataFactory::fromTokens < grammar::Grammar > ( tokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); grammar::Grammar res = grammar::parsing::DeterministicLL1Grammar::convert ( grammar ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else { throw exception::AlibException ( "Invalid normalize command" ); } - std::chrono::measurements::end ( ); - std::chrono::measurements::end ( ); + measurements::end ( ); + measurements::end ( ); - if ( measure.getValue ( ) ) std::clog << std::chrono::measurements::results ( ) << std::endl; + if ( measure.getValue ( ) ) std::clog << measurements::results ( ) << std::endl; return 0; } catch ( const exception::AlibException & exception ) { diff --git a/arand2/src/arand.cpp b/arand2/src/arand.cpp index ac10f296ed..6b100fac2e 100644 --- a/arand2/src/arand.cpp +++ b/arand2/src/arand.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <factory/XmlDataFactory.hpp> #include "automaton/generate/RandomAutomatonFactory.h" @@ -76,7 +77,7 @@ int main ( int argc, char * argv[] ) { if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start ( "Overal", std::chrono::measurements::Type::OVERALL ); + measurements::start ( "Overal", measurements::Type::OVERALL ); if ( !type.isSet ( ) ) throw exception::AlibException ( "Type is not defined." ); @@ -85,12 +86,12 @@ int main ( int argc, char * argv[] ) { // TODO: floating point arithmetic throw exception::AlibException ( "You must specify density as a number between 1 and 100." ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); automaton::NFA res = automaton::generate::RandomAutomatonFactory::generateNFA ( states.getValue ( ), alphabetSize.getValue ( ), randomizedAlphabet.getValue ( ), density.getValue ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( type.getValue ( ) == "CFG" ) { @@ -98,76 +99,76 @@ int main ( int argc, char * argv[] ) { // TODO: floating point arithmetic throw exception::AlibException ( "You must specify density as a number between 1 and 100." ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); grammar::CFG res = grammar::generate::RandomGrammarFactory::generateCFG ( nonterminals.getValue ( ), alphabetSize.getValue ( ), randomizedAlphabet.getValue ( ), density.getValue ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( type.getValue ( ) == "RE" ) { - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); regexp::UnboundedRegExp res = regexp::generate::RandomRegExpFactory::generateUnboundedRegExp ( terminalNodes.getValue ( ), height.getValue ( ), alphabetSize.getValue ( ), randomizedAlphabet.getValue ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( type.getValue ( ) == "ST" ) { - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); string::LinearString res = string::generate::RandomStringFactory::generateLinearString ( length.getValue ( ), alphabetSize.getValue ( ), randomizedAlphabet.getValue ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( type.getValue ( ) == "UT" ) { - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); tree::UnrankedTree res = tree::generate::RandomTreeFactory::generateUnrankedTree ( height.getValue ( ), nodes.getValue ( ), alphabetSize.getValue ( ), randomizedAlphabet.getValue ( ), maxRank.getValue ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( type.getValue ( ) == "UP" ) { - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); tree::UnrankedPattern res = tree::generate::RandomTreeFactory::generateUnrankedPattern ( height.getValue ( ), nodes.getValue ( ), alphabetSize.getValue ( ), randomizedAlphabet.getValue ( ), maxRank.getValue ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( type.getValue ( ) == "RT" ) { - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); tree::RankedTree res = tree::generate::RandomTreeFactory::generateRankedTree ( height.getValue ( ), nodes.getValue ( ), alphabetSize.getValue ( ), randomizedAlphabet.getValue ( ), maxRank.getValue ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( type.getValue ( ) == "RP" ) { - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); tree::RankedPattern res = tree::generate::RandomTreeFactory::generateRankedPattern ( height.getValue ( ), nodes.getValue ( ), alphabetSize.getValue ( ), randomizedAlphabet.getValue ( ), maxRank.getValue ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else { throw exception::AlibException ( "Invalid type." ); } - std::chrono::measurements::end ( ); - std::chrono::measurements::end ( ); + measurements::end ( ); + measurements::end ( ); - if ( measure.getValue ( ) ) std::clog << std::chrono::measurements::results ( ) << std::endl; + if ( measure.getValue ( ) ) std::clog << measurements::results ( ) << std::endl; return 0; } catch ( const exception::AlibException & exception ) { diff --git a/araw2/src/araw.cpp b/araw2/src/araw.cpp index 8bd6393a97..6d5432e15e 100644 --- a/araw2/src/araw.cpp +++ b/araw2/src/araw.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <string> #include <exception/AlibException.h> #include <RawApi.hpp> @@ -53,8 +54,8 @@ int main(int argc, char** argv) { if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start("Overal", std::chrono::measurements::Type::OVERALL); - std::chrono::measurements::start("Input read", std::chrono::measurements::Type::AUXILARY); + measurements::start("Overal", measurements::Type::OVERALL); + measurements::start("Input read", measurements::Type::AUXILIARY); if(tree_from_raw.getValue()) { std::deque<sax::Token> tokens; @@ -71,8 +72,8 @@ int main(int argc, char** argv) { std::deque<sax::Token>::iterator iter = tokens.begin(); tree::Tree tree = alib::FromRawParsers::treeParser.parseTree(iter); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(tree); } else if(tree_to_raw.getValue()) { @@ -89,8 +90,8 @@ int main(int argc, char** argv) { tree::Tree tree = alib::XmlDataFactory::fromTokens<tree::Tree>(tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); std::deque<sax::Token> tokens2; tree::TreeToRawComposer::compose(tokens2, tree); @@ -99,10 +100,10 @@ int main(int argc, char** argv) { throw exception::AlibException("Invalid input format specified"); } - std::chrono::measurements::end(); - std::chrono::measurements::end(); + measurements::end(); + measurements::end(); - if(measure.getValue()) std::clog << std::chrono::measurements::results() << std::endl; + if(measure.getValue()) std::clog << measurements::results() << std::endl; return 0; } catch(const exception::AlibException& exception) { diff --git a/arename2/src/arename.cpp b/arename2/src/arename.cpp index 8805678a33..c7135eff6f 100644 --- a/arename2/src/arename.cpp +++ b/arename2/src/arename.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include "exception/AlibException.h" #include "factory/XmlDataFactory.hpp" @@ -33,8 +34,8 @@ int main(int argc, char** argv) { if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start("Overal", std::chrono::measurements::Type::OVERALL); - std::chrono::measurements::start("Input read", std::chrono::measurements::Type::AUXILARY); + measurements::start("Overal", measurements::Type::OVERALL); + measurements::start("Input read", measurements::Type::AUXILIARY); std::deque<sax::Token> tokens; if(input.isSet()) { @@ -49,20 +50,20 @@ int main(int argc, char** argv) { automaton::Automaton automaton = alib::XmlDataFactory::fromTokens<automaton::Automaton>(tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); automaton::Automaton res = automaton::simplify::Rename::rename(automaton); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(res); - std::chrono::measurements::end(); - std::chrono::measurements::end(); + measurements::end(); + measurements::end(); - if(measure.getValue()) std::clog << std::chrono::measurements::results() << std::endl; + if(measure.getValue()) std::clog << measurements::results() << std::endl; return 0; } catch (const exception::AlibException& exception) { diff --git a/areverse2/src/areverse.cpp b/areverse2/src/areverse.cpp index 9718a8b7ac..18fd8da8d2 100644 --- a/areverse2/src/areverse.cpp +++ b/areverse2/src/areverse.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <iostream> #include "exception/AlibException.h" @@ -34,8 +35,8 @@ int main(int argc, char** argv) { if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start("Overal", std::chrono::measurements::Type::OVERALL); - std::chrono::measurements::start("Input read", std::chrono::measurements::Type::AUXILARY); + measurements::start("Overal", measurements::Type::OVERALL); + measurements::start("Input read", measurements::Type::AUXILIARY); std::deque<sax::Token> tokens; if(input.isSet()) { @@ -50,20 +51,20 @@ int main(int argc, char** argv) { automaton::Automaton automaton = alib::XmlDataFactory::fromTokens<automaton::Automaton>(tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); automaton::Automaton res = automaton::transform::Reverse::convert(automaton); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout(res); - std::chrono::measurements::end(); - std::chrono::measurements::end(); + measurements::end(); + measurements::end(); - if(measure.getValue()) std::clog << std::chrono::measurements::results() << std::endl; + if(measure.getValue()) std::clog << measurements::results() << std::endl; return 0; } catch (const exception::AlibException& exception) { diff --git a/arun2/src/arun.cpp b/arun2/src/arun.cpp index 93a6ba3e57..a2d44f50b9 100644 --- a/arun2/src/arun.cpp +++ b/arun2/src/arun.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <vector> #include <factory/XmlDataFactory.hpp> @@ -55,8 +56,8 @@ int main(int argc, char* argv[]) { if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start("Overal", std::chrono::measurements::Type::OVERALL); - std::chrono::measurements::start("Input read", std::chrono::measurements::Type::AUXILARY); + measurements::start("Overal", measurements::Type::OVERALL); + measurements::start("Input read", measurements::Type::AUXILIARY); std::deque<sax::Token> inputTokens; if(input.isSet()) { @@ -83,38 +84,38 @@ int main(int argc, char* argv[]) { alib::Object inputData = alib::XmlDataFactory::fromTokens<alib::Object>(inputTokens); automaton::Automaton automatonData = alib::XmlDataFactory::fromTokens<automaton::Automaton>(automatonTokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); if( type.getValue() == "occurrences") { std::set<unsigned> res = automaton::run::Occurrences::occurrences(automatonData, inputData); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( res ); } else if( type.getValue() == "accept") { bool res = automaton::run::Accept::accept(automatonData, inputData); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( res ); } else if( type.getValue() == "result") { label::Label res = automaton::run::Result::result(automatonData, inputData); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( res ); } else { throw exception::AlibException( "Invalid run type" ); } - std::chrono::measurements::end(); - std::chrono::measurements::end(); + measurements::end(); + measurements::end(); - if(measure.getValue()) std::clog << std::chrono::measurements::results() << std::endl; + if(measure.getValue()) std::clog << measurements::results() << std::endl; return 0; } catch ( const exception::AlibException & exception ) { diff --git a/astat2/src/astat.cpp b/astat2/src/astat.cpp index 54e59d2667..886994c26f 100644 --- a/astat2/src/astat.cpp +++ b/astat2/src/astat.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <vector> #include <factory/XmlDataFactory.hpp> @@ -123,8 +124,8 @@ int main ( int argc, char * argv[] ) { if ( measure.isSet ( ) ) common::GlobalData::measure = true; - std::chrono::measurements::start ( "Overal", std::chrono::measurements::Type::OVERALL ); - std::chrono::measurements::start ( "Input read", std::chrono::measurements::Type::AUXILARY ); + measurements::start ( "Overal", measurements::Type::OVERALL ); + measurements::start ( "Input read", measurements::Type::AUXILIARY ); PrintingOptions printingOption = translatePrintingOptions ( presentation.getValue ( ) ); @@ -162,8 +163,8 @@ int main ( int argc, char * argv[] ) { automaton::Automaton automaton = alib::XmlDataFactory::fromTokens < automaton::Automaton > ( tokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Stats print", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Stats print", measurements::Type::MAIN ); AutomataStat::stat ( automaton, settings ); } else if ( alib::XmlDataFactory::first < grammar::Grammar > ( tokens ) && grammar.isSet ( ) ) { @@ -186,8 +187,8 @@ int main ( int argc, char * argv[] ) { grammar::Grammar grammar = alib::XmlDataFactory::fromTokens < grammar::Grammar > ( tokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Stats print", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Stats print", measurements::Type::MAIN ); GrammarStat::stat ( grammar, settings ); } else if ( alib::XmlDataFactory::first < regexp::RegExp > ( tokens ) && regexp.isSet ( ) ) { @@ -204,8 +205,8 @@ int main ( int argc, char * argv[] ) { regexp::RegExp regexp = alib::XmlDataFactory::fromTokens < regexp::RegExp > ( tokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Stats print", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Stats print", measurements::Type::MAIN ); RegExpStat::stat ( regexp, settings ); } else if ( alib::XmlDataFactory::first < string::String > ( tokens ) && string.isSet ( ) ) { @@ -222,8 +223,8 @@ int main ( int argc, char * argv[] ) { string::String string = alib::XmlDataFactory::fromTokens < string::String > ( tokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Stats print", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Stats print", measurements::Type::MAIN ); StringStat::stat ( string, settings ); } else if ( alib::XmlDataFactory::first < tree::Tree > ( tokens ) && tree.isSet ( ) ) { @@ -240,8 +241,8 @@ int main ( int argc, char * argv[] ) { tree::Tree tree = alib::XmlDataFactory::fromTokens < tree::Tree > ( tokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Stats print", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Stats print", measurements::Type::MAIN ); TreeStat::stat ( tree, settings ); } else if ( alib::XmlDataFactory::first < container::ObjectsSet > ( tokens ) && set.isSet ( ) ) { @@ -250,8 +251,8 @@ int main ( int argc, char * argv[] ) { container::ObjectsSet data = alib::XmlDataFactory::fromTokens < container::ObjectsSet > ( tokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Stats print", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Stats print", measurements::Type::MAIN ); SetStat::stat ( data, settings ); } else if ( alib::XmlDataFactory::first < label::LabelSetLabel > ( tokens ) && set.isSet ( ) ) { @@ -260,8 +261,8 @@ int main ( int argc, char * argv[] ) { label::LabelSetLabel data = alib::XmlDataFactory::fromTokens < label::LabelSetLabel > ( tokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Stats print", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Stats print", measurements::Type::MAIN ); SetStat::stat ( data, settings ); } else if ( alib::XmlDataFactory::first < alphabet::SymbolSetSymbol > ( tokens ) && set.isSet ( ) ) { @@ -270,18 +271,18 @@ int main ( int argc, char * argv[] ) { alphabet::SymbolSetSymbol data = alib::XmlDataFactory::fromTokens < alphabet::SymbolSetSymbol > ( tokens ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Stats print", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Stats print", measurements::Type::MAIN ); SetStat::stat ( data, settings ); } else { throw exception::AlibException ( "Input not recognized." ); } - std::chrono::measurements::end ( ); - std::chrono::measurements::end ( ); + measurements::end ( ); + measurements::end ( ); - if ( measure.getValue ( ) ) std::clog << std::chrono::measurements::results ( ) << std::endl; + if ( measure.getValue ( ) ) std::clog << measurements::results ( ) << std::endl; return 0; } catch ( const exception::AlibException & exception ) { diff --git a/astringology2/src/astringology.cpp b/astringology2/src/astringology.cpp index ff4de1725c..904cd2a2ab 100644 --- a/astringology2/src/astringology.cpp +++ b/astringology2/src/astringology.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <vector> #include <factory/XmlDataFactory.hpp> @@ -95,8 +96,8 @@ int main ( int argc, char * argv[] ) { } else { } - std::chrono::measurements::start ( "Overal", std::chrono::measurements::Type::OVERALL ); - std::chrono::measurements::start ( "Input read", std::chrono::measurements::Type::AUXILARY ); + measurements::start ( "Overal", measurements::Type::OVERALL ); + measurements::start ( "Input read", measurements::Type::AUXILIARY ); std::deque < std::deque < sax::Token > > subjectTokens; @@ -140,100 +141,100 @@ int main ( int argc, char * argv[] ) { string::String subject = alib::XmlDataFactory::fromTokens < string::String > ( subjectTokens.front ( ) ); string::String pattern = alib::XmlDataFactory::fromTokens < string::String > ( patternTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); std::set < unsigned > res = stringology::exact::ExactFactorMatch::match ( subject, pattern ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( algorithm.getValue ( ) == "boyerMooreHorspool" ) { string::String subject = alib::XmlDataFactory::fromTokens < string::String > ( subjectTokens.front ( ) ); string::String pattern = alib::XmlDataFactory::fromTokens < string::String > ( patternTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); std::set < unsigned > res = stringology::exact::BoyerMooreHorspool::match ( subject, pattern ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( algorithm.getValue ( ) == "reversedBoyerMooreHorspool" ) { string::String subject = alib::XmlDataFactory::fromTokens < string::String > ( subjectTokens.front ( ) ); string::String pattern = alib::XmlDataFactory::fromTokens < string::String > ( patternTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); std::set < unsigned > res = stringology::exact::ReversedBoyerMooreHorspool::match ( subject, pattern ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( algorithm.getValue ( ) == "deadZoneUsingBadCharacterShift" ) { string::String subject = alib::XmlDataFactory::fromTokens < string::String > ( subjectTokens.front ( ) ); string::String pattern = alib::XmlDataFactory::fromTokens < string::String > ( patternTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); std::set < unsigned > res = stringology::exact::DeadZoneUsingBadCharacterShift::match ( subject, pattern ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( res ); } else if ( algorithm.getValue ( ) == "exactMatchingAutomaton" ) { string::String pattern = alib::XmlDataFactory::fromTokens < string::String > ( patternTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); automaton::Automaton automaton = stringology::exact::ExactMatchingAutomaton::construct ( pattern ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( automaton ); } else if ( algorithm.getValue ( ) == "exactFactorAutomaton" ) { string::String subject = alib::XmlDataFactory::fromTokens < string::String > ( subjectTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); automaton::Automaton automaton = stringology::exact::ExactFactorAutomaton::construct ( subject ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( automaton ); } else if ( algorithm.getValue ( ) == "exactSubsequenceAutomaton" ) { string::String subject = alib::XmlDataFactory::fromTokens < string::String > ( subjectTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); automaton::Automaton automaton = stringology::exact::ExactSubsequenceAutomaton::construct ( subject ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( automaton ); } else if ( algorithm.getValue ( ) == "exactNondeterministicSubsequenceAutomaton" ) { string::String subject = alib::XmlDataFactory::fromTokens < string::String > ( subjectTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); automaton::Automaton automaton = stringology::exact::ExactNondeterministicSubsequenceAutomaton::construct ( subject ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( automaton ); } else if ( algorithm.getValue ( ) == "exactMultiNondeterministicSubsequenceAutomaton" ) { @@ -242,47 +243,47 @@ int main ( int argc, char * argv[] ) { for ( std::deque < sax::Token > & tokens : subjectTokens ) subjects.insert ( alib::XmlDataFactory::fromTokens < string::String > ( tokens ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); automaton::Automaton automaton = stringology::exact::ExactMultiNondeterministicSubsequenceAutomaton::construct ( subjects ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( automaton ); } else if ( algorithm.getValue ( ) == "borderArray" ) { string::String subject = alib::XmlDataFactory::fromTokens < string::String > ( subjectTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); std::vector < unsigned > borderArray = stringology::exact::BorderArray::construct ( subject ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( borderArray ); } else if ( algorithm.getValue ( ) == "suffixTrie" ) { string::String subject = alib::XmlDataFactory::fromTokens < string::String > ( subjectTokens.front ( ) ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Algorithm", std::chrono::measurements::Type::MAIN ); + measurements::end ( ); + measurements::start ( "Algorithm", measurements::Type::MAIN ); indexes::SuffixTrieFinalMark suffixTrie = stringology::indexing::SuffixTrie::construct ( subject ); - std::chrono::measurements::end ( ); - std::chrono::measurements::start ( "Output write", std::chrono::measurements::Type::AUXILARY ); + measurements::end ( ); + measurements::start ( "Output write", measurements::Type::AUXILIARY ); alib::XmlDataFactory::toStdout ( suffixTrie ); } else { throw exception::AlibException ( "Invalid algorithm" ); } - std::chrono::measurements::end ( ); - std::chrono::measurements::end ( ); + measurements::end ( ); + measurements::end ( ); - if ( measure.getValue ( ) ) std::clog << std::chrono::measurements::results ( ) << std::endl; + if ( measure.getValue ( ) ) std::clog << measurements::results ( ) << std::endl; return 0; } catch ( const exception::AlibException & exception ) { diff --git a/atrim2/src/atrim.cpp b/atrim2/src/atrim.cpp index 8408fa23b3..371d156891 100644 --- a/atrim2/src/atrim.cpp +++ b/atrim2/src/atrim.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <factory/XmlDataFactory.hpp> #include <exception/AlibException.h> @@ -88,8 +89,8 @@ int main(int argc, char* argv[]) { if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start("Overal", std::chrono::measurements::Type::OVERALL); - std::chrono::measurements::start("Input read", std::chrono::measurements::Type::AUXILARY); + measurements::start("Overal", measurements::Type::OVERALL); + measurements::start("Input read", measurements::Type::AUXILIARY); std::deque<sax::Token> tokens; if(input.isSet()) { @@ -105,56 +106,56 @@ int main(int argc, char* argv[]) { if( alib::XmlDataFactory::first<automaton::Automaton>(tokens)) { automaton::Automaton automaton = alib::XmlDataFactory::fromTokens<automaton::Automaton>(tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); if(efficient.getValue()) { automaton::Automaton res = efficientTrimAutomaton(automaton, unreachable.getValue(), useless.getValue() ); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( res ); } else { automaton::Automaton res = trimAutomaton(automaton, unreachable.getValue(), useless.getValue() ); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( res ); } } else if( alib::XmlDataFactory::first<grammar::Grammar>(tokens)) { grammar::Grammar grammar = alib::XmlDataFactory::fromTokens<grammar::Grammar>(tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); grammar::Grammar res = trimGrammar(grammar, unreachable.getValue(), useless.getValue() ); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( res ); } else if( alib::XmlDataFactory::first<regexp::RegExp>(tokens)) { regexp::RegExp regexp = alib::XmlDataFactory::fromTokens<regexp::RegExp>(tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN); + measurements::end(); + measurements::start("Algorithm", measurements::Type::MAIN); regexp::RegExp res = optimizeRegExp( regexp ); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); alib::XmlDataFactory::toStdout( res ); } else { throw exception::AlibException( "Input not recognized." ); } - std::chrono::measurements::end(); - std::chrono::measurements::end(); + measurements::end(); + measurements::end(); - if(measure.getValue()) std::clog << std::chrono::measurements::results() << std::endl; + if(measure.getValue()) std::clog << measurements::results() << std::endl; return 0; } catch( const exception::AlibException & exception ) { diff --git a/tniceprint/src/tniceprint.cpp b/tniceprint/src/tniceprint.cpp index 9ed22a1b46..6bf38951fd 100644 --- a/tniceprint/src/tniceprint.cpp +++ b/tniceprint/src/tniceprint.cpp @@ -7,6 +7,7 @@ #include <tclap/CmdLine.h> #include <common/GlobalData.h> +#include <measure> #include <string> #include <exception/AlibException.h> #include <factory/XmlDataFactory.hpp> @@ -36,8 +37,8 @@ int main(int argc, char** argv) { if(measure.isSet()) common::GlobalData::measure = true; - std::chrono::measurements::start("Overal", std::chrono::measurements::Type::OVERALL); - std::chrono::measurements::start("Input read", std::chrono::measurements::Type::AUXILARY); + measurements::start("Overal", measurements::Type::OVERALL); + measurements::start("Input read", measurements::Type::AUXILIARY); std::deque<sax::Token> tokens; if(input.isSet()) { @@ -53,23 +54,23 @@ int main(int argc, char** argv) { if (alib::XmlDataFactory::first<tree::RankedTree>(tokens)) { const tree::RankedTree & tree = alib::XmlDataFactory::fromTokens<tree::RankedTree>(tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); tree.nicePrint(std::cout); } else if (alib::XmlDataFactory::first<tree::UnrankedTree>(tokens)) { const tree::UnrankedTree & tree = alib::XmlDataFactory::fromTokens<tree::UnrankedTree>(tokens); - std::chrono::measurements::end(); - std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY); + measurements::end(); + measurements::start("Output write", measurements::Type::AUXILIARY); tree.nicePrint(std::cout); } else throw exception::AlibException("no tree on input"); - std::chrono::measurements::end(); - std::chrono::measurements::end(); + measurements::end(); + measurements::end(); - if(measure.getValue()) std::clog << std::chrono::measurements::results() << std::endl; + if(measure.getValue()) std::clog << measurements::results() << std::endl; return 0; } catch(const exception::AlibException& exception) { -- GitLab