summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--impl/main.cpp30
1 files changed, 30 insertions, 0 deletions
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 <ctime>
+
extern "C" {
#include "parser/EquationSystemParser.h"
#include "parser/EquationSystemLexer.h"
@@ -144,6 +146,23 @@ int main (int argc, char* argv[]) {
DynamicVariableAssignment<ZBar> 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<ZBar>& 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<ZBar>& 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<ZBar>& 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);