File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,17 @@ CpuBoundWork::CpuBoundWork(boost::asio::yield_context yc)
34
34
}
35
35
}
36
36
37
+ CpuBoundWork::CpuBoundWork (boost::asio::yield_context yc, Clock::duration& took)
38
+ : CpuBoundWork(std::move(yc), Clock::now(), took)
39
+ {
40
+ }
41
+
42
+ CpuBoundWork::CpuBoundWork (boost::asio::yield_context yc, Clock::time_point started, Clock::duration& took)
43
+ : CpuBoundWork(std::move(yc))
44
+ {
45
+ took = Clock::now () - started;
46
+ }
47
+
37
48
CpuBoundWork::~CpuBoundWork ()
38
49
{
39
50
if (!m_Done) {
Original file line number Diff line number Diff line change 8
8
#include " base/logger.hpp"
9
9
#include " base/shared-object.hpp"
10
10
#include < atomic>
11
+ #include < chrono>
11
12
#include < exception>
12
13
#include < memory>
13
14
#include < thread>
@@ -29,8 +30,14 @@ namespace icinga
29
30
*/
30
31
class CpuBoundWork
31
32
{
33
+ private:
34
+ using Clock = std::chrono::steady_clock;
35
+
36
+ CpuBoundWork (boost::asio::yield_context yc, Clock::time_point started, Clock::duration& took);
37
+
32
38
public:
33
39
CpuBoundWork (boost::asio::yield_context yc);
40
+ CpuBoundWork (boost::asio::yield_context yc, Clock::duration& took);
34
41
CpuBoundWork (const CpuBoundWork&) = delete ;
35
42
CpuBoundWork (CpuBoundWork&&) = delete ;
36
43
CpuBoundWork& operator =(const CpuBoundWork&) = delete ;
You can’t perform that action at this time.
0 commit comments