From 97a9582ec8928624cd78146ae060aadfd92a9b22 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Sat, 27 Oct 2012 13:37:57 +1100 Subject: Don't show stderr in tests. That's just annoying. --- impl/test/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'impl') diff --git a/impl/test/run b/impl/test/run index 826bbde..169edda 100644 --- a/impl/test/run +++ b/impl/test/run @@ -7,7 +7,7 @@ FAILED=0 echo "Testing binary: $1 in directory $DIR" while [ -f "$DIR/$NUM.eqns" ] do - OUTPUT=$(timeout 5s $1 "$DIR/$NUM.eqns") + OUTPUT=$(timeout 5s $1 "$DIR/$NUM.eqns" 2> /dev/null) if [ $? -eq 124 ]; then OUTPUT="did not terminate" fi -- cgit v1.2.3 From ff2030f3a19926334fbe3a043c5f88622c17c2f8 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Sat, 27 Oct 2012 13:38:24 +1100 Subject: Output some timing information to stderr. --- impl/main.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'impl') diff --git a/impl/main.cpp b/impl/main.cpp index b547c48..b83894d 100644 --- a/impl/main.cpp +++ b/impl/main.cpp @@ -9,6 +9,8 @@ #include "MaxStrategy.hpp" #include "VariableAssignment.hpp" +#include + extern "C" { #include "parser/EquationSystemParser.h" #include "parser/EquationSystemLexer.h" @@ -144,6 +146,23 @@ int main (int argc, char* argv[]) { DynamicVariableAssignment rho(system, strategy); strategy.setRho(rho); + timespec start, finish; + clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start); + if (variables.size() > 0) { + for (unsigned int i = 0, size = system.variableCount(); i < size; ++i) { + Variable& var = system.variable(i); + if (variables.find(var.name()) != variables.end()) { + rho[var]; + } + } + } else { + for (unsigned int i = 0, size = system.variableCount(); i < size; ++i) { + Variable& var = system.variable(i); + rho[var]; + } + } + clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &finish); + if (variables.size() > 0) { for (unsigned int i = 0, size = system.variableCount(); i < size; ++i) { Variable& var = system.variable(i); @@ -158,6 +177,17 @@ int main (int argc, char* argv[]) { } } + timespec temp; + if ((finish.tv_nsec-start.tv_nsec)<0) { + temp.tv_sec = finish.tv_sec-start.tv_sec-1; + temp.tv_nsec = 1000000000+finish.tv_nsec-start.tv_nsec; + } else { + temp.tv_sec = finish.tv_sec-start.tv_sec; + temp.tv_nsec = finish.tv_nsec-start.tv_nsec; + } + cerr << "Time taken: " << temp.tv_sec << " seconds and " << temp.tv_nsec << " nanoseconds." << endl; + + parser -> free(parser); tokens -> free(tokens); lex -> free(lex); -- cgit v1.2.3