Thrill  0.1
profile_task.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * thrill/common/profile_task.hpp
3  *
4  * A thread running a set of tasks scheduled at regular time intervals. Used in
5  * Thrill for creating profiles of CPU usage, memory, etc.
6  *
7  * Part of Project Thrill - http://project-thrill.org
8  *
9  * Copyright (C) 2016 Timo Bingmann <[email protected]>
10  *
11  * All rights reserved. Published under the BSD-2 license in the LICENSE file.
12  ******************************************************************************/
13 
14 #pragma once
15 #ifndef THRILL_COMMON_PROFILE_TASK_HEADER
16 #define THRILL_COMMON_PROFILE_TASK_HEADER
17 
18 #include <chrono>
19 
20 namespace thrill {
21 namespace common {
22 
23 // forward declarations
24 class ProfileThread;
25 
27 {
28 public:
29  //! virtual destructor
30  virtual ~ProfileTask() { }
31 
32  //! method called by ProfileThread.
33  virtual void RunTask(const std::chrono::steady_clock::time_point& tp) = 0;
34 };
35 
37 {
38 public:
39  ProfileTaskRegistration(const std::chrono::milliseconds& period,
40  ProfileThread& profiler, ProfileTask* task);
41 
42  //! non-copyable: delete copy-constructor
44  //! non-copyable: delete assignment operator
46  operator = (const ProfileTaskRegistration&) = delete;
47 
49 
50 private:
51  //! profiler at which the task was registered
53  //! task to register and unregister
55 };
56 
57 } // namespace common
58 } // namespace thrill
59 
60 #endif // !THRILL_COMMON_PROFILE_TASK_HEADER
61 
62 /******************************************************************************/
ProfileTask * task_
task to register and unregister
virtual ~ProfileTask()
virtual destructor
virtual void RunTask(const std::chrono::steady_clock::time_point &tp)=0
method called by ProfileThread.
ProfileThread & profiler_
profiler at which the task was registered