From: Eduardo Ramos Testillano Date: Fri, 17 Jul 2015 07:08:55 +0000 (+0200) Subject: Decrease timex Engine minimum resolution from 100 to 10 milliseconds. Add warning... X-Git-Tag: REFACTORING_TESTING_LIBRARY~124 X-Git-Url: https://git.teslayout.com/public/public/public/?a=commitdiff_plain;h=a8cde75abebb30020be4d9cb10d898f8986e124c;p=anna.git Decrease timex Engine minimum resolution from 100 to 10 milliseconds. Add warning below 100 ms. --- diff --git a/example/diameter/launcher/Launcher.cpp b/example/diameter/launcher/Launcher.cpp index afb8a96..59f5202 100644 --- a/example/diameter/launcher/Launcher.cpp +++ b/example/diameter/launcher/Launcher.cpp @@ -278,7 +278,8 @@ throw(anna::RuntimeException) { // if (cl.exists ("clone")) // workMode = anna::comm::Communicator::WorkMode::Clone; a_communicator = new MyCommunicator(workMode); - a_timeEngine = new anna::timex::Engine((anna::Millisecond)600000, (anna::Millisecond)150); + //a_timeEngine = new anna::timex::Engine((anna::Millisecond)600000, anna::timex::Engine::minResolution); + a_timeEngine = new anna::timex::Engine((anna::Millisecond)600000, (anna::Millisecond)100); // puedo bajar hasta 10 // Counters record procedure: anna::Millisecond cntRecordPeriod = (anna::Millisecond)300000; // ms diff --git a/source/timex/Engine.cpp b/source/timex/Engine.cpp index 22350a1..1ec6747 100644 --- a/source/timex/Engine.cpp +++ b/source/timex/Engine.cpp @@ -31,10 +31,10 @@ using namespace anna; using namespace anna::comm; /** - Resolucion minima (en milisegundos) soportada por el controlador de tiempos. + Minimum resolution (in milliseconds) supported by the time manager */ //static -const Millisecond anna::timex::Engine::minResolution(100); +const Millisecond anna::timex::Engine::minResolution(10); anna::timex::Engine::Engine(const Millisecond & maxTimeout, const Millisecond & resolution) : @@ -76,6 +76,10 @@ throw(RuntimeException) { if(a_resolution < minResolution) throw RuntimeException(functions::asString("Resolution must be greater than %d milliseconds", minResolution.getValue()), ANNA_FILE_LOCATION); + if(a_resolution < (Millisecond)100) { + LOGWARNING(Logger::warning(functions::asString("Resolutions under 100 milliseconds (%d in this case) slightly increase the CPU usage", a_resolution.getValue()), ANNA_FILE_LOCATION)); + } + if(a_maxTimeout <= a_resolution) throw RuntimeException(functions::asString("Max-Timeout must be greater than %d milliseconds", a_resolution.getValue()), ANNA_FILE_LOCATION);