FV3 Bundle
PostTimer.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2009-2016 ECMWF.
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation nor
8  * does it submit to any jurisdiction.
9  */
10 
11 #ifndef OOPS_BASE_POSTTIMER_H_
12 #define OOPS_BASE_POSTTIMER_H_
13 
14 #include <vector>
15 
16 #include <boost/noncopyable.hpp>
17 #include <boost/scoped_ptr.hpp>
18 
19 #include "eckit/config/LocalConfiguration.h"
20 #include "oops/util/DateTime.h"
21 #include "oops/util/Duration.h"
22 
23 namespace oops {
24 
25 // -----------------------------------------------------------------------------
26 
27 /// Handles timing of post-processing and similar actions
28 /*!
29  * By default processing is performed on every call.
30  */
31 
32 class PostTimer : private boost::noncopyable {
33  public:
34  PostTimer();
35  explicit PostTimer(const util::Duration &);
36  explicit PostTimer(const eckit::Configuration &);
37  PostTimer(const util::DateTime &, const eckit::Configuration &);
38  PostTimer(const util::DateTime &, const util::DateTime &, const util::Duration &);
40 
41  void initialize(const util::DateTime &, const util::DateTime &,
42  const util::Duration &);
43  bool itIsTime(const util::DateTime &);
44 
45  private:
46  const eckit::LocalConfiguration conf_;
47  util::Duration freq_;
48  util::DateTime bgn_;
49  util::DateTime end_;
50  boost::scoped_ptr<util::DateTime> start_;
51  boost::scoped_ptr<util::DateTime> finish_;
52  std::vector<util::DateTime> pptimes_;
53 };
54 
55 // -----------------------------------------------------------------------------
56 
57 } // namespace oops
58 
59 #endif // OOPS_BASE_POSTTIMER_H_
boost::scoped_ptr< util::DateTime > start_
Definition: PostTimer.h:50
PostTimer()
Definition: PostTimer.cc:26
boost::scoped_ptr< util::DateTime > finish_
Definition: PostTimer.h:51
const eckit::LocalConfiguration conf_
Definition: PostTimer.h:46
The namespace for the main oops code.
Handles timing of post-processing and similar actions.
Definition: PostTimer.h:32
util::DateTime end_
Definition: PostTimer.h:49
~PostTimer()
Definition: PostTimer.h:39
util::DateTime bgn_
Definition: PostTimer.h:48
bool itIsTime(const util::DateTime &)
Definition: PostTimer.cc:79
std::vector< util::DateTime > pptimes_
Definition: PostTimer.h:52
void initialize(const util::DateTime &, const util::DateTime &, const util::Duration &)
Definition: PostTimer.cc:45
util::Duration freq_
Definition: PostTimer.h:47