Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

feat(task): add an interface to query thread info #464

Merged
merged 18 commits into from
May 21, 2020

Conversation

Smityz
Copy link
Contributor

@Smityz Smityz commented May 18, 2020

add an interface to query thread info

@neverchanje
Copy link
Contributor

Why copy a new service_engine and task_engine here?

Comment on lines 9 to 19
namespace dsn {
namespace replication {

class thread_info
{
public:
static std::vector<task_worker *> &get_info(int code);
};

} // namespace replication
} // namespace dsn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

@neverchanje neverchanje changed the title feat(hotkey detect): add an interface to query thread info feat(task): add an interface to query thread info May 19, 2020
Comment on lines 253 to 254
// code is in dsn/dist/replication/replication.codes.h
static std::vector<task_worker *> &get_info(int code);
Copy link
Contributor

@neverchanje neverchanje May 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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.

src/core/core/task.cpp Outdated Show resolved Hide resolved
acelyc111
acelyc111 previously approved these changes May 21, 2020
@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_threadpool_threads_info

@Smityz Smityz requested a review from acelyc111 May 21, 2020 08:22
@Smityz Smityz merged commit cd53ad6 into XiaoMi:master May 21, 2020
@Smityz Smityz deleted the hotspot_thread_formal branch June 4, 2020 15:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants