Last change
on this file since 2482 was
501,
checked in by ymipsl, 10 years ago
|
Add licence copyright to all file ond directory src using the command :
svn propset -R copyright -F header_licence src
XIOS is now officialy under CeCILL licence
YM
|
-
Property copyright set to
Software name : XIOS (Xml I/O Server) http://forge.ipsl.jussieu.fr/ioserver Creation date : January 2009 Licence : CeCCIL version2 see license file in root directory : Licence_CeCILL_V2-en.txt or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement) CNRS/IPSL (Institut Pierre Simon Laplace) Project Manager : Yann Meurdesoif yann.meurdesoif@cea.fr
-
Property svn:eol-style set to
native
|
File size:
1.0 KB
|
Line | |
---|
1 | #include "timer.hpp" |
---|
2 | #include "mpi.hpp" |
---|
3 | #include <string> |
---|
4 | #include <map> |
---|
5 | #include "tracer.hpp" |
---|
6 | |
---|
7 | namespace xios |
---|
8 | { |
---|
9 | using namespace std; |
---|
10 | |
---|
11 | map<string,CTimer*> CTimer::allTimer ; |
---|
12 | |
---|
13 | CTimer::CTimer(const string& name_) : name(name_) |
---|
14 | { |
---|
15 | reset() ; |
---|
16 | } |
---|
17 | |
---|
18 | double CTimer::getTime(void) |
---|
19 | { |
---|
20 | return MPI_Wtime(); |
---|
21 | } |
---|
22 | |
---|
23 | void CTimer::suspend(void) |
---|
24 | { |
---|
25 | if (!suspended) |
---|
26 | { |
---|
27 | traceEnd(name) ; |
---|
28 | cumulatedTime+=getTime()-lastTime ; |
---|
29 | } |
---|
30 | suspended=true ; |
---|
31 | } |
---|
32 | |
---|
33 | void CTimer::resume(void) |
---|
34 | { |
---|
35 | if (suspended) |
---|
36 | { |
---|
37 | lastTime=getTime() ; |
---|
38 | traceBegin(name) ; |
---|
39 | } |
---|
40 | suspended=false ; |
---|
41 | } |
---|
42 | |
---|
43 | void CTimer::reset(void) |
---|
44 | { |
---|
45 | cumulatedTime=0. ; |
---|
46 | suspended=true ; |
---|
47 | } |
---|
48 | |
---|
49 | double CTimer::getCumulatedTime(void) |
---|
50 | { |
---|
51 | return cumulatedTime ; |
---|
52 | } |
---|
53 | |
---|
54 | CTimer& CTimer::get(const string name) |
---|
55 | { |
---|
56 | map<string,CTimer*>::iterator it ; |
---|
57 | it=allTimer.find(name) ; |
---|
58 | if (it==allTimer.end()) it=allTimer.insert(pair<string,CTimer*>(name,new CTimer(name))).first ; |
---|
59 | return *(it->second) ; |
---|
60 | } |
---|
61 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.