]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp
Add patch for failing prerm scripts
[ceph.git] / ceph / src / boost / libs / chrono / stopwatches / include / boost / chrono / stopwatches / collectors / laps_accumulator_set.hpp
1 // boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp
2 // Copyright 2011 Vicente J. Botet Escriba
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or
5 // copy at http://www.boost.org/LICENSE_1_0.txt)
6 // See http://www.boost.org/libs/chrono/stopwatches for documentation.
7
8 #ifndef BOOST_CHRONO_STOPWATCHES_MEMORIES_LAPS_ACCUMULATOR_SET_HPP
9 #define BOOST_CHRONO_STOPWATCHES_MEMORIES_LAPS_ACCUMULATOR_SET_HPP
10
11 #include <boost/chrono/stopwatches/collectors/last_lap.hpp>
12 #include <boost/accumulators/framework/accumulator_set.hpp>
13 #include <boost/accumulators/statistics/count.hpp>
14 #include <boost/accumulators/statistics/sum.hpp>
15 #include <boost/accumulators/statistics/min.hpp>
16 #include <boost/accumulators/statistics/max.hpp>
17 #include <boost/accumulators/statistics/mean.hpp>
18 #include <boost/accumulators/accumulators.hpp>
19 #include <boost/accumulators/framework/features.hpp>
20
21 namespace boost
22 {
23 namespace chrono
24 {
25
26 template<
27 typename Duration,
28 typename Features = accumulators::features<accumulators::tag::count,
29 accumulators::tag::sum, accumulators::tag::min,
30 accumulators::tag::max, accumulators::tag::mean>,
31 typename Weight = void>
32 struct laps_accumulator_set : last_lap<Duration>
33 {
34 typedef last_lap<Duration> base_type;
35 typedef Duration duration;
36 typedef typename duration::rep rep;
37 typedef accumulators::accumulator_set<rep, Features,
38 Weight> storage_type;
39 storage_type acc_;
40
41 void store(duration const& d)
42 {
43 this->base_type::store(d);
44 acc_(d.count());
45 }
46
47 void reset()
48 {
49 this->base_type::reset();
50 acc_ = storage_type();
51 }
52
53 storage_type const& accumulator_set() const { return acc_; }
54
55 duration elapsed() const { return duration(accumulators::sum(acc_)); }
56
57 };
58
59
60 } // namespace chrono
61 } // namespace boost
62
63
64 #endif
65
66