[asl] 16/33: C++11 rewrite of aslTimer
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu May 5 18:40:50 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository asl.
commit 062823f4dd788677e140e8970dfc7bf0359fd532
Author: Avtech Scientific <AvtechScientific at users.noreply.github.com>
Date: Wed Dec 23 11:07:37 2015 +0200
C++11 rewrite of aslTimer
---
CMakeLists.txt | 4 +-
COPYRIGHT.md | 4 +-
NEWS.md | 4 ++
README.md | 2 +-
examples/elastic/acousticWaves.cc | 18 ++++-----
examples/elastic/cubeGravity.cc | 15 +++-----
examples/elastic/cubeIncompressibleGravity.cc | 22 +++++------
examples/elastic/cubePoroelasticGravity.cc | 22 +++++------
examples/elastic/poroelastic.cc | 17 ++++-----
examples/flow/bus_wind.cc | 19 +++++----
examples/flow/compressor.cc | 16 ++++----
examples/flow/flow.cc | 17 ++++-----
examples/flow/flow2.cc | 17 ++++-----
examples/flow/flow3.cc | 17 ++++-----
examples/flow/flowKDPGrowth.cc | 22 +++++------
examples/flow/flowRotatingCylinders.cc | 16 ++++----
examples/flow/locomotive.cc | 6 +--
examples/flow/locomotive_laminar.cc | 7 ++--
examples/flow/locomotive_stability.cc | 18 ++++-----
examples/flow/multicomponent_flow.cc | 12 +++---
examples/flow/multiphase_flow.cc | 20 +++++-----
examples/flow/pitot_tube_ice.cc | 21 +++++-----
examples/heatTransfer/surfaceFlux.cc | 15 +++-----
examples/jumpingObjects/jumpingBox.cc | 17 +++------
examples/levelSet/levelSetBasic.cc | 15 +++-----
examples/levelSet/levelSetFacetedGrowth.cc | 15 +++-----
examples/levelSet/levelSetNormalGrowth.cc | 15 +++-----
examples/massTransferSM/testSMDiff.cc | 15 +++-----
examples/massTransferSM/testSMDiff3C.cc | 15 +++-----
examples/massTransferSM/testSMPhi.cc | 15 +++-----
examples/massTransferSM/testSMPhiBV.cc | 15 +++-----
src/utilities/aslTimer.h | 55 ++++++++++++---------------
32 files changed, 223 insertions(+), 285 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 18a69a9..203e0b8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,7 +29,7 @@ cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
# Set version number
set(ASL_VERSION_MAJOR 0)
set(ASL_VERSION_MINOR 1)
-set(ASL_VERSION_PATCH 6)
+set(ASL_VERSION_PATCH 7-dev)
set(ASL_VERSION ${ASL_VERSION_MAJOR}.${ASL_VERSION_MINOR}.${ASL_VERSION_PATCH})
@@ -89,7 +89,7 @@ set(CPACK_PACKAGE_VERSION_PATCH ${ASL_VERSION_PATCH})
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README.md")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Advanced Simulation Library is a free and open source hardware accelerated multiphysics simulation software.")
-set(CPACK_PACKAGE_DESCRIPTION "Advanced Simulation Library (ASL) is a free and open source hardware accelerated multiphysics simulation software. Its computational engine is based, among others, on the Lattice Boltzmann Methods and is written in OpenCL which enable extraordinarily efficient deployment on a variety of massively parallel architectures, ranging from inexpensive FPGAs, DSPs and GPUs up to heterogeneous clusters and supercomputers. The engine is hidden entirely behind C++ cla [...]
+set(CPACK_PACKAGE_DESCRIPTION "Advanced Simulation Library (ASL) is a free and open source hardware accelerated multiphysics simulation software. Its computational engine is based, among others, on the Lattice Boltzmann Methods and is written in OpenCL which enable extraordinarily efficient deployment on a variety of massively parallel architectures, ranging from inexpensive FPGAs, DSPs and GPUs up to heterogeneous clusters and supercomputers. The engine is hidden entirely behind C++ cla [...]
set(CPACK_PACKAGE_VENDOR "Avtech Scientific")
set(CPACK_PACKAGE_CONTACT "http://avtechscientific.com/contact")
diff --git a/COPYRIGHT.md b/COPYRIGHT.md
index b4cd82f..acb835e 100644
--- a/COPYRIGHT.md
+++ b/COPYRIGHT.md
@@ -24,13 +24,13 @@ The reference to ASL may be in an acknowledgment section, in a phrase such as th
```
"This work benefited from the use of the Advanced Simulation Library™ (ASL),
- an open source multiphysics simulation software package developed
+ an open source hardware accelerated multiphysics simulation software developed
by Avtech Scientific and available at <http://asl.org.il>."
```
To cite ASL in publications please adopt the following:
-_ASL: Advanced Simulation Library™, an open source multiphysics simulation software package._[^1] Version 0.1.5.[^2] 2015-08-01.[^3] <http://asl.org.il>.[^4] Avtech Scientific. Modiin Illit, Israel.
+_ASL: Advanced Simulation Library™, an open source hardware accelerated multiphysics simulation software._[^1] Version 0.1.5.[^2] 2015-08-01.[^3] <http://asl.org.il>.[^4] Avtech Scientific. Modiin Illit, Israel.
[^1]: Additionally any sub-routines that were used may be specified.
[^2]: Version number or commit hash (in the latter case write: Commit 794e49160c089c18a3b455e48bab6ad7c28bb685)
diff --git a/NEWS.md b/NEWS.md
index 40f0100..3b79962 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,9 @@
# News and ChangeLog
+## 0.1.7
+
+- bug fixes
+
## 0.1.6
- fixing linkage issues
diff --git a/README.md b/README.md
index 6adb101..91a496a 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ For more information, please visit <http://asl.org.il>.
# ASL
-__Advanced Simulation Library (ASL)__ is a free and open source hardware accelerated multiphysics simulation software. Its computational engine is based, among others, on the [Lattice Boltzmann Methods](http://en.wikipedia.org/wiki/Lattice_Boltzmann_methods) and is written in [OpenCL](http://en.wikipedia.org/wiki/OpenCL) which enable [extraordinarily efficient deployment](http://asl.org.il/benchmarks) on a variety of massively parallel architectures, ranging from inexpensive FPGAs, DSPs [...]
+__Advanced Simulation Library (ASL)__ is a free and open source hardware accelerated multiphysics simulation software. Its computational engine is based, among others, on the [Lattice Boltzmann Methods](http://en.wikipedia.org/wiki/Lattice_Boltzmann_methods) and is written in [OpenCL](http://en.wikipedia.org/wiki/OpenCL) which enable [extraordinarily efficient deployment](http://asl.org.il/benchmarks) on a variety of massively parallel architectures, ranging from inexpensive FPGAs, DSPs [...]
## License
diff --git a/examples/elastic/acousticWaves.cc b/examples/elastic/acousticWaves.cc
index fcd54ba..2ca3df9 100644
--- a/examples/elastic/acousticWaves.cc
+++ b/examples/elastic/acousticWaves.cc
@@ -224,24 +224,20 @@ int main(int argc, char* argv[])
{
timer.stop();
tOutPrev=t;
- cout << t << "/" << params.tSimulation.v() << "; expected left time: " <<
- timer.getLeftTime(t/params.tSimulation.v()) << endl;
+ cout << t << "/" << params.tSimulation.v() << "; time left (estimated): " << timer.estimatedRemainder(t/params.tSimulation.v()) << endl;
writer.write();
- timer.resume();
+ timer.start();
}
}
timer.stop();
- std::cout << "Finished" << endl;
+ cout << "Finished" << endl;
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
-
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/elastic/cubeGravity.cc b/examples/elastic/cubeGravity.cc
index 66917eb..f6ac435 100644
--- a/examples/elastic/cubeGravity.cc
+++ b/examples/elastic/cubeGravity.cc
@@ -23,7 +23,7 @@
/**
\example cubeGravity.cc
- */
+*/
#include <aslDataInc.h>
#include <acl/aclGenerators.h>
@@ -123,15 +123,12 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/elastic/cubeIncompressibleGravity.cc b/examples/elastic/cubeIncompressibleGravity.cc
index 8d2fbb4..03ab2dc 100644
--- a/examples/elastic/cubeIncompressibleGravity.cc
+++ b/examples/elastic/cubeIncompressibleGravity.cc
@@ -23,7 +23,7 @@
/**
\example cubeIncompressibleGravity.cc
- */
+*/
#include <aslDataInc.h>
#include <acl/aclGenerators.h>
@@ -112,10 +112,10 @@ int main(int argc, char* argv[])
timerBC.reset();
for (unsigned int i(0); i < tsim.v(); ++i)
{
- timerBulk.resume();
+ timerBulk.start();
elasticity->execute();
timerBulk.stop();
- timerBC.resume();
+ timerBC.start();
executeAll(bc);
timerBC.stop();
if(!(i % tout.v()))
@@ -126,17 +126,15 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
+ cout << "Finished" << endl;
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
- cout << "timeBulk=" << timerBulk.getTime() <<
- "; timeBC=" << timerBC.getTime() << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "timeBulk=" << timerBulk.realTime() <<
+ "; timeBC=" << timerBC.realTime() << endl;
return 0;
}
diff --git a/examples/elastic/cubePoroelasticGravity.cc b/examples/elastic/cubePoroelasticGravity.cc
index bb8eaf4..90b9a12 100644
--- a/examples/elastic/cubePoroelasticGravity.cc
+++ b/examples/elastic/cubePoroelasticGravity.cc
@@ -23,7 +23,7 @@
/**
\example cubePoroelasticGravity.cc
- */
+*/
#include <aslDataInc.h>
#include <acl/aclGenerators.h>
@@ -116,10 +116,10 @@ int main(int argc, char* argv[])
timerBC.reset();
for (unsigned int i(0); i < tsim.v(); ++i)
{
- timerBulk.resume();
+ timerBulk.start();
elasticity->execute();
timerBulk.stop();
- timerBC.resume();
+ timerBC.start();
executeAll(bc);
timerBC.stop();
if (!(i % tout.v()))
@@ -130,17 +130,15 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
+ cout << "Finished" << endl;
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
- cout << "timeBulk=" << timerBulk.getTime() <<
- "; timeBC=" << timerBC.getTime() << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "timeBulk=" << timerBulk.realTime() <<
+ "; timeBC=" << timerBC.realTime() << endl;
return 0;
}
diff --git a/examples/elastic/poroelastic.cc b/examples/elastic/poroelastic.cc
index 568eac9..3322254 100644
--- a/examples/elastic/poroelastic.cc
+++ b/examples/elastic/poroelastic.cc
@@ -24,7 +24,7 @@
/**
\example poroelastic.cc
Required input file: [brain.vti](http://asl.org.il/input_data/brain.vti)
- */
+*/
#include <aslDataInc.h>
#include <acl/aclGenerators.h>
@@ -148,15 +148,12 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time: " << timer.getTime() << "; clockTime: "
- << timer.getClockTime() << "; load: "
- << timer.getProcessorLoad() * 100 << "%" << endl;
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
-}
\ No newline at end of file
+}
diff --git a/examples/flow/bus_wind.cc b/examples/flow/bus_wind.cc
index 9fa51e4..b288063 100644
--- a/examples/flow/bus_wind.cc
+++ b/examples/flow/bus_wind.cc
@@ -23,6 +23,7 @@
/**
\example bus_wind.cc
+ Example: Bus in wind
Required input file: [bus.stl](http://asl.org.il/input_data/bus.stl)
*/
@@ -121,10 +122,10 @@ int main(int argc, char* argv[])
timer2.reset();
for (unsigned int i(1); i < 101; ++i)
{
- timer1.resume();
+ timer1.start();
lbgk->execute();
timer1.stop();
- timer2.resume();
+ timer2.start();
executeAll(bc);
timer2.stop();
if (!(i%1000))
@@ -137,16 +138,14 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
+ cout << "Finished" << endl;
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
- cout << "time1=" << timer1.getTime() << "; time2=" << timer2.getTime() << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "time1 = " << timer1.realTime() << "; time2 = " << timer2.realTime() << endl;
return 0;
}
diff --git a/examples/flow/compressor.cc b/examples/flow/compressor.cc
index 6762613..de2c2ac 100644
--- a/examples/flow/compressor.cc
+++ b/examples/flow/compressor.cc
@@ -23,6 +23,7 @@
/**
\example compressor.cc
+ Example: Axial Compressor
Required input file: [axial-compressor.stl](http://asl.org.il/input_data/axial-compressor.stl)
*/
@@ -154,15 +155,12 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
+ cout << "Finished" << endl;
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
-
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
-}
\ No newline at end of file
+}
diff --git a/examples/flow/flow.cc b/examples/flow/flow.cc
index d11bad2..d7521aa 100644
--- a/examples/flow/flow.cc
+++ b/examples/flow/flow.cc
@@ -23,7 +23,8 @@
/**
\example flow.cc
- */
+ Example: Flow
+*/
#include <utilities/aslParametersManager.h>
#include <aslDataInc.h>
@@ -133,15 +134,13 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
+
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/flow/flow2.cc b/examples/flow/flow2.cc
index 3b02cdd..ac58850 100644
--- a/examples/flow/flow2.cc
+++ b/examples/flow/flow2.cc
@@ -23,7 +23,8 @@
/**
\example flow2.cc
- */
+ Example: Flow2
+*/
#include <utilities/aslParametersManager.h>
#include <aslDataInc.h>
@@ -177,15 +178,13 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
+
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/flow/flow3.cc b/examples/flow/flow3.cc
index c91bdf8..914aa57 100644
--- a/examples/flow/flow3.cc
+++ b/examples/flow/flow3.cc
@@ -23,7 +23,8 @@
/**
\example flow3.cc
- */
+ Example: Flow3
+*/
#include <utilities/aslParametersManager.h>
#include <aslDataInc.h>
@@ -154,15 +155,13 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
+
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/flow/flowKDPGrowth.cc b/examples/flow/flowKDPGrowth.cc
index 4e0eea4..9de8b54 100644
--- a/examples/flow/flowKDPGrowth.cc
+++ b/examples/flow/flowKDPGrowth.cc
@@ -23,7 +23,8 @@
/**
\example flowKDPGrowth.cc
- */
+ Example: flowKDPGrowth
+*/
#include <utilities/aslParametersManager.h>
#include <math/aslTemplates.h>
@@ -315,12 +316,12 @@ int main(int argc, char* argv[])
for (unsigned int i(0); i <= 8001 ; ++i)
{
lbgk->execute();
- timerBC.resume();
+ timerBC.start();
executeAll(bcV);
executeAll(bc);
timerBC.stop();
nmDif->execute();
- timerBC.resume();
+ timerBC.start();
executeAll(bcDif);
timerBC.stop();
@@ -332,16 +333,13 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%; timeBC = "
- << timerBC.getTime() << endl;
+
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/flow/flowRotatingCylinders.cc b/examples/flow/flowRotatingCylinders.cc
index 3477d53..98d4aa5 100644
--- a/examples/flow/flowRotatingCylinders.cc
+++ b/examples/flow/flowRotatingCylinders.cc
@@ -23,7 +23,8 @@
/**
\example flowRotatingCylinders.cc
- */
+ Example: Flow around rotating cylinders
+*/
#include <aslDataInc.h>
@@ -151,15 +152,12 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/flow/locomotive.cc b/examples/flow/locomotive.cc
index 250717b..077fd89 100644
--- a/examples/flow/locomotive.cc
+++ b/examples/flow/locomotive.cc
@@ -230,9 +230,9 @@ int main(int argc, char* argv[])
cout << "Finished" << endl;
cout << "Computation statistic:" << endl;
- cout << "time = " << timer.getTime() << "; clockTime = "
- << timer.getClockTime() << "; load = "
- << timer.getProcessorLoad() * 100 << "%" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/flow/locomotive_laminar.cc b/examples/flow/locomotive_laminar.cc
index e6b668d..be0f1ee 100644
--- a/examples/flow/locomotive_laminar.cc
+++ b/examples/flow/locomotive_laminar.cc
@@ -23,6 +23,7 @@
/**
\example locomotive_laminar.cc
+ Example: Locomotive with laminar flow
Required input file: [locomotive.stl](http://asl.org.il/input_data/locomotive.stl)
*/
@@ -166,9 +167,9 @@ int main(int argc, char* argv[])
cout << "Finished" << endl;
cout << "Computation statistic:" << endl;
- cout << "time = " << timer.getTime() << "; clockTime = "
- << timer.getClockTime() << "; load = "
- << timer.getProcessorLoad() * 100 << "%" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/flow/locomotive_stability.cc b/examples/flow/locomotive_stability.cc
index df8ab64..522d438 100644
--- a/examples/flow/locomotive_stability.cc
+++ b/examples/flow/locomotive_stability.cc
@@ -23,8 +23,9 @@
/**
\example locomotive_stability.cc
+ Example: Locomotive stability
Required input file: [locomotive.stl](http://asl.org.il/input_data/locomotive.stl)
- */
+*/
#include <math/aslVectors.h>
#include <math/aslTemplates.h>
@@ -162,15 +163,12 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
-}
\ No newline at end of file
+}
diff --git a/examples/flow/multicomponent_flow.cc b/examples/flow/multicomponent_flow.cc
index ffac70e..f9b3a15 100644
--- a/examples/flow/multicomponent_flow.cc
+++ b/examples/flow/multicomponent_flow.cc
@@ -24,7 +24,7 @@
/**
\example multicomponent_flow.cc
Example: Multicomponent flow
- */
+*/
#include <utilities/aslParametersManager.h>
#include <math/aslTemplates.h>
@@ -241,10 +241,10 @@ int main(int argc, char *argv[])
if (!(i%100))
{
timer.stop();
- cout << i << "/10000; time left (expected): " << timer.getLeftTime(double(i)/10000.) << endl;
+ cout << i << "/10000; time left (estimated): " << timer.estimatedRemainder(double(i)/10000.) << endl;
executeAll(bcV);
writer.write();
- timer.resume();
+ timer.start();
}
}
timer.stop();
@@ -252,9 +252,9 @@ int main(int argc, char *argv[])
cout << "Finished" << endl;
cout << "Computation statistic:" << endl;
- cout << "time = " << timer.getTime() << "; clockTime = "
- << timer.getClockTime() << "; load = "
- << timer.getProcessorLoad() * 100 << "%" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/flow/multiphase_flow.cc b/examples/flow/multiphase_flow.cc
index ee736cb..6469b9d 100644
--- a/examples/flow/multiphase_flow.cc
+++ b/examples/flow/multiphase_flow.cc
@@ -23,8 +23,9 @@
/**
\example multiphase_flow.cc
+ Example: Multiphase flow
not finished yet!!!!!
- */
+*/
#include <utilities/aslParametersManager.h>
#include <math/aslTemplates.h>
@@ -231,23 +232,20 @@ int main(int argc, char *argv[])
if (!(i%200))
{
timer.stop();
- cout << i << "/2000; expected left time: " << timer.getLeftTime(double(i)/2000.) << endl;
+ cout << i << "/2000; time left (estimated): " << timer.estimatedRemainder(double(i)/2000.) << endl;
executeAll(bcV);
writer.write();
- timer.resume();
+ timer.start();
}
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/flow/pitot_tube_ice.cc b/examples/flow/pitot_tube_ice.cc
index 1f09c83..afd9ff9 100644
--- a/examples/flow/pitot_tube_ice.cc
+++ b/examples/flow/pitot_tube_ice.cc
@@ -23,8 +23,8 @@
/**
\example pitot_tube_ice.cc
- Icing process in the Pitot tube
- */
+ Example: Icing process in the Pitot tube
+*/
#include <utilities/aslParametersManager.h>
#include <math/aslTemplates.h>
@@ -226,23 +226,20 @@ int main(int argc, char *argv[])
if(!(i%800))
{
timer.stop();
- cout << i << "/8000; expected left time: " << timer.getLeftTime(double(i)/8000.) << endl;
+ cout << i << "/8000; time left (estimated): " << timer.estimatedRemainder(double(i)/8000.) << endl;
executeAll(bcV);
writer.write();
- timer.resume();
+ timer.start();
}
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/heatTransfer/surfaceFlux.cc b/examples/heatTransfer/surfaceFlux.cc
index c4fed8c..f8cfc14 100644
--- a/examples/heatTransfer/surfaceFlux.cc
+++ b/examples/heatTransfer/surfaceFlux.cc
@@ -23,7 +23,7 @@
/**
\example surfaceFlux.cc
- */
+*/
#include <utilities/aslParametersManager.h>
#include <math/aslTemplates.h>
@@ -124,15 +124,12 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/jumpingObjects/jumpingBox.cc b/examples/jumpingObjects/jumpingBox.cc
index d304cc4..1246568 100644
--- a/examples/jumpingObjects/jumpingBox.cc
+++ b/examples/jumpingObjects/jumpingBox.cc
@@ -23,7 +23,7 @@
/**
\example jumpingBox.cc
- */
+*/
#include <aslDataInc.h>
#include <acl/aclGenerators.h>
@@ -105,7 +105,6 @@ int main(int argc, char* argv[])
bcFreeSurface.execute();
bcRigidWall->execute();
-
timer.start();
for (unsigned int i(0); i < tsim.v(); ++i)
{
@@ -117,15 +116,11 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
-
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Finished" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/levelSet/levelSetBasic.cc b/examples/levelSet/levelSetBasic.cc
index bc5ac11..681fa83 100644
--- a/examples/levelSet/levelSetBasic.cc
+++ b/examples/levelSet/levelSetBasic.cc
@@ -23,7 +23,7 @@
/**
\example levelSetBasic.cc
- */
+*/
#include <aslDataInc.h>
#include <writers/aslVTKFormatWriters.h>
@@ -94,15 +94,12 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/levelSet/levelSetFacetedGrowth.cc b/examples/levelSet/levelSetFacetedGrowth.cc
index 3e572c4..2507b50 100644
--- a/examples/levelSet/levelSetFacetedGrowth.cc
+++ b/examples/levelSet/levelSetFacetedGrowth.cc
@@ -23,7 +23,7 @@
/**
\example levelSetFacetedGrowth.cc
- */
+*/
#include <aslDataInc.h>
#include <writers/aslVTKFormatWriters.h>
@@ -107,15 +107,12 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/levelSet/levelSetNormalGrowth.cc b/examples/levelSet/levelSetNormalGrowth.cc
index eef7b24..1341b38 100644
--- a/examples/levelSet/levelSetNormalGrowth.cc
+++ b/examples/levelSet/levelSetNormalGrowth.cc
@@ -23,7 +23,7 @@
/**
\example levelSetNormalGrowth.cc
- */
+*/
#include <aslDataInc.h>
#include <writers/aslVTKFormatWriters.h>
@@ -99,15 +99,12 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/massTransferSM/testSMDiff.cc b/examples/massTransferSM/testSMDiff.cc
index 48e55a1..4fe516c 100644
--- a/examples/massTransferSM/testSMDiff.cc
+++ b/examples/massTransferSM/testSMDiff.cc
@@ -23,7 +23,7 @@
/**
\example testSMDiff.cc
- */
+*/
#include <utilities/aslParametersManager.h>
#include <math/aslTemplates.h>
@@ -117,15 +117,12 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/massTransferSM/testSMDiff3C.cc b/examples/massTransferSM/testSMDiff3C.cc
index 3c1a2c9..ee16c5e 100644
--- a/examples/massTransferSM/testSMDiff3C.cc
+++ b/examples/massTransferSM/testSMDiff3C.cc
@@ -24,7 +24,7 @@
/**
\example testSMDiff3C.cc
ternary system
- */
+*/
#include <utilities/aslParametersManager.h>
#include <math/aslTemplates.h>
@@ -127,15 +127,12 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/massTransferSM/testSMPhi.cc b/examples/massTransferSM/testSMPhi.cc
index 011330c..a16e514 100644
--- a/examples/massTransferSM/testSMPhi.cc
+++ b/examples/massTransferSM/testSMPhi.cc
@@ -23,7 +23,7 @@
/**
\example testSMPhi.cc
- */
+*/
#include <utilities/aslParametersManager.h>
#include <math/aslTemplates.h>
@@ -137,15 +137,12 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/examples/massTransferSM/testSMPhiBV.cc b/examples/massTransferSM/testSMPhiBV.cc
index 0fec207..9c53faf 100644
--- a/examples/massTransferSM/testSMPhiBV.cc
+++ b/examples/massTransferSM/testSMPhiBV.cc
@@ -23,7 +23,7 @@
/**
\example testSMPhiBV.cc
- */
+*/
#include <utilities/aslParametersManager.h>
#include <math/aslTemplates.h>
@@ -163,15 +163,12 @@ int main(int argc, char* argv[])
}
timer.stop();
- std::cout << "Finished" << endl;
-
- cout << "time=" << timer.getTime() << "; clockTime="
- << timer.getClockTime() << "; load="
- << timer.getProcessorLoad() * 100 << "%" << endl;
+ cout << "Finished" << endl;
- std::cout << "Output...";
- std::cout << "Finished" << endl;
- std::cout << "Ok" << endl;
+ cout << "Computation statistic:" << endl;
+ cout << "Real Time = " << timer.realTime() << "; Processor Time = "
+ << timer.processorTime() << "; Processor Load = "
+ << timer.processorLoad() * 100 << "%" << endl;
return 0;
}
diff --git a/src/utilities/aslTimer.h b/src/utilities/aslTimer.h
index e37c1a3..91bd925 100644
--- a/src/utilities/aslTimer.h
+++ b/src/utilities/aslTimer.h
@@ -24,47 +24,40 @@
#ifndef ASLTIMER_H
#define ASLTIMER_H
-#include <sys/time.h>
+#include <chrono>
+#include <thread>
namespace asl{
+using namespace std::chrono;
/// \ingroup Utilities
class Timer {
private:
- clock_t _c;
- double _t;
- inline double tod(){
- timeval tim;
- gettimeofday(&tim,NULL);
- return tim.tv_sec+(tim.tv_usec/1000000.0);
- }
+ high_resolution_clock::time_point realTimeMark;
+ duration<double> realTimeElapsed;
+
+ clock_t processorTimeMark;
+ double processorTimeElapsed;
public:
- inline Timer():_c(0),_t(0){};
- inline void start(){_c=-clock();_t=-tod();}
- inline void resume(){_c-=clock();_t-=tod();}
- inline void stop(){_c+=clock();_t+=tod();}
- inline const double getTime() const{return _t;}
- inline const double getClockTime() const{return (float)_c/CLOCKS_PER_SEC;}
- inline const double getProcessorLoad() const{return getClockTime()/getTime();}
- inline void reset(){_c=0; _t=0;}
- inline const double getExpectedTime(double fractTime){return _t/fractTime;}
- inline const double getLeftTime(double fractTime){return (1.-fractTime)*getExpectedTime(fractTime);}
+ inline Timer() : processorTimeElapsed(0), realTimeElapsed(0) {};
+ inline void start() {processorTimeMark = clock(); realTimeMark = high_resolution_clock::now();}
+ inline void stop() {processorTimeElapsed += (double)(clock() - processorTimeMark); realTimeElapsed += duration_cast<duration<double>>(high_resolution_clock::now() - realTimeMark);}
+ inline const double realTime() const{return realTimeElapsed.count();}
+ inline const double processorTime() const{return (double)processorTimeElapsed/CLOCKS_PER_SEC;}
+ inline const double processorLoad() const{return processorTime()/realTime();}
+ inline void reset() {processorTimeElapsed = 0; realTimeElapsed = duration<double>(0);}
+ /// Returns estimated duration of the current task based on its current \p completeness [0..1]
+ inline const double estimatedDuration(double completeness) {return realTimeElapsed.count()/completeness;}
+ /// Returns estimated time till finishing current task based on its current \p completeness [0..1]
+ inline const double estimatedRemainder(double completeness) {return (1. - completeness) * estimatedDuration(completeness);}
};
- // waits \p dt seconds, uses loop
- inline void delay(double dt)
+ /// Blocks execution of the calling thread for the time \p span (in milliseconds)
+ inline void sleep(unsigned int span)
{
- timeval t;
- gettimeofday(&t,NULL);
- double t0(t.tv_sec+(t.tv_usec/1000000.0));
- double tc(t0);
- while (t0+dt>tc)
- {
- gettimeofday(&t,NULL);
- tc=t.tv_sec+(t.tv_usec/1000000.0);
- }
- }
+ std::this_thread::sleep_for(std::chrono::milliseconds(span));
+ }
} //namespace acl
-#endif // aslGeneratorS_H
+#endif // ASLTIMER_H
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/asl.git
More information about the debian-science-commits
mailing list