From 3bc31e927dca5b0646305fbcf7466bfebc9042e7 Mon Sep 17 00:00:00 2001 From: PBerger Date: Tue, 12 Aug 2014 23:19:31 +0200 Subject: [PATCH] Added per-formula timing output. This is basically a picky merge from my CUDA branch. Former-commit-id: bb386486bb0c9eb9fae8693b7e24a9b232aef84a --- src/storm.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/storm.cpp b/src/storm.cpp index af69da175..1a30c2d7a 100644 --- a/src/storm.cpp +++ b/src/storm.cpp @@ -17,8 +17,10 @@ #include #include #include +#include #include #include +#include #include "storm-config.h" #include "storm-version.h" @@ -112,10 +114,10 @@ void printUsage() { ULARGE_INTEGER uLargeInteger; uLargeInteger.LowPart = ftKernel.dwLowDateTime; uLargeInteger.HighPart = ftKernel.dwHighDateTime; - double kernelTime = uLargeInteger.QuadPart / 10000.0; // 100 ns Resolution to milliseconds + double kernelTime = static_cast(uLargeInteger.QuadPart) / 10000.0; // 100 ns Resolution to milliseconds uLargeInteger.LowPart = ftUser.dwLowDateTime; uLargeInteger.HighPart = ftUser.dwHighDateTime; - double userTime = uLargeInteger.QuadPart / 10000.0; + double userTime = static_cast(uLargeInteger.QuadPart) / 10000.0; std::cout << "CPU Time: " << std::endl; std::cout << "\tKernel Time: " << std::setprecision(5) << kernelTime << "ms" << std::endl; @@ -147,6 +149,16 @@ void setUpFileLogging() { logger.addAppender(fileLogAppender); } +/*! +* Gives the current working directory +* +* @return std::string The path of the current working directory +*/ +std::string getCurrentWorkingDirectory() { + char temp[512]; + return (_getcwd(temp, 512 - 1) ? std::string(temp) : std::string("")); +} + /*! * Prints the header. */ @@ -162,7 +174,7 @@ void printHeader(const int argc, const char* argv[]) { if (STORM_CPP_VERSION_DIRTY == 1) { std::cout << " (DIRTY)"; } - std::cout << std::endl; + std::cout << "." << std::endl; #ifdef STORM_HAVE_INTELTBB std::cout << "Linked with Intel Threading Building Blocks v" << TBB_VERSION_MAJOR << "." << TBB_VERSION_MINOR << " (Interface version " << TBB_INTERFACE_VERSION << ")." << std::endl; @@ -185,6 +197,7 @@ void printHeader(const int argc, const char* argv[]) { commandStream << argv[i] << " "; } std::cout << "Command line: " << commandStream.str() << std::endl << std::endl; + std::cout << "Current working directory: " << getCurrentWorkingDirectory() << std::endl << std::endl; } /*! @@ -290,8 +303,11 @@ void checkPrctlFormulae(storm::modelchecker::prctl::AbstractModelChecker std::list*> formulaList = storm::parser::PrctlFileParser(chosenPrctlFile); for (auto formula : formulaList) { + std::chrono::high_resolution_clock::time_point startTime = std::chrono::high_resolution_clock::now(); modelchecker.check(*formula); delete formula; + std::chrono::high_resolution_clock::time_point endTime = std::chrono::high_resolution_clock::now(); + std::cout << "Checking the formula took " << std::chrono::duration_cast(endTime - startTime).count() << "ms." << std::endl; } } }