-
Notifications
You must be signed in to change notification settings - Fork 59
feat(task): add an interface to query thread info #464
Conversation
Why copy a new service_engine and task_engine here? |
License
include/dsn/tool-api/threads_info.h
Outdated
namespace dsn { | ||
namespace replication { | ||
|
||
class thread_info | ||
{ | ||
public: | ||
static std::vector<task_worker *> &get_info(int code); | ||
}; | ||
|
||
} // namespace replication | ||
} // namespace dsn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
namespace dsn { | |
namespace replication { | |
class thread_info | |
{ | |
public: | |
static std::vector<task_worker *> &get_info(int code); | |
}; | |
} // namespace replication | |
} // namespace dsn | |
namespace dsn { | |
const std::vector<task_worker *> &get_task_code_threads_info(task_code code); | |
} // namespace dsn |
There is nothing related to replication, so don't wrap the function in 'dsn::replication::' namespace.
Put this function to dsn/tool-api/task.h
, since it's a utility of the task module.
include/dsn/tool-api/task.h
Outdated
// code is in dsn/dist/replication/replication.codes.h | ||
static std::vector<task_worker *> &get_info(int code); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// code is in dsn/dist/replication/replication.codes.h | |
static std::vector<task_worker *> &get_info(int code); | |
static const std::vector<task_worker *> &get_task_code_threads_info(task_code code); |
Don't make it static member in class task
, put it in global space.
The task code is not always in dsn/dist/replication/replication.codes.h
, remove the comment.
The returned value must be const
.
50d81c9
to
8ef1d0c
Compare
include/dsn/tool-api/task.h
Outdated
@@ -614,6 +614,8 @@ class aio_task : public task | |||
}; | |||
typedef dsn::ref_ptr<aio_task> aio_task_ptr; | |||
|
|||
const std::vector<task_worker *> &get_task_code_threads_info(threadpool_code code); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_threadpool_threads_info
add an interface to query thread info